Source

imalse / test_emulation.py

Full commit
import os
import time

from util.util import get_availabe_scenarios
import settings

scenario_option =  get_availabe_scenarios()
skip_scenario = ['infecting', 'spamming']

fid = open ('test.out', 'w')

for scenario in scenario_option:
    if scenario in skip_scenario:
        print >>fid, 'skipping scenario: [%s]' % (scenario)
        continue
    print >>fid, '-' * 100
    print >>fid, 'testing scenario: [%s]' % (scenario)
    print >>fid, '-' * 100
    cmd = "sudo " + settings.ROOT + '/emulate.py -s ' + scenario + ' -r server'   
    os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
    cmd = "sudo " + settings.ROOT + '/emulate.py -s ' + scenario + ' -r client'    
    os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
    cmd = "sudo " + settings.ROOT + '/emulate.py -s ' + scenario + ' -r botmaster'    
    os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
    time.sleep(30)
    
fid.close()