#!/usr/local/bin/perl # whois.cgi by David Efflandt tech-ph@de-srv.com # last updated 8/3/00 # Checks who owns a domain or IP address use CGI qw/:standard :netscape/; $fwhois = 0; # regular whois 0, fwhois 1 print header,start_html('Who Owns Domain or IP'); if ($who = param('who')) { if ($who =~ s/[\/\\\|\&\*\?;()<>`]//g) { @result = "Invalid entry: $who\n"; } elsif (param('server') && param('server') !~ /[\/\\\|\&\*\?;()<>`]/) { $server = param('server'); if ($fwhois) { @result = `whois $who\@$server 2>&1`; } else { @result = `whois -h $server $who 2>&1`; } } elsif ($who =~ /^\d+\.\d+\.\d+\.\d+$/) { if ($fwhois) { @result = `whois $who\@arin.net 2>&1`; } else { @result = `whois -h arin.net $who 2>&1`; } } else { @result = `whois $who 2>&1`; } print h1("Result of whois $who"),hr,pre(@result),hr; } print start_form, center(table({border=>0,cellspacing=>0,cellpadding=>5,bgcolor=>'lightblue'}, Tr([ th({colspan=>2},["Who Owns Domain or IP"]), td({align=>'right'},['Domain or IP: ']). td([textfield('who').' (required)']), td({align=>'right'},['Whois Server: ']). td([textfield('server').' (optional)']), th({colspan=>2},[submit]) ]))),end_form,end_html;