blob: 9816c0b3749342f74171ea7f9692187e2b94d2e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#!/usr/local/bin/perl
#
# traceroute: a CGI script that provides a Web interface to traceroute
#
# Copyright 1998 Gerald Oskoboiny <gerald@w3.org>
#
# This source code is available under the license at:
# http://www.w3.org/Consortium/Legal/copyright-software
#
# $Id: traceroute,v 1.3 2001-12-21 23:39:27 gerald Exp $
#
print <<"EOF";
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>service discontinued</title>
</head>
<body>
<p>
Sorry, the traceroute service that used to be here has been turned off due to
abuse. There are a number of other <a
href="http://www.google.com/search?q=traceroute">traceroute gateways</a>
online, please use one of those instead. (if you are specifically interested
in the route from MIT, see <a
href="http://jis.mit.edu:8001/cgi-bin/traceroute">TraceRoute from MIT</a>.)
</p>
<hr>
<address>
<a href="http://www.w3.org/People/Gerald/">Gerald Oskoboiny</a><br>
\$Date: 2001-12-21 23:39:27 $ \
</address>
</body>
EOF
exit; # turned off due to abuse; the real script follows:
$| = 1;
# accept either traceroute/foo or traceroute?foo; default to REMOTE_ADDR
# if nothing else is specified
$addr = $ENV{PATH_INFO} || $ENV{QUERY_STRING} || $ENV{REMOTE_ADDR};
$addr =~ tr/+/ /;
$addr =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$addr =~ s,^addr=,,;
$addr =~ s/[^A-Za-z0-9\.-]//g; # for security
print <<"EOF";
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Traceroute from validator.w3.org to $addr</title>
<link rev="made" href="mailto:gerald\@w3.org">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000ee" vlink="#551a8b">
<p>
Here is the result of a traceroute from <code>validator.w3.org</code>
to <code>$addr</code>:
</p>
<form action="/traceroute">
<input type=text name=addr size=40 value="$addr">
<input type=submit value="Traceroute">
<input type=reset>
</form>
<pre>
EOF
open( TRACEROUTE, "/usr/sbin/traceroute $addr | " ) ||
die "couldn't open pipe to traceroute! $!";
while (<TRACEROUTE>) {
chomp;
s/\&/\&/g;
s/\</\</g;
print "$_\n";
}
close( TRACEROUTE ) || die "couldn't close pipe to traceroute! $!";
print <<"EOF";
</pre>
<hr>
<address>
<a href="http://www.w3.org/People/Gerald/">Gerald Oskoboiny</a><br>
\$Date: 2001-12-21 23:39:27 $ \
</address>
EOF
exit;
|