summaryrefslogtreecommitdiff
path: root/contrib/whoisd
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2013-08-23 18:43:12 +0000
committerepoch <epoch@hacking.allowed.org>2013-08-23 18:43:12 +0000
commitbd6625e258cb8f551fa12ce1cc689f6163788235 (patch)
tree9131d667adc49590260b7ee21fa05f25584dfba8 /contrib/whoisd
parent954370bda476ad83458fde843a43f0477c6fcb42 (diff)
downloadresdb-bd6625e258cb8f551fa12ce1cc689f6163788235.tar.gz
resdb-bd6625e258cb8f551fa12ce1cc689f6163788235.zip
fixed another bug in whoisd
Diffstat (limited to 'contrib/whoisd')
-rwxr-xr-xcontrib/whoisd/whoisd.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/whoisd/whoisd.pl b/contrib/whoisd/whoisd.pl
index 06c2cdf..5b9aa54 100755
--- a/contrib/whoisd/whoisd.pl
+++ b/contrib/whoisd/whoisd.pl
@@ -41,8 +41,12 @@ if($QUERY =~ m/^AS(.+?)$/) {
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]?)$/) {
printf "%% IP section for %s\n", $QUERY;
chdir("$RESDB/db/ip");
- foreach(split(/\./,$QUERY)) {
- chdir(sprintf("%02x",$_));
+ @parts=split(/\./,$QUERY);
+ for($i=0;$i<scalar(@parts)-1;$i++) {
+ if(!chdir(sprintf("%02x",$parts[$i]))) {
+ printf "%-20s %s\n", "error" . ":", "IP not found.";
+ exit;
+ }
}
foreach(split(/\n/,`grep '' -r .`)) {
$out = $_;