annotate contrib/whoisd/whoisd.pl @ 1178:1112129d9653 draft

hey, pgp key! don't remember what I changed in whoisd.pl
author epoch <epoch@hacking.allowed.ano>
date Tue, 14 Oct 2014 03:05:00 +0000
parents da853b90f62b
children 98707534e274
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;
1178
1112129d9653 hey, pgp key! don't remember what I changed in whoisd.pl
epoch <epoch@hacking.allowed.ano>
parents: 1146
diff changeset
23 my @value;
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
24 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
25 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
26
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
27 if($QUERY eq "!!\n") {
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
28 $QUERY=<stdin>;
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
29 $QUERY =~ s/^!r(.+?)[\/,].*$/\1/;
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
30 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
31 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
32 $HACK=1;
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
33 }
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
34
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
35 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
36 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
37 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
38 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
39 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
40 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
41 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
42 $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
43 $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
44 $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
45 ($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
46 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
47 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
48 $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
49 }
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
50 }
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
51 } 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
52 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
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 }
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
56
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
57 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
58
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
59 # 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
60 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
61 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
62 chdir("$RESDB/db/ip") || die "%% error";
1133
1a5d655cae9c fixed another bug in whoisd
epoch <epoch@hacking.allowed.org>
parents: 1132
diff changeset
63 @parts=split(/\./,$QUERY);
1a5d655cae9c fixed another bug in whoisd
epoch <epoch@hacking.allowed.org>
parents: 1132
diff changeset
64 for($i=0;$i<scalar(@parts)-1;$i++) {
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
65 if(!chdir(sprintf("%02X",$parts[$i]))) {
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
66 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
67 exit;
1a5d655cae9c fixed another bug in whoisd
epoch <epoch@hacking.allowed.org>
parents: 1132
diff changeset
68 }
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
69 }
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 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
71 $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
72 $out =~ s/^\.\///g;
1178
1112129d9653 hey, pgp key! don't remember what I changed in whoisd.pl
epoch <epoch@hacking.allowed.ano>
parents: 1146
diff changeset
73 ($title, @value) = split(/:/,$out);
1112129d9653 hey, pgp key! don't remember what I changed in whoisd.pl
epoch <epoch@hacking.allowed.ano>
parents: 1146
diff changeset
74 $value=join(":",@value);
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
75 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
76 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
77 $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
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 }
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
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 # 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
83 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
84 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
85 @parts=split(/\./,$QUERY);
1141
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
86 chdir("$RESDB/db/dom") || die "%% error";
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
87 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
88 if(!$parts[$i]) {
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
89 printf "%% error";
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
90 exit
58130f5eecf2 found a bug when sending just '.'... wasn't good.
epoch <epoch@hacking.allowed.org>
parents: 1140
diff changeset
91 }
1138
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
92 if(!chdir($parts[$i])) {
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
93 printf "%-20s %s", "warning" . ":", "domain not found.";
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
94 exit;
c95369b825a2 whoisd... don't remember.
epoch <epoch@hacking.allowed.org>
parents: 1133
diff changeset
95 }
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
96 }
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 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
98 $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
99 $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
100 $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
101 ($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
102 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
103 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
104 $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
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 }
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
107 }
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
108
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
109 #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
110 #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
111 # $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
112 # $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
113 # $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
114 # 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
115 # 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
116 # 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
117 # }
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 # 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
119 # $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
120 # $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
121 # $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
122 # ($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
123 # 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
124 # 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
125 # $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
126 # }
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
127 # }
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 #}
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
129
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
130
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 # 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
132 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
133
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 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
135 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
136 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
137 $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
138 $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
139 $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
140 ($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
141 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
142 }
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
143 } 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
144 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
145 }
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
146 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
147 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
148 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
149 $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
150 $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
151 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
152 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
153 @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
154 }
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 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
156 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
157 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
158 $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
159 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
160 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
161 }
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
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 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
164 $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
165 $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
166 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
167 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
168 }
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 }
1132
2fd95bea3988 updated whoid
epoch <epoch@hacking.allowed.org>
parents: 1131
diff changeset
170
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
171 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
172 $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
173 ASN_lookup();
1132
2fd95bea3988 updated whoid
epoch <epoch@hacking.allowed.org>
parents: 1131
diff changeset
174 }
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
175 #printf "%-20s %s\n", "notice:","$QUERY did not claim any domains yet";