Commits

Joshua Bonsink committed 64064a8

updated gui, return of settings and hgignore

  • Participants
  • Parent commits f978973

Comments (0)

Files changed (3)

+# use glob syntax
+syntax: glob
+**.pyc
+**_undo
+**.pcap
+**.dot
+build
+
+syntax: regexp
+^\.UNDO/*.*
+^res/*.*
 import fileinput
 import sys
 import signal
+import os
 
 from PyQt4 import QtGui, QtCore
 
         
         button = QtGui.QPushButton('Start', self)
         button.clicked.connect(lambda: self.startScenario(SPAMMING, CRAWL_CMD))                     
-        grid_groupbox_keylogger.addWidget(button, 6, 0, 1, 2)
+        grid_groupbox_spamming.addWidget(button, 6, 0, 1, 2)
         
         # --- Common settings --- #
         tab_common_layout = QtGui.QVBoxLayout(tab_common)     
         self.groupbox_manual_topo.hide()
         self.groupbox_topo.hide()
         self.groupbox_static_route.hide()  
+    
+    def startEmulation(self, scenario):       
+		cmd = 'sudo ./emulate.py -s ' + scenario + ' -r server'   
+		os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
+		for _ in range(self.emulation_clients.value()):        
+			cmd = 'sudo ./emulate.py -s ' + scenario + ' -r client'    
+			os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
+		cmd = 'sudo ./emulate.py -s ' + scenario + ' -r botmaster'    
+		os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
         
     def startScenario(self, settings_type, attack):        
         open_f = choseCorrectFile(settings_type)
             old_value = searchAndGet(settings_type, BOTMASTER, "self.command")           
             searchAndReplace(settings_type, BOTMASTER, "self.command", old_value, attack+'()')
             scenario = SCENARIOS[settings_type]
-            startEmulation(scenario)
+            self.startEmulation(scenario)
             
         #elif mode == NETNS3:
         #elif mode == PURE_SIM:
        
-def startEmulation(scenario):       
-    cmd = 'sudo ./emulate.py -s ' + scenario + ' -r server'   
-    os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
-    for _ in range(self.emulation_clients):        
-        cmd = 'sudo ./emulate.py -s ' + scenario + ' -r client'    
-        os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
-    cmd = 'sudo ./emulate.py -s ' + scenario + ' -r botmaster'    
-    os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
+	
             
 def main():
     
+# ROOT should be the absolute path of the Imalse installation directory
+# ROOT = '/home/wangjing/Dropbox/GSOC/code/imalse'
+# ROOT = '/Users/wangjing/Dropbox/GSOC/code/imalse'
+ROOT = '/home/josh/Documents/Repositories/imalse'
+# ROOT = '/home/wangjing/Apps/imalse'
+
+import sys
+sys.path.insert(0, ROOT)
+
+# NS3_PATH should be the absolute path of the NS3 installation.
+# NS3_PATH = '/home/wangjing/Apps/ns-allinone-3.14.1/ns-3.14.1'
+NS3_PATH = '/home/josh/Documents/Repositories/imalse/tools/ns-allinone-3.14.1/ns-3.14.1'
+# NS3_PATH =  ROOT + '/tools/ns-allinone-3.14.1/ns-3.14.1'
+# NS3_PATH = '/Users/wangjing/Apps/ns-allinone-3.14.1/ns-3.14.1'
+
+# If EXPORT_ABNORMAL_FLOW = True, abnormal flows will be exported by simulator
+EXPORT_ABNORMAL_FLOW = True
+
+# name of the file to store parameters.
+EXPORT_ABNORMAL_FLOW_PARA_FILE = ROOT + '/share/ano_flow_para.txt'