Web Hosting Talk







View Full Version : Trace DNS Script


RWH
04-04-2002, 08:42 PM
Having problems with script found here only parts of it do not work. http://www.realwebhost.net/trace.php
Get these 2 errors. Any help would be appreciated.


DNS Query Results:


Warning: Address is not in a.b.c.d form in /home/username/public_html/trace.php on line 87
Can't do a DNS query without a hostname.

WWWhois Results:


Warning: Address is not in a.b.c.d form in /home/username/public_html/trace.php on line 101
Can't WWWhois without a domain name.





function dig($target){
message("<p><b>DNS Query Results:</b><blockquote>");
#$target = gethostbyaddr($target);

line 87 next line

if (! eregi("[a-zA-Z]", ($target = gethostbyaddr($target))) )
$msg .= "Can't do a DNS query without a hostname.";
else{
if (! $msg .= trim(nl2br(`dig any '$target'`))) #bugfix
$msg .= "The <i>dig</i> command is not working on your system.";
}
#TODO: Clean up output, remove ;;'s and DiG headers
$msg .= "</blockquote></p>";
message($msg);
}

function wwwhois($target){
$server = "whois.crsnic.net";
message("<p><b>WWWhois Results:</b><blockquote>");
$target = gethostbyaddr($target);

line 101 next line

if (! eregi("[a-zA-Z]", $target))
$msg .= "Can't WWWhois without a domain name.";

webx
04-04-2002, 10:57 PM
Seems to be working fine?

RWH
04-05-2002, 01:04 AM
Yes I updated script with new version after I posted that above.

Now there is only 2 things I can not get to work Ping and trace.
Any ideas?

webx
04-05-2002, 02:38 AM
Can't say anything unless I look at the code. The reply is so fast, looks like it even do not 'try' to trace.

RWH
04-05-2002, 05:08 AM
Ping Results:

Ping failed. Host may not be active.

Traceroute Results:

Traceroute failed. Host may not be active.


By the way from shell traceroute works
here is how it looks in a shell output

root@sandy [~]# /usr/sbin/traceroute realwebhost.net
traceroute to realwebhost.net (64.71.176.104), 30 hops max, 38 byte packets
1 64.71.176.104 (64.71.176.104) 1.054 ms 1.084 ms 0.886 ms



function p($target){
message("<p><b>Ping Results:</b><blockquote>");
if (! $msg .= trim(nl2br(`ping -c5 '$target'`))) #bugfix
$msg .= "Ping failed. Host may not be active.";
$msg .= "</blockquote></p>";
message($msg);
}

function tr($target){
message("<p><b>Traceroute Results:</b><blockquote>");
if (! $msg .= trim(nl2br(`/usr/sbin/traceroute '$target'`))) #bugfix
$msg .= "Traceroute failed. Host may not be active.";
$msg .= "</blockquote></p>";
message($msg);
}

RWH
04-05-2002, 02:11 PM
We have it working we had to chmod 4755 /usr/sbin/traceroute
We removed the traceroute part though from script because it took way to long on some ip's and domain names, We left ping though.

kunal
04-05-2002, 02:38 PM
Originally posted by webhost
We have it working we had to chmod 4755 /usr/sbin/traceroute
We removed the traceroute part though from script because it took way to long on some ip's and domain names, We left ping though.


interesting solution... what made you think of that? :)