From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22660 invoked from network); 9 May 2021 00:11:25 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 9 May 2021 00:11:25 -0000 Received: from mail-ej1-f50.google.com ([209.85.218.50]) by 1ess; Sat May 8 10:48:18 -0400 2021 Received: by mail-ej1-f50.google.com with SMTP id u21so17925650ejo.13 for <9front@9front.org>; Sat, 08 May 2021 07:48:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:content-transfer-encoding:to:subject :date:from:mime-version:content-transfer-encoding; bh=cOWSshhGzJ3eXO56vLq3tnTLenefVHtaJLHFaf5eacM=; b=dKUl40AHK7eY0R4A4Rlqb5mDQlK2dqQLTfVlMATOiddoHuAuallsk1iwEOyY8bEkY1 it3/VLxGd4l3sCacPqpoRxcZFdjPsAk1tHD3/gBdx0z6C0Q/SeCOZdggvSSP+/PuA9Ac MOG/drP8ybc6jeaNvJp41AH0roLzhRMMRMfUdKhKdLlUZzckpSwL/K2OyHJXVlkhFV5M phkOkkOlB1rUespXHIReLa9iniGkIpAchAhLv0B1iLrtQQDAz53JeXiO7uqgODrR9Ybv ko2ISzEjA69jwJbbCLFfu+KDwyp9307FrDDXf4LnynMv1pBoB0jPvG/Tmt/kgYe1SP8G irbg== X-Gm-Message-State: AOAM532KMMw9LHxl0dAYpohvozsqZSu3GPrhsTcJsqnWq7Itj6kpfTA3 nfSsOjVP+wnVMWwOB9efw3OPg0CVVKbTCg== X-Google-Smtp-Source: ABdhPJxE9RQQHfowdkmdzn2g0S8GPETyM+VJEUK7uvY6Ns9PgH77ms/SnbiAcXl5zsHoDhj/X+uiWg== X-Received: by 2002:a17:906:4cc5:: with SMTP id q5mr15843655ejt.302.1620485290517; Sat, 08 May 2021 07:48:10 -0700 (PDT) Return-Path: Received: from nein (host-79-42-168-209.retail.telecomitalia.it. [79.42.168.209]) by smtp.gmail.com with ESMTPSA id m9sm5694408ejj.53.2021.05.08.07.48.09 for <9front@9front.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 08 May 2021 07:48:10 -0700 (PDT) Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit To: 9front@9front.org Date: Sat, 08 May 2021 16:48:09 +0200 From: gall0ws@aleph0.pw MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: agile database blockchain AJAX hypervisor replication Subject: [9front] iwhois(1) patch Reply-To: 9front@9front.org Precedence: bulk It's impossible to get whois right and probably nobody cares about it, nevertheless this small patch fixes some issues with the current version: * use a more common filter for default boilerplate (useful when following the referral chain) * updated boilerplate for *.co.uk *.net.uk *.org.uk * added case *.com *.net (got it from iana.org) * use ARIN for IPv6 addresses * when unsure, check first whether whois.nic.$tld exists otherwise usual fallback to InterNIC * fixed regexp for the referral chain (case, extra spaces or /) diff -r 9f569a2f16eb rc/bin/iwhois --- a/rc/bin/iwhois Wed May 05 16:57:19 2021 +0200 +++ b/rc/bin/iwhois Sat May 08 14:54:32 2021 +0200 @@ -7,7 +7,7 @@ shift } person=`{echo $1|sed s/@.*//} -fn boilerplate { sed -n '/^[ ]*[A-Za-z][A-Za-z]*:$/,$p' $* } +fn boilerplate { sed '/>>> ?Last update of ..... database:/,$d' $* } switch($1){ case *@* @@ -20,7 +20,7 @@ fn boilerplate { sed '/^>* Whois database was last updated on/,$d' $* } case *.co.uk *.net.uk *.org.uk machine=whois.nic.uk - fn boilerplate { sed '/^ +WHOIS database last updated at/,$d' $* } + fn boilerplate { sed '/^-- /,$d' $* } case *.ac.uk machine=whois.ja.net case *.au @@ -30,6 +30,8 @@ machine=whois.dns.be person='-T dn '^$person fn boilerplate { cat $* } +case *.com *.net + machine=whois.verisign-grs.com case *.cn machine=whois.cnnic.net.cn fn boilerplate { cat $* } @@ -55,16 +57,20 @@ fn boilerplate { cat $* } case *.org machine=whois.pir.org - fn boilerplate { sed '/^>>> Last update of WHOIS database/,$d' $* } case *.se machine=whois.nic-se.se fn boilerplate { grep -v '^#' $* | uniq } -case [0-9]*.[0-9]*.[0-9]*.[0-9]* +case [0-9]*.[0-9]*.[0-9]*.[0-9]* *:*:* machine=whois.arin.net fn boilerplate { cat $* } case * - machine=whois.internic.net # alternate: whois.networksolutions.com - fn boilerplate { cat $* } + tld=`{echo $1 | sed 's;.*\.(.*)$;\1;'} + if(ndb/dnsgetip whois.nic.$tld >/dev/null >[2=1]) + machine=whois.nic.$tld + if not{ + machine=whois.internic.net # alternate: whois.networksolutions.com + fn boilerplate { cat $* } + } } if(! ~ $#noboiler 0) fn boilerplate { cat $* } @@ -73,8 +79,8 @@ rm -f $file } echo $person | telnet -nr tcp!$machine!whois > $file -x=`{ sed -n -e 's/.*Whois Server: (.*)/\1/p' \ - -e 's;.*ReferralServer: whois://(.*)(:43)?;\1;p' $file } +x=`{ tr A-Z a-z < $file | sed -n -e 's;.*whois server: ([^ /]+).*$;\1;p' \ + -e 's;.*referralserver: +whois://(.*)(:43)?;\1;p'} switch($#x){ case 0 ; # e.g., for .ca