/* remove HTTP headers from multiple gzip or single zip from stdin */
int fileno (FILE *);
int setenv (const char *, const char *, int);
#define jmp (yy_start) = 1 + 2 *
int x;
%option nounput noinput noyywrap
%%
HTTP\/[\40-\176]+\x0d\x0a x++;
[\40-\176]+:[\40-\176]+\r\n if(!x)fwrite(yytext,1,yyleng,yyout);
\x0D\x0A if(!x)fwrite(yytext,1,yyleng,yyout);x=0;
%%
int main()
{
yylex();
exit(0);
}
Usage example: ftp -4 https://data.commoncrawl.org/crawl-data/CC-MAIN-2023-50/robotstxt.paths.gz # <-- 180K
gzip -dc robotstxt.paths.gz \
|head -5 \
|sed 's>.*>GET /& HTTP/1.1[]Host: data.commoncrawl.org[]Connection: >;
$!s/$/keep-alive[]/;$s/$/close[]/' \
|tr [] '\r\n' \
|openssl s_client -quiet -connect data.commoncrawl.org:443 \
|yy054 \
|zegrep -a '(^Sitemap:)|(^Host:)|(^WARC-Target-URI:)|(^WARC-IP-Address:)' > 1.txt
exec cat 1.txt y="GET /pub/NetBSD-archive/NetBSD-1.0/source/src10/"
z="Host: archive.netbsd.org"
sed '$!s>.*>'"$y"'& HTTP/1.1[]'"$z"'[]Connection: keep-alive[]>;
$s>.*>'"$y"'& HTTP/1.0[]'"$z"'[]>' << eof \
|tr '[]' '\r\n' \
|openssl s_client -quiet -connect 151.101.129.6:443 -servername archive.netbsd.org > http+gzip
src10.aa
src10.ab
src10.ac
src10.ad
src10.ae
src10.af
src10.ag
src10.ah
src10.ai
src10.aj
src10.ak
src10.al
src10.am
src10.an
src10.ao
src10.ap
src10.aq
src10.ar
src10.as
src10.at
src10.au
src10.av
src10.aw
src10.ax
src10.ay
src10.az
src10.ba
src10.bb
src10.bc
src10.bd
src10.be
src10.bf
eof
yy054 < http+gzip|tar tvzf /dev/stdin
Alternate usage: yy054 print < http+gzip
yy054 x < http+gzip links -no-connect -dump https://news.ycombinator.com/item?id=38727772 \
|sed '1,4d;77,$d;s/[ ]\{6\}//' \
|flex -8Cem;cc -O3 -std=c89 -W -Wall -pipe lex.yy.c -static -o yy044
strip -s yy044
Example usage: # NB. not a real cookie
curl -H "cookie=user=santa&K7RGzmUtAoKv9OIRMfQ9bfwYpiDEuypp" -siA "" \
https://news.ycombinator.com \
|host=news.ycombinator.com/ yy044 r \
|sed -n 's/&/\&/g;/vote/p' /* chunked transfer decoding */
#define echo do{if(fwrite(yytext,(size_t)yyleng,1,yyout)){}}while(0)
#define jmp (yy_start) = 1 + 2 *
int fileno (FILE *);
int ischunked,chunksize,count;
xa "\15"|"\12"
xb "\15\12"
xc "HTTP/0.9"|"HTTP/1.0"|"HTTP/1.1"
xd [Cc][Hh][Uu][Nn][Kk][Ee][Dd]
xe [0-9a-fA-F]+\r\n
xf [0-9a-fA-F]*\r\n
%option noyywrap nounput noinput
%s xb xc xd xe xf
%%
^{xc} echo;ischunked=0;jmp xc;
<xc>^transfer-encoding: echo;jmp xb;
<xb>\r\n\r\n echo;jmp xe;
<xb>{xd} echo;ischunked=1;
<xe>{xf}|{xe} {
count=0;
if(ischunked==1)
{chunksize=strtol(yytext,NULL,16);
jmp xd;};
};
<xd>{xb} jmp xf;
<xd>. {
count++;
if(count==chunksize)jmp xe;
echo;
};
<xf>^[A-Fa-f0-9]+{xa}
<xf>{xa}+[A-Fa-f0-9]+{xa}
<xf>{xb}[A-Fa-f0-9]+{xb}
%%
int main(){ yylex();exit(0);} (export Connection=keep-alive
x1=http://www.minimizedistraction.com/img/vrg_google_doc_final_vrs03-
x2(){ seq -f "$x1%g.jpg" $1 $2;};
x3(){ yy025|nc -vvn 173.236.175.199 80;};
x2 1 100|x3;
x2 101 200|x3;
)|exec yy056|exec od -An -tx1 -vw99999|exec tr -d '\40'|exec sed 's/ffd9ffd8/ffd9\
ffd8/g'|exec sed -n /ffd8/p|exec split -l1;
for x in x??;do xxd -p -r < $x > $x.jpg;rm $x;done;
convert x??.jpg 1.pdf 2>/dev/null;rm x??.jpg
ls -l ./1.pdf
More details on yy025 and yy056 here:
https://news.ycombinator.com/item?id=27769701 printf "GET /ee.txt\r\nHost: stuff-storage.sfo3.digitaloceanspaces.com\r\nConnection: close\r\n\r\n"|openssl s_client -connect 138.68.34.161:443 -quiet|yy054|gzip -dc > 1.htm
firefox ./1.htm
Hope this helps. Apologies I initially guessed wrong on here doc. I was not sure what was meant by "gibberish". Looks like the here doc is working fine. flex -8iCrfa <<eof
int fileno (FILE *);
xa "\15"|"\12"
xb "\15\12"
%option noyywrap nounput noinput
%%
^[A-Fa-f0-9]+{xa}
{xa}+[A-Fa-f0-9]+{xa}
{xb}[A-Fa-f0-9]+{xb}
%%
int main(){ yylex();exit(0);}
eof
cc -std=c89 -Wall -pipe lex.yy.c -static -o yy045
Example printf 'GET / HTTP/1.1\r\nHost: us.yahoo.com\r\nConnection: close\r\n\r\n'|openssl s_client -connect us.yahoo.com:443 -ign_eof|./yy045 static void flush(void) {
if (writeall(1, buf, buflen) == -1) _exit(errno);
buflen = 0;
}
static void wrch(const char ch) {
if (buflen >= sizeof buf) flush();
buf[buflen++] = ch;
return;
}
char inbuf[128];
int main(int argc, char **argv) {
long long r, i;
for (;;) {
r = read(0, inbuf, sizeof inbuf);
if (r == -1) _exit(errno);
if (r == 0) break;
for (i = 0; i < r; ++i) {
wrch("0123456789abcdef"[15 & (inbuf[i] >> 4)]);
wrch("0123456789abcdef"[15 & inbuf[i]]);
}
}
wrch('\n');
return 0;
} #include <unistd.h>
#include <errno.h>
#include <sys/types.h>
int writeall(int fd,const void *xv,long long xlen)
{
const unsigned char *x = xv;
long long w;
while (xlen > 0) {
w = xlen;
if (w > 1048576) w = 1048576;
w = write(fd,x,w);
x += w;
xlen -= w;
}
return 0;
}
static int hexdigit(char x)
{
if (x >= '0' && x <= '9') return x - '0';
if (x >= 'a' && x <= 'f') return 10 + (x - 'a');
if (x >= 'A' && x <= 'F') return 10 + (x - 'A');
return -1;
}
int hexparse(unsigned char *y,long long len,const char *x)
{
if (!x) return 0;
while (len > 0) {
int digit0;
int digit1;
digit0 = hexdigit(x[0]); if (digit0 == -1) return 0;
digit1 = hexdigit(x[1]); if (digit1 == -1) return 0;
*y++ = digit1 + 16 * digit0;
--len;
x += 2;
}
if (x[0]) return 0;
return 1;
} GET /index.html HTTP/1.1
Host: example.com
Connection: keep-alive
Obviously, the web advertising/tracking industry, including companies like Google that serve this sector, use headers for their own purposes. Online advertising services. That's when presumably they could get big. However, as a user, I have no pressing need for the ability to send/receive larger headers. # 3.sh
#!/bin/sh
while IFS= read -r x;do sed -n '/\./p;/\./q'|xxd -p |drill -i /dev/stdin 2>/dev/null;done
sed -n '/pattern/=' file|yy092|sed -nf/dev/stdin file