annotate contrib/whoisd/whoisd.pl @ 1146:da853b90f62b draft

Added mkz to anonet and as many of the needed files as I could think of. That as.c is the part of NetBSD traceroute that does AS lookups.
author epoch <epoch@hacking.allowed.org>
date Fri, 01 Nov 2013 09:12:45 +0000
parents ca4d35064aa2
children 1112129d9653
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
1 #!/usr/bin/perl
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
2 # coded by epoch.
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
3 # use inetd or tcpserver or something else.
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
4 # waste of time to do manual sockets for something like this.
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
5 # this isn't my baby. you can murder it if you want.
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
6
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
7 use strict;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
8
1143
ca4d35064aa2 fixed the ns.whois.ano thing... don't remember what I did to whoisd.pl. Oh well.
epoch <epoch@hacking.allowed.org>
parents: 1141
diff changeset
9 #maybe chroot this whoisd?
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
10 my $RESDB = "/services/resdb/resdb";
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
11
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
12 my $HACK=0;
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
13 my $QUERY=<stdin>;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
14 $QUERY =~ s/\r\n//g;
1143
ca4d35064aa2 fixed the ns.whois.ano thing... don't remember what I did to whoisd.pl. Oh well.
epoch <epoch@hacking.allowed.org>
parents: 1141
diff changeset
15 $QUERY =~ s/\///g;
ca4d35064aa2 fixed the ns.whois.ano thing... don't remember what I did to whoisd.pl. Oh well.
epoch <epoch@hacking.allowed.org>
parents: 1141
diff changeset
16 if($QUERY eq '') {
ca4d35064aa2 fixed the ns.whois.ano thing... don't remember what I did to whoisd.pl. Oh well.
epoch <epoch@hacking.allowed.org>
parents: 1141
diff changeset
17 printf "%% error. no query. wtf?";
ca4d35064aa2 fixed the ns.whois.ano thing... don't remember what I did to whoisd.pl. Oh well.
epoch <epoch@hacking.allowed.org>
parents: 1141
diff changeset
18 exit 0;
ca4d35064aa2 fixed the ns.whois.ano thing... don't remember what I did to whoisd.pl. Oh well.
epoch <epoch@hacking.allowed.org>
parents: 1141
diff changeset
19 }
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
20 my $out;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
21 my $title;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
22 my $value;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
23 my @parts;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
24 my $i;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
25
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
26 if($QUERY eq "!!\n") {
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
27 $QUERY=<stdin>;
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
28 $QUERY =~ s/^!r(.+?)[\/,].*$/\1/;
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
29 printf "A500\n"; #fake this I guess. Does it even use that number for anything?
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
30 printf "%% Looks like you're trying -A on a BSDian traceroute with this server.\n";
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
31 $HACK=1;
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
32 }
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
33
1146
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
34 sub ASN_lookup {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
35 if($QUERY =~ m/^AS(.+?)$/) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
36 printf "%% AS section for %s\n", $QUERY;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
37 my $AS=$1;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
38 chdir("$RESDB/db/as") || die "%% error";
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
39 if(chdir($AS) || die "%% error") {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
40 foreach(split(/\n/,`grep '' -r .`)) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
41 $out = $_;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
42 $out =~ s/^\.\///g;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
43 $out =~ m/^(.+?):(.+?)$/;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
44 ($title, $value) = ($1, $2);
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
45 printf "%-20s %s\n", $title . ":", $value;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
46 if($title eq "owner") {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
47 $QUERY = $value;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
48 }
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
49 }
1146
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
50 } else {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
51 printf "AS not found.";
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
52 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
53 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
54 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
55
1146
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
56 ASN_lookup();
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
57
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
58 # IPv4 addresses
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
59 if($QUERY =~ m/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/) {
1140
eec8e319f5bd forgot a newline
epoch <epoch@hacking.allowed.org>
parents: 1138
diff changeset
60 printf "%% IP section for %s\n", $QUERY unless $HACK;
1141
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
61 chdir("$RESDB/db/ip") || die "%% error";
1133
1a5d655cae9c fixed another bug in whoisd
epoch <epoch@hacking.allowed.org>
parents: 1132
diff changeset
62 @parts=split(/\./,$QUERY);
1a5d655cae9c fixed another bug in whoisd
epoch <epoch@hacking.allowed.org>
parents: 1132
diff changeset
63 for($i=0;$i<scalar(@parts)-1;$i++) {
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
64 if(!chdir(sprintf("%02X",$parts[$i]))) {
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
65 printf "%-20s %s\n", "error" . ":", "IP not found." unless $HACK;
1133
1a5d655cae9c fixed another bug in whoisd
epoch <epoch@hacking.allowed.org>
parents: 1132
diff changeset
66 exit;
1a5d655cae9c fixed another bug in whoisd
epoch <epoch@hacking.allowed.org>
parents: 1132
diff changeset
67 }
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
68 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
69 foreach(split(/\n/,`grep '' -r .`)) {
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
70 $out = $_;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
71 $out =~ s/^\.\///g;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
72 ($title, $value) = split(/:/,$out);
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
73 printf "%-20s %s\n", $title . ":", $value unless $HACK;
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
74 if($title eq "owner") {
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
75 $QUERY = $value;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
76 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
77 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
78 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
79
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
80 # if we get here and there's still a . in the query it is probably a domain.
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
81 if($QUERY =~ m/\./) {
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
82 printf "%% domain section for %s\n", $QUERY;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
83 @parts=split(/\./,$QUERY);
1141
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
84 chdir("$RESDB/db/dom") || die "%% error";
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
85 for($i=scalar(@parts)-1;$i>scalar(@parts)-3;$i--) {
1141
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
86 if(!$parts[$i]) {
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
87 printf "%% error";
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
88 exit
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
89 }
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
90 if(!chdir($parts[$i])) {
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
91 printf "%-20s %s", "warning" . ":", "domain not found.";
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
92 exit;
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
93 }
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
94 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
95 foreach(split(/\n/,`grep '' -r .`)) {
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
96 $out = $_;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
97 $out =~ s/^\.\///g;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
98 $out =~ m/^(.+?):(.+?)$/;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
99 ($title, $value) = ($1, $2);
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
100 printf "%-20s %s\n", $title . ":", $value;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
101 if($title eq "owner") {
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
102 $QUERY = $value;
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
103 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
104 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
105 }
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
106
1146
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
107 #ipv6 addresses
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
108 #if($QUERY =~ m/:/) {#close enough?
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
109 # $QUERY =~ s/://g;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
110 # $QUERY =~ s/[^a-fA-F0-9]//g;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
111 # $QUERY = uc($QUERY);
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
112 # chdir("$RESDB/db/ip6");
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
113 # foreach(split(//,$QUERY)) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
114 # chdir($_);;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
115 # }
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
116 # foreach(split(/\n/,`grep '' -r .`)) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
117 # $out = $_;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
118 # $out =~ s/^\.\///g;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
119 # $out =~ m/^(.+?):(.+?)$/;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
120 # ($title, $value) = ($1, $2);
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
121 # printf "%-20s %s\n", $title . ":", $value;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
122 # if($title eq "owner") {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
123 # $QUERY = $value;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
124 # }
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
125 # }
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
126 #}
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
127
1146
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
128
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
129 # default to assuming it is a name.
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
130 printf "%% user section for '%s'\n", $QUERY unless $HACK;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
131
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
132 chdir("$RESDB/db/usr") || die "%% error";
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
133 if(chdir($QUERY)) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
134 foreach(split(/\n/,`grep '' -r .`)) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
135 $out = $_;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
136 $out =~ s/^\.\///g;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
137 $out =~ m/^(.+?):(.+?)$/;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
138 ($title, $value) = ($1, $2);
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
139 printf "%-20s %s\n", $title . ":", $value unless $HACK;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
140 }
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
141 } else {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
142 printf "%-20s missing db/usr file.\n", "warning" . ":" unless $HACK;
1131
16cef39f682d Added a whoisd to make for easier querying of the resdb's info. Read the source.
epoch <epoch@hacking.allowed.org>
parents:
diff changeset
143 }
1146
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
144 chdir("$RESDB/db/as") || die "%% error";
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
145 my @asn;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
146 foreach(split(/\n/,`grep '^$QUERY\$' */owner | cut -d/ -f1`)) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
147 $out = $_;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
148 $out =~ s/\n//g;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
149 printf "%-20s AS%s\n", "origin" . ":", $out if $HACK;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
150 printf "%-20s AS%s\n", "origin" . ":", $out unless $HACK;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
151 @asn[scalar(@asn)]=$out;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
152 }
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
153 chdir("$RESDB/db/ip") || die "%% error";
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
154 my $merp;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
155 foreach(split(/\n/,`grep '^$QUERY\$' */*/*/owner | cut -d/ -f1-3`)) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
156 $merp=`cat $_/cidr`;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
157 chomp $merp;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
158 printf "%-20s %s\n", "cidr" . ":", $merp;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
159 }
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
160
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
161 foreach(split(/\n/,`grep -i -e "^$QUERY\$" "$RESDB/db/dom"/*/*/owner`)) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
162 $out = $_;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
163 $out =~ s/.*\/db\/dom\/(.+?)\/(.+?)\/owner.*/\2\.\1/;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
164 if ($out ne "") { #fix this comparison.
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
165 printf "%-20s %s\n", "domain" . ":", $out;
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
166 }
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
167 }
1132
2fd95bea3988 updated whoid
epoch <epoch@hacking.allowed.org>
parents: 1131
diff changeset
168
1146
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
169 foreach(@asn) {
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
170 $QUERY="AS$_"; #meh. fix to pass it instead of global.
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
171 ASN_lookup();
1132
2fd95bea3988 updated whoid
epoch <epoch@hacking.allowed.org>
parents: 1131
diff changeset
172 }
1146
da853b90f62b Added mkz to anonet and as many of the needed files as I could think of.
epoch <epoch@hacking.allowed.org>
parents: 1143
diff changeset
173 #printf "%-20s %s\n", "notice:","$QUERY did not claim any domains yet";