3 * Command line script to check for an open proxy at a specified location
13 * Exit if there are not enough parameters, or if it's not command line mode
15 if ( ( isset( $_REQUEST ) && array_key_exists( 'argv', $_REQUEST ) ) ||
count( $argv ) < 4 ) {
16 $output .= "Incorrect parameters\n";
24 $host = trim(`hostname`
);
25 $output = "Connecting to $ip:$port, target $url, this hostname $host\n";
28 $sock = @fsockopen
($ip, $port, $errno, $errstr, 5);
30 $output .= "Connected\n";
32 $request = "GET $url HTTP/1.0\r\n";
33 # $request .= "Proxy-Connection: Keep-Alive\r\n";
34 # $request .= "Pragma: no-cache\r\n";
35 # $request .= "Host: ".$url."\r\n";
36 # $request .= "User-Agent: MediaWiki open proxy check\r\n";
38 @fputs
($sock, $request);
39 $response = fgets($sock, 65536);
43 $output .= "No connection\n";
47 $output = escapeshellarg( $output );
49 #`echo $output >> /home/tstarling/open/proxy.log`;