tcploop TCP client and server for bug hunting

by 1vuio0pswjnm7on 6/18/2025, 1:34 AMwith 1 comments

by 1vuio0pswjnm7on 6/20/2025, 5:11 PM

.

   --- tcploop.c2025-06-17 16:40:54.531128562 +0000
   +++ tcploop1.c2025-06-18 18:20:53.515128562 +0000
   @@ -514,0 +515 @@
   +        if (arg[1]=='-'){count=fread(trash,1,sizeof(trash),stdin);goto s;}
   @@ -524,2 +525 @@
   -
   -        while (1) {
   +        s:while (1) {

   cc -static -s -pedantic tcploop.c
default backlog is 1000

   a.out -v -t 8001 N L A E Xo echo ok
   a.out -v -t 8001 N L A E S:ok\\n
   a.out -v -t 8001 N L A S:"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" Xo date +"%a, %d %b %Y %H:%M:%S GMT"

   a.out 8001 C S G Q Xi cat 
   a.out example.com:80 C S:"GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n" Xi cat
client example illustrating combined use of S: plus S- and R

   x=microsoft
   y=github.com
   set -x
   z=$(
   echo "GET /orgs/$x/repositories?type=all HTTP/1.0@#Host: github.com@#" \
   |tr @# '\r\n' \
   |a.out $y:80 C S- R146000 Xi sed -n '/pageCount\":/{s/.*pageCount\"://;s/,.*//;p;q;}'
   )
   test $z||exit
   seq -f 'GET /orgs/'$x'/repositories?type=all&page=%g HTTP/1.1@#Host: github.com@#Connection: keep-alive@#' 1 $z \
   |tr @# '\r\n'  \
   |a.out $y:80 C S- S:"HEAD / HTTP/1.0\r\nHost: 127.0.0.1\r\nConnection: close\r\n\r\n" Xi \
   sh -c "echo '<base href=https://github.com />';yy045"
   
   # seq -f 'https://'$y'/orgs/'$x'/repositories?type=all&page=%g' 1 $z \
   # |yy025 \
   # |a.out $y:80 C S- Xi yy045 \
   # |sed '1s|^|<base href=https://github.com />|'