Joshua Bonsink avatar Joshua Bonsink committed 1383672

minor improvements

Comments (0)

Files changed (9)

core/nodes/botmaster.py

         """
         BotMaster.__init__(self, desc)
                 
+        print "Sending verification command to server"
         self.verification_command = VerificationCmd(desc.master_password)
 
     def recv_ack(self):
         the server will send out commands periodically.
         
         """
+        print "Received ack from server"
         self.logger.debug('Botmaster one command recv_ack has been recorded')
         self.node.send(self.sock, jsonpickle.encode(self.verification_command))
 
                 break
             idx -= 1
             
+            print "Sending command to client"
             self.node.send(self.sock, jsonpickle.encode(self.desc.command) )
             self.node.sleep(self.desc.interval)
 
 
 if __name__ == "__main__":
     sys.path.insert(0, "..")    
-    doctest.testmod()
+    doctest.testmod()

experiments/manual_topo_bt_exp.py

                 )
 
         # call the SADIT/Configure module to generate the dot file specifying the background
-        # traffic pattern.        
-        dot_file = settings.ROOT + '/' + self.options.dot_file
+        # traffic pattern.    
+        if settings.ROOT not in self.options.dot_file:    
+            dot_file = settings.ROOT + '/' + self.options.dot_file
+        else:
+            dot_filt = self.options.dot_File
         print(dot_file)    
         
         gen_dot(
     def setup(self):
         """"""
         # net_settings = self.load_net_settings()
+        
+        if settings.ROOT not in self.options.net_settings:
+            net_settings_file = settings.ROOT + '/' + self.options.net_settings
+        else:
+            net_settings_file = self.options.net_settings
+        
         net_settings = self.load_para(
-                f_name = settings.ROOT + '/' + self.options.net_settings,
+                f_name = net_settings_file,
                 )
         self.load_exper_settings(net_settings)
 

experiments/manual_topo_exp.py

     def load_net_settings(self):
         """"""
         s = {}
-        execfile(settings.ROOT + '/' + self.options.net_settings, s)
+        if settings.ROOT not in self.options.net_settings:
+            execfile(settings.ROOT + '/' + self.options.net_settings, s)
+        else:
+            execfile(self.options.net_settings, s)
         return Namespace(s)
 
     def load_exper_settings(self, ns):
         # botnet related configuration
         self.server_id_set = ns.server_id_set
         self.botmaster_id_set = ns.botmaster_id_set
-        self.client_id_set = ns.client_id_set       
-        self.target_id = ns.target_id
+        self.client_id_set = ns.client_id_set   
+        
+        try:    
+            self.target_id = ns.target_id
+        except Exception:
+            self.target_id = self.server_id_set
         
         if len(ns.server_addr) == 0:
             self.SERVER_ADDR = ''
         """"""        
         net_settings = self.load_net_settings()        
         self.load_exper_settings(net_settings)
-
+        
+        if settings.ROOT not in self.options.topology_file:
+            topo_file = settings.ROOT + '/' + self.options.topology_file
+        else:
+            topo_file = self.options.net_settings
+            
         self.net = ManualTopologyNet(
                 # os.path.abspath(self.options.topology_file),
-                settings.ROOT + '/' + self.options.topology_file,
+                topo_file,
                 self.options.topology_type,
                 self.NodeCreator,
                 net_settings,
         self.install_cmds(srv_addr = self.SERVER_ADDR)
         self.print_srv_addr()
         self.set_server_info()
-        self.start_nodes()
+        self.start_nodes()

gui/imalse_config/net_settings.py

 pcap_links = [  ]
 botmaster_id_set = [ 5 ]
 client_id_set = [ 2, 3, 4 ]
-server_id_set = [  ]
+server_id_set = [ 1 ]
 server_addr = [  ]
 # automatically and run the simulation in the visualization mode. 
 # It is basicially a shortcut. If you want to run with other parameters, 
 # you can modify the command correspondingly.
-./sim -e ManualTopoExperiment --mode sim -s file_exfiltration -f \
+./sim -e manual_topo_exp --mode sim -s file_exfiltration -f \
     gui/imalse_config/topology.inet \
     --net_settings=gui/imalse_config/net_settings.py \
     -t 100 --SimulatorImpl=Visual

scenario/ddos_flooding/client_cmd.py

 
     def ping_flood(self, sock, data):
         """Start ping flood."""        
+        print "Start ping flood"
         self.node.ping(sock, data, threaded=True)
 
     def get_request_flood(self, sock, data):
         """Start http get request flood."""
+        print "Start HTTP Get request flood"
         self.start_http_get_flood(data.hostname, data.port, data.num_requests, data.num_threads)
     
     def syn_flood(self, sock, data):
         """Start TCP syn flood."""
+        print "Start TCP syn flood."
         self.start_syn_flood(data.hostname, data.port, data.num_packets, data.num_threads)
         
     def recv_ack(self):
                 source_ip = self.generate_random_ip()
                 packet = self.node.construct_packet(source_ip, dest_ip)
                 self.node.sendto(sock, packet, dest_ip , port)
+            print("\nDone %i requests on %s" % (num_packets, dest_ip))
             return
         
         self.connected = False

scenario/ddos_flooding/config.py

     self.master_password = '1234'
     self.interval = 2 
     self.num_commands = 1
-    self.command =PingFloodCmd()
-There are three types of flooding attacks:
+
+	There are three types of flooding attacks:
     Ping flooding - PingFloodCmd
     Http get request flooding - HttpGetFloodCmd
     Tcp syn flooding - TcpSynFloodCmd
     def __init__(self):
         """Initialize the botmaster description."""
         BotmasterDescription.__init__(self)
-        self.command = HttpGetFloodCmd()
-
+        self.command =PingFloodCmd()
+        
 class Client(ClientDescription):
     
     """

scenario/file_exfiltration/client_cmd.py

 
     def upload_file(self, u_file):
         """Upload a file to the ftp server"""
-        self.node.ftp_upload(u_file, self.ftp_info.host, self.ftp_info.user,\
+        self.node.ftp_upload(u_file, self.ftp_info.hostname, self.ftp_info.user,\
                              self.ftp_info.password)
 
 if __name__ == "__main__":

scenario/file_exfiltration/config.py

     self.master_password = '1234'
     self.interval = 2 
     self.num_commands = 1
-    self.command = None
-    
+    self.command =FtpCmd()
+ 
     """
     
     def __init__(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.