Here is a brief demonstration of how "DOH DNS servers" can be useful. Nevermind the idea of applications having their own DNS caches. 1. fetch page of html, e.g., hn front page curl https://news.ycombinator.com > 1.htm 2. extract urls from 1.htm yyt 1.txt (example scanner "yyt" provided below as t.l) 3. convert urls to hostnames g=1.txt k 1 (example script provided below as "1.k") 4. retrieve json dns data from doh d…
ftp -4o 1.htm $1;
fetch -4o 1.htm $1;
wget -4o 1.htm $1;
curl -4o 1.htm $1;
exec k 1d \
|exec tcs cloudflare-dns.com cloudflare-dns.com >1.json;
yyf 1.csv;
#t=list exec k j;
#t=hosts exec k j;
t=db exec k j >1.csv;
#t=zone exec k j;
\\
k).Q.fs[{`t insert +:`ts`ip`hn!("ZSS";",")0:x}]`:1.csv
k)t
\\
/ 1d.k
/ urls, hosts
a:0:"1.htm";
a:,/$a;
a:_ssr[a;"\42";""];
a:_ssr[a;"http://";"https://"];
a:_ssr[a;"src=//";"https://"];
b:a _ss "https://";
a:b _ a;
b:{a[x] _ss "[^a-z^A-Z^0-9^.^-]"}'!#a / fail: https://example.com-
c:{1#(3_ b[x])}'!#b;
b:{c[x]#a[x]}'!#c;
b:?:/b;
b:{8_ b[x] }'!#b;
/ http
a:"GET /dns-query?ct=application/dns-json&name=";
c:"&type=1 HTTP/1.1\r\nHost: cloudflare-dns.com\r\nConnection: ";
d:"keep-alive";
e:"close";
f:"\r\n\r\n";
g:(#b)-1;
h:{a,b[x],c,d,f}'!g;
i:a,b[g],c,e,f;
`0:,/$h,i;
\\
int main(int argc, char **argv){
char *b[17];
b[0]="/usr/bin/openssl";
b[1]="s_client";
b[2]="-tls1_2";
b[3]="-no_ssl2";
b[4]="-no_ssl3";
b[5]="-ign_eof";
b[6]="-no_ticket";
b[7]="-tlsextdebug";
b[8]="-servername";
b[9]=argv[2];
b[10]="-verify";
b[11]="9";
/* -host, -port removed from manual */
/* but still found in s_client.c */
b[12]="-host";
b[13]=argv[1];
b[14]="-port";
b[15]="443";
b[16]=(void *)0;
execve("/usr/bin/openssl",b,(void *)0);
}
/j.k
j:("SSSSSS";",")0:"1.csv";
k:_getenv "t";
if[k _sm "list";`0:{,/$j[4;x]}'!#j[5]];
if[k _sm "hosts";`0:{,/$j[5;x]," ",j[4;x]}'!#j[5]];
if[k _sm "db";`0:{,/$j[2;x],".",j[1;x],".",j[0;x],"T",j[3;x],",",j[5;x],",",j[4;x]}'!#j[2]];
if[k _sm "zone";`0:{,/$".",j[4;x],"\n&",j[4;x],".:127.0.0.1:5\n=",j[4;x],".:",j[5;x],":5"}'!#j[2]];
\\
\\
/* f.l */
#define echo ECHO
#define jmp BEGIN
#define p printf
#define nl p("\n")
#define s p(",")
%s xa xb xc xd xx xy xz
xa "\"Question\":[{\"name\": \""
ya ", \"type\": 1}],"
x1 "\"type\": 1"
x0 "\"type\": "[^1]","
yb "\"data\": \""
xw "Date: "
xx \"\},\{\"
xy \"\}\]\}
xz "Sun, "|"Mon, "|"Tues, "|"Wed, "|"Thu, "|"Fri, "|"Sat, "
%%
{xw} jmp xz;
"GMT" jmp xy;
{xz}
" Jan " p(",01,");
" Feb " p(",02,");
" Mar " p(",03,");
" Apr " p(",04,");
" May " p(",05,");
" Jun " p(",06,");
" Jul " p(",07,");
" Aug " p(",08,");
" Sep " p(",09,");
" Oct " p(",10,");
" Nov " p(",11,");
" Dec " p(",12,");
\40 s;
. echo;
{xa} jmp xa;
{ya} s;jmp xb;
\.\"
. echo;
{x0} jmp xx;
{xy} nl;jmp 0;
{xx} jmp xb;
{x1} jmp xc;
.
{yb} jmp xd;
.
\"\} nl;jmp 0;
. echo;
\n
.
%%
int main(){ yylex();}
int yywrap(){}