"; while (!feof($handle)) { echo fgets($handle, 4096); flush(); } echo ""; } error_reporting(0); print "\n"; print "\n"; print "Network Utility on Server $_SERVER[HTTP_HOST]\n"; print "\n"; print "\n"; print ""; print "

Network Utility on Server $_SERVER[HTTP_HOST]

\n"; print "
\n"; print "

\n"; print "\n"; print "\n"; print "\n"; if ($_ENV[COMPUTERNAME] == "") print "\n"; print "

\n"; flush(); error_reporting(0); switch ($_POST[action]) { case "Ping": if ($_ENV[COMPUTERNAME] == "") { $log = fopen("../log/netutils", "a+"); fwrite($log, sprintf("%s: %s (%s) ping %s\n", date("d/M/Y H:i:s"), $_SERVER[REMOTE_ADDR], gethostbyaddr($_SERVER[REMOTE_ADDR]), $_POST[addr])); fclose($log); $handle = popen("ping -c 10 $_POST[addr]", "r"); } else $handle = popen("ping -n 10 $_POST[addr]", "r"); read_and_output($handle); echo "

Ping complete

\n"; break; case "Whois": $handle = popen("whois $_POST[addr]", "r"); read_and_output($handle); break; case "Trace Route": if ($_ENV[COMPUTERNAME] == "") { $log = fopen("../log/netutils", "a+"); fwrite($log, sprintf("%s: %s (%s) traceroute %s\n", date("d/M/Y H:i:s"), $_SERVER[REMOTE_ADDR], gethostbyaddr($_SERVER[REMOTE_ADDR]), $_POST[addr])); fclose($log); $handle = popen("traceroute $_POST[addr]", "r"); } else $handle = popen("tracert $_POST[addr]", "r"); read_and_output($handle); break; case "Host Lookup": print "

"; if (ereg("[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+", $_POST[addr])) { $hostname = @gethostbyaddr($_POST[addr]); if ( $hostname != "" && $hostname != $_POST[addr]) { print "$_POST[addr] is $hostname"; } else print "$_POST[addr] could not be resolved"; } else { $hostname = @gethostbyname($_POST[addr]); if ( $hostname != "" && $hostname != $_POST[addr]) { print "$_POST[addr] is $hostname"; $realhost = @gethostbyaddr($hostname); if ( $realhost != $_POST[addr] && $realhost != $hostname) print "
\n$_POST[addr] is hosted on $realhost"; } else print "$_POST[addr] could not be resolved"; } print "

\n"; if ($_ENV[COMPUTERNAME] == "") { $log = fopen("../log/netutils", "a+"); if ($php_errormsg == "") fwrite($log, sprintf("%s: %s (%s) resolving %s, returned %s\n", date("d/M/Y H:i:s"), $_SERVER[REMOTE_ADDR], gethostbyaddr($_SERVER[REMOTE_ADDR]), $_POST[addr], $hostname)); else fwrite($log, sprintf("%s: %s (%s) resolving %s, error: %s\n", date("d/M/Y H:i:s"), $_SERVER[REMOTE_ADDR], gethostbyaddr($_SERVER[REMOTE_ADDR]), $_POST[addr], $php_error)); fclose($log); } break; } ?>

Reverse WHOIS