Commits

Joshua Bonsink  committed 8b5e8da

updated gui work

  • Participants
  • Parent commits 1383672

Comments (0)

Files changed (4)

File core/ns3/experiment/imalse_pure_sim_experiment.py

     
     def initparser(self, parser):
         """Initialize the parser of the parent and extend it with more options."""
-        super(ImalsePureSimExperiment, self).initparser(parser)
         
+        super(ImalsePureSimExperiment, self).initparser(parser)        
         parser.set_defaults(SimulatorImplementationType='Default')
         parser.add_option("", "--SimulatorImpl", dest = "SimulatorImplementationType",
                 help="the simulator implementation Type, available options are['Realtime', 'Default', 'Visual']")
 
     def setup(self):
         """Setup."""
-        super(ImalsePureSimExperiment, self).setup()
+        super(ImalsePureSimExperiment, self).setup()        
         ns.core.GlobalValue.Bind("SimulatorImplementationType",
                 ns.core.StringValue("ns3::%sSimulatorImpl"%(self.options.SimulatorImplementationType)))
 
         tab_topology_layout.addWidget(container)
         
         container.show()
-        process = QtCore.QProcess(container)
-        executable = QtCore.QString("./loadguiconfig.sh")
-        arguments = QtCore.QStringList()
-        arguments.append(QtCore.QString("-into"))
-        arguments.append(QtCore.QString.number(container.winId()))
-        process.start(executable, arguments)
+        #process = QtCore.QProcess(container)
+        #executable = QtCore.QString("wish ./gui/core.tcl")
+        #executable = QtCore.QString("xterm")
+        #arguments = QtCore.QStringList()  
+        #arguments.append(QtCore.QString("-into"))      
+        #arguments.append(QtCore.QString("-use"))      
+        #arguments.append(QtCore.QString.number(container.winId()))
+        print container.winId()
+        #process.start(executable, arguments)               
         
         
         # --- DDOS Flooding scenario --- #
         self.static_duration.setMinimum(0)
         self.static_duration.setMaximum(3600)
         self.static_duration.setSingleStep(1)
-        grid_groupbox_static_route.addWidget(self.topo_duration, 0, 2, 1, 2)
+        grid_groupbox_static_route.addWidget(self.static_duration, 0, 2, 1, 2)
 
         self.groupbox_complex_network.hide()
         self.groupbox_manual_topo_bt.hide()
         cmd = 'sudo python ./emulate.py -s ' + scenario + ' -r botmaster'    
         os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
     
-    def startSim(self, mode, scenario, experiment, duration, topo_file = None, net_settings = None, dot_file = None, bt_file = None, ):
+    def startSim(self, mode, scenario, experiment, duration, topo_file = None, net_settings = None, dot_file = None, bt_file = None):
         cmd = 'sudo ./sim --mode ' + mode + ' -s ' + scenario + ' -e ' + experiment + ' -t ' + str(duration)
         
         if topo_file != None:
             
         if bt_file != None:
             cmd += ' --back_traf ' + bt_file
-                
+        
+        cmd+= " --SimulatorImpl=Visual"
+        
+        print cmd
         os.system("gnome-terminal -e 'bash -c \"" + str(cmd) + "; exec bash\"'")
           
     def startScenario(self, settings_type, attack):        
         open_f = choseCorrectFile(settings_type)
         
         scenario = SCENARIOS[settings_type]
-        mode = self.mode.itemText( self.mode.currentIndex() )
+        mode = self.mode.itemText( self.mode.currentIndex() )      
+        old_value = searchAndGet(settings_type, BOTMASTER, "self.command")  
         
-        
-        old_value = searchAndGet(settings_type, BOTMASTER, "self.command")  
         if attack not in old_value:
             searchAndReplace(settings_type, BOTMASTER, "self.command", old_value, attack+'()')            
         
                     self.complex_topo_file_location.text(), self.complex_net_settings_location.text(), 
                     self.complex_dot_file_location.text(), self.complex_backtraf_location.text())
             elif experiment == "Manual Topology Background Traffic Experiment":
-                self.startSim('netns3', cenario, MANUAL_TOPO_BT, self.manual_bt_duration.value(), 
+                self.startSim('netns3', scenario, MANUAL_TOPO_BT, self.manual_bt_duration.value(), 
                     self.manual_bt_topo_file_location.text(), self.manual_bt_net_settings_location.text(), 
                     self.manual_bt_dot_file_location.text(), self.manual_bt_back_traf_location.text())                
             elif experiment == "Manual Topology Experiment":
                     self.manual_topo_file_location.text(), self.manual_net_settings_location.text())                    
             
         elif mode == PURE_SIM:               
-            experiment = self.netns3_exp.itemText( self.netns3_exp.currentIndex() )
+            experiment = self.pure_exp.itemText( self.pure_exp.currentIndex() )
+            print experiment
             if experiment == "Complex Network Experiment":
                 self.startSim('sim', scenario, COMPLEX, self.complex_duration.value(), 
                     self.complex_topo_file_location.text(), self.complex_net_settings_location.text(), 
                     self.complex_dot_file_location.text(), self.complex_backtraf_location.text())
             elif experiment == "Manual Topology Background Traffic Experiment":
-                self.startSim('sim', cenario, MANUAL_TOPO_BT, self.manual_bt_duration.value(), 
+                self.startSim('sim', scenario, MANUAL_TOPO_BT, self.manual_bt_duration.value(), 
                     self.manual_bt_topo_file_location.text(), self.manual_bt_net_settings_location.text(), 
                     self.manual_bt_dot_file_location.text(), self.manual_bt_back_traf_location.text())                
             elif experiment == "Manual Topology Experiment":
                 self.startSim('sim', scenario, STATIC_ROUTE, self.static_duration.value())  
             elif experiment == "Topology Experiment":
                 self.startSim('sim', scenario, TOPOLOGY, self.topo_duration.value(), 
-                    self.topo_file_location.text())
-                self.startPureSim(scenario, COMPLEX)
+                    self.topo_file_location.text())                
                         
 def main():
     

File gui/prefs.conf

 # CORE 4.3 GUI preference file
-set g_mrulist "./sample.imn /home/wangjing/Dropbox/Research/CyberSecurity/ARO_demo/ARO.imn ./sample.imm /Users/wangjing/Dropbox/GSOC/code/imalse/gui/sample.imm"
+set g_mrulist "./sample.imn ./configs/sample3-bgp.imn /home/wangjing/Dropbox/Research/CyberSecurity/ARO_demo/ARO.imn ./sample.imm"
 array set g_prefs {
 	default_conf_path	"./configs"
 	enable_rj45		"1"
 #!/usr/bin/env sh
-export LIBDIR=.
-wish core.tcl ./sample.imn
-# wish core.tcl
+export LIBDIR=./gui
+#wish core.tcl ./sample.imn
+wish gui/core.tcl
 # wish core.tcl ./configs/sample3-bgp.imn