[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: all you cgi scripters out there.





> Anyone have a cgi script that will perform a traceroute from a server and
> parse the results as html?

Something like this should work. Just pass the end IP address to it via
the "address" variable.

BTW, what ever happened to Melissa (was that her name?) "A naked American
man just stole my balloons." "Hwwhaat?!" 

You know, the Co-ed closed down. What do you suppose became of Emiliano?

======================

#!/usr/bin/perl

&parse_form_data (*FORM);

$trace = `traceroute $FORM{address}`;

print "Content-type: text/html", "\n\n";

print "<html>";
print "<head>";
print "<title>Amazing Tracerouting for Charles</title>";
print "</head>";
print "<body>";
print "<font size=+3><strong>Your results:</strong></font>";
print "<p><pre>", $trace, "</pre>";
print "</body>";
print "</html>";

exit (0);

sub parse_form_data
{
   local (*DATA) = @_;
   local ( $INFO, @PAIRS, $KEY_VALUE, $KEY, $VALUE);

   read (STDIN, $INFO, $ENV{'CONTENT_LENGTH'});
   @PAIRS = split (/&/, $INFO);
   foreach $KEY_VALUE (@PAIRS) {
      ($KEY, $VALUE) = split (/=/, $KEY_VALUE);
      $VALUE =~ tr/+/ /;
      $VALUE =~ s/%(..)/pack("c",hex($1))/ge;
      $VALUE =~ tr/,/ /;
      if (defined($DATA{$KEY})) {
         $DATA{&KEY} = join ("\0", $DATA{$KEY}, $VALUE);
      } else {
            $DATA{$KEY} = $VALUE;
      }
   }
}


--
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.