Commits

Anonymous committed 87a76b1

DDOS PING FLOODING scenario can work in ComplexNet

  • Participants
  • Parent commits c3cc4c2

Comments (0)

Files changed (7)

core/configure/Network.py

         traffic for any combination of self.norm_desc['src_nodes']
         and self.norm_desc['dst_Nodes']
         """
-        dst_node_list = [self.node_list[i] for i in self.norm_desc['dst_nodes']]
         for i in self.norm_desc['src_nodes']:
+            dst_node_list = [self.node_list[j] for j in self.norm_desc['dst_nodes'] if j != i] # don't send traffic to itself
             self.node_list[i].init_traffic(self.norm_desc, dst_node_list)
 
     def _topo(self, topo):

core/ns3/Node/ImalseNetnsSimNode.py

     ##    File System              #####
     ####################################
     def ping(self, sock, data, threaded):
-        print 'ImalseNetnsSimNode.ping: this is just a stub, please finish it'
+        """The attributes you can customize
 
+        **StartTime**
+        **StopTime**
+        **Remote**: The address of the machine we want to ping.
+        **Verbose**: Produce usual output.
+        **Interval**: Wait interval seconds between sending each packet.
+        **Size**: The number of data bytes to be sent, real packet will
+                be 8 (ICMP) + 20 (IP) bytes longer.
+        """
+        # print 'ImalseNetnsSimNode.ping: this is just a stub, please finish it'
+        print 'data, ', data
+        print 'here, '
+        remote = data.get('remote')[0]
+        remote_addr = ns3.Ipv4Address(remote)
+
+        helper = ns3.V4PingHelper(remote_addr)
+
+        start_time = data.get('start_time')[0]
+        stop_time = data.get('stop_time')[0]
+        helper.SetAttribute("StartTime", ns3.TimeValue(ns3.Time(str(start_time)+'s')))
+        helper.SetAttribute("StopTime", ns3.TimeValue(ns3.Time(str(stop_time)+'s')))
+
+       # helper.SetAttribute("Remote", ns3.AddressValue(remote_inet))
+
+        # interval = data.get('Interval')
+        # helper.SetAttribute("Interval", ns3.TimeValue(str(interval) + 's'))
+        helper.Install(self)

experiments/ComplexNetExperiment.py

                 routing_helper_list = self.routing_helper_list,
                 )
 
+        ns3.LogComponentEnable("V4Ping", ns3.LOG_LEVEL_INFO)
         if self.options.back_traf:
             # Generate dot file that describe the background traffic.
             dot_file = self.gen_back_traf_dot(net_settings)

experiments/ManualTopoBTExperiment.py

         dot_file = self.gen_back_traf_dot(net_settings)
 
         ns3.LogComponentEnable("OnOffApplication", ns3.LOG_LEVEL_INFO)
+        ns3.LogComponentEnable("V4PingApplication", ns3.LOG_LEVEL_INFO)
         self.load_exper_settings(net_settings)
 
         self.net = ManualTopologyNet(

scenario/ddos_ping_flooding/BotMaster.py

         }
 
 class BotMaster(core.BotMaster.BotMasterOneCMD):
+    cmd_attr = ['event=forward_to_bots',
+            'bot_event=send_ping',
+            'remote=10.200.1.1',
+            'start_time=100',
+            'stop_time=500',
+            'r_port=12345',
+            ]
     def __init__(self, desc=botmaster_desc):
         core.BotMaster.BotMasterOneCMD.__init__(self,
             desc = desc,
             master_password = '1234',
             interval = 2,
-            num = 11,
-            cmd_str = 'event=forward_to_bots;bot_event=send_ping;hostname=127.0.0.1')
+            # num = 11,
+            num = 1,
+            cmd_str = ';'.join(self.cmd_attr))
+            # cmd_str = 'event=forward_to_bots;bot_event=send_ping;hostname=127.0.0.1')
+            # cmd_str = 'event=forward_to_bots;bot_event=send_ping;hostname=127.0.0.1')
             # 'event=forward_to_bots;bot_event=send_ping;hostname=10.0.0.0')
             # 'event=forward_to_bots;bot_event=send_ping;hostname=www.google.com;')
 

scenario/ddos_ping_flooding/ClientCMD.py

 
     def send_ping(self, sock, data):
         print 'send_ping in ClientCMD'
-        self.node.ping(sock,data, threaded=True)
+        self.node.ping(sock, data, threaded=True)
 
     def stop_ping(self, sock):
         self.node.stop_app(sock, 'ping')
 # ./sim -e ComplexNetExperiment --net_settings=net_config/aro_demo/nf_net_settings.py -s file_exfiltration -t 100 --back_traf=net_config/aro_demo/back_traf.py
 # ./sim -e ComplexNetExperiment --net_settings=net_config/aro_demo/nf_net_settings.py -s file_exfiltration -t 100
 # ./sim -e ComplexNetExperiment --net_settings=net_config/aro_demo/nf_net_settings.py -s ddos_ping_flooding -t 100
-./sim -e ComplexNetExperiment --net_settings=net_config/aro_demo/nf_net_settings.py -s ddos_ping_flooding -t 200
+# ./sim -e ComplexNetExperiment --net_settings=net_config/aro_demo/nf_net_settings.py -s ddos_ping_flooding -t 1000 --Simulator=Visual
+./sim -e ComplexNetExperiment --net_settings=net_config/aro_demo/nf_net_settings.py -s ddos_ping_flooding -t 1000 --Simulator=Visual --back_traf=net_config/aro_demo/back_traf.py
 # ./sim -e ComplexNetExperiment --net_settings=net_config/aro_demo/nf_net_settings.py -s file_exfiltration -t 100