Commits

Joshua Bonsink committed c2ae28b

Minor changes in a couple of files. And first push of GUI.

Comments (0)

Files changed (15)

core/cmd/command.py

         
 class NewAddressCmd(object):
     
-    """"""
+    """
+    
+    This command is used to inform the botmaster of a new bot connected to the
+    network. The address of the bot is send to the botmaster.
+    
+    """
     
     def __init__(self):
         """"""
 
 class MsgFromClientToBotCmd(object):
     
-    """"""
+    """
+    
+    This command is used to send a message from the client (bot) to the 
+    botmaster. The method 'send_to_botmaster' is triggered in the server.
+    
+    """
     
     def __init__(self):
         """"""

core/cmd/description.py

     def __init__(self):
         """Initialize the default settings.""" 
         self.server_address = '127.0.0.1'
-        self.server_port = 3333
-        self.request_timeout = 10
-
+        self.server_port = 99
+3
+        
 class ServerDescription(Description):        
         
     """
         self.initial = 'waiting'
         self.start_action = 'initialize'
         self.master_password = '1234'
+        self.request_timeout = 10
          
 class BotmasterDescription(Description):
     
         self.interval = 2 
         self.num_commands = 1
         self.command = None   
+        self.request_timeout = 10
 
 class ClientDescription(Description):
     
     def __init__(self):
         """Initialize the default settings."""
         Description.__init__(self)
-        self.initial = 'disconn'
-        self.start_action = 'request_connect'
+	self.initial = 'disconned'
+        self.start_action = 'request_connect'
+        self.request_timeout = 16
+

core/ns3/experiment/experiment.py

 """
-this file describe the netns3 experiment for imalse
+
+This file contains code that describes the netns3 experiment for imalse
+
 """
+
 import ns3
 from util.util import abstract_method, get_availabe_scenarios, load_scenario
 
-# for test, just select the first node as server, the second node as BotMaster, all other nodes
-# are clients
 class ImalseExperiment(object):
-    """ Base class for all ImalseExperiment
+    """ 
+    
+    This is the base class for all imalse experiments.
+    For testing purposes, just select the first node as server, the second
+    node as BotMaster, all other nodes are clients.
+    
     """
     server_id_set = [0]
     botmaster_id_set = [1]
 
     @property
     def id_set(self):
+        """Return the id's of all the nodes present in the network."""
         return self.server_id_set + self.botmaster_id_set + self.client_id_set
 
     def initparser(self, parser):
+        """Default argument parser."""
         scenario_ops = get_availabe_scenarios()
         parser.add_option('-s', '--scenario', dest="scenario",
                 default='ddos_ping_flooding',
                 help='specify the scenario you want to execute. Scenarios available are: %s'%(scenario_ops),
                 )
 
-    def _init(self): pass
-    def setup(self): pass
+    def _init(self):
+        """This methods should be implemented by the child class.""" 
+        pass
+    def setup(self):
+        """This methods should be implemented by the child class.""" 
+        pass
 
     def get_node(self, i):
-        """get ith nodes"""
+        """Get ith node."""
         abstract_method()
 
     @property
     def node_num(self):
+        """Get the amount of nodes. Should be implemented by a child class."""
         abstract_method()
 
     def node_run(self, node, *args, **kwargs):
-        """run a command on a specific node"""
+        """Run a command on a specific node."""
         node.cmd_set.trigger(*args, **kwargs)
 
     def start_nodes(self):
-        """specify when each node should start"""
-        # start servers
+        """
+        
+        Specify when the nodes should start. The server should always start
+        first followed by the clients which can connect with the server. When
+        the clients have established a connection the botmaster van be started.
+        
+        """
+        
         for i in self.server_id_set:
             print 'node [%i] type [%s] start at [%f]s'%(i, 'server', 0)
             self.event(0, self.node_run, self.get_node(i), 'start')
 
-        # start clients
         t = 0
         for i in self.client_id_set:
             t += 2
             print 'node [%i] type [%s] start at [%f]s'%(i, 'client', t)
             self.event(t, self.node_run, self.get_node(i), 'start')
-
-        # start BotMaster
+        
         for i in self.botmaster_id_set:
             print 'node [%i] type [%s] start at [%f]s'%(i, 'BotMaster', t+2)
             self.event(t+2, self.node_run, self.get_node(i), 'start')
 
     def install_cmds(self, srv_addr=None):
-        """install different command set to nodes according to their type
-        can manually set the server address
+        """
+        
+        Install the three different command sets on the nodes according to 
+        their type. It is possible to manually set the server address.
+        
+        Depending on the scenario. The target hostname should equal the server 
+        node or an unused node, due to the fact that all internet traffic is 
+        contained in the simulated network.
+        
         """
         scen = load_scenario(self.options.scenario)
         BOTMASTER_DESC = scen.config.Botmaster()
         SERVER_DESC = scen.config.Server()
         CLIENT_DESC = scen.config.Client()
-        
-        #When in netns3 mode set a node in the network as the target of the attack        
+                
         try:
             if self.target_id is not None:
                 if self.get_node(self.target_id).NODE_TYPE == 'sim_ns3':
             cmd.install(self.get_node(i))
 
     def get_server_addr(self):
-        """The all the server address"""
+        """Get all the server addresses."""
         addr_set = []
         for i in self.server_id_set:
             ipv4Addr = self.get_node(i).GetObject(ns3.TypeId.LookupByName("ns3::Ipv4")).GetAddress(1, 0)
         return addr_set
 
     def get_server_nodes(self):
+        """Get all the server nodes."""
         return [self.get_node(i) for i in self.server_id_set]
 
     def set_server_info(self):
-        """Only Set Server information for simulated nodes"""
+        """Only set server information for simulated nodes"""
         server_addr_set = self.get_server_addr()
         server_set = self.get_server_nodes()
-        for i in xrange(self.node_num):
-            # if i in self.server_id_set or self.get_node(i).NODE_TYPE.startswith('real'):
-                # continue
+        for i in xrange(self.node_num):            
             if self.get_node(i).NODE_TYPE.startswith('real'):
                 continue
             self.get_node(i).server_addr_set = server_addr_set
             self.get_node(i).server_set = server_set
 
     def print_srv_addr(self):
-        """print out the address of the server"""
+        """Print the address of the server."""
         for i in self.server_id_set:
             ipv4Addr = self.get_node(i).GetObject(ns3.TypeId.LookupByName("ns3::Ipv4")).GetAddress(1, 0)
             print 'The server addr of server [%i ]: '%(i), ipv4Addr

core/ns3/experiment/imalse_netns_experiment.py

+"""
+
+This file contains the imalse netns3 experiment. It inherits from the 
+standard ImalseExperiment and NetnsExperiment from the ns3 framework.
+
+"""
+
 from core.ns3.util.netns3 import NetnsExperiment
 from core.ns3.node import ImalseNetnsNode
 from core.ns3.experiment import ImalseExperiment
 
 NODE_NUM = 0
 class ImalseNetnsExperiment(ImalseExperiment, NetnsExperiment):
-    """Base Class for Imalse Experiment in netns3 mode
-    """
+    
+    """Base Class for imalse experiments in netns3 mode."""
+    
     def __init__(self, *args, **kwargs):
-        # super(ImalseNetnsExperiment, self).__init__(*args, **kwargs)
+        """Initialize the parents first."""
         NetnsExperiment.__init__(self, *args, **kwargs)
         ImalseExperiment.__init__(self)
         self._init()
 
     def initparser(self, parser):
+        """Initialize the parsers in both parents."""
         ImalseExperiment.initparser(self, parser)
         NetnsExperiment.initparser(self, parser)
 
     def get_node(self, i):
-        """get ith nodes"""
+        """Get the ith node"""
         return self.nodes[i]
 
     @property
     def node_num(self):
+        """Return the number of nodes."""
         return len(self.nodes)
 
     @staticmethod
     def NodeCreator():
+        """Create a node."""
         global NODE_NUM
         NODE_NUM += 1
         name = "n%s" %NODE_NUM

core/ns3/experiment/imalse_pure_sim_experiment.py

 """
-In Pure Sim experiments, all nodes are simulated. So we don't need
-the real-time schedular.
+
+This file contains the imalse pure sim experiment. It inherits from the 
+standard ImalseExperiment. In pure sim experiments all nodes are simulated. 
+So we don't need the real-time scheduler.
+
 """
 import optparse
 
 from core.ns3.experiment import ImalseExperiment
 
 class ImalsePureSimExperiment(ImalseExperiment):
-    """Pure Sim Experiemtn Doesn't depend on netns3 can run in simulated time"""
+    
+    """
+    
+    Pure sim experiments don't depend on netns3 and can be run in simulated time.
+    
+    """
+    
     def initparser(self, parser):
+        """Initialize the parser of the parent and extend it with more options."""
         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']")
                           parser.defaults["simtime"])
 
     def setup(self):
+        """Setup."""
         super(ImalsePureSimExperiment, self).setup()
         ns.core.GlobalValue.Bind("SimulatorImplementationType",
                 ns.core.StringValue("ns3::%sSimulatorImpl"%(self.options.SimulatorImplementationType)))
 
     def run(self):
+        """Run the simulation."""
         self.setup()
         print "running simulator for %s sec" % self.options.simtime
-        ns.core.Simulator.Stop(ns.core.Seconds(self.options.simtime))
-        # ns.core.Simulator.Run(signal_check_frequency = -1)
+        
+        ns.core.Simulator.Stop(ns.core.Seconds(self.options.simtime))        
         ns.core.Simulator.Run()
         self.cleanup()
         ns.core.Simulator.Destroy()
+        
         print "simulator done"
 
     @staticmethod
     def event(time, func, *args, **kwds):
-        """schedule an event to simulator"""
+        """Schedule an event to the simulator."""
         def run():
             func(*args, **kwds)
         ns.core.Simulator.Schedule(ns.core.Time(str(time)), run)
 
     @staticmethod
     def NodeCreator():
+        """Create a node."""
         return ImalseNetnsSimNode()
 
     def main(self, args, run = True):
+        """Initialize and start the simulator."""
         usage = "%prog [-h] " + self.usagestr() + " ..."
         parser = optparse.OptionParser(usage = usage)
         self.initparser(parser)
             self.run()
 
     def usagestr(self):
+        """Print usage help string."""
         return "[-n <numnodes>] [-t <simtime>]"
 
     def print_help(self):
+        """Print help."""
         parser = optparse.OptionParser(usage = '')
         self.initparser(parser)
         parser.print_help()
 
     def cleanup(self):
+        """Destroy the simulator and stop all the nodes."""
         ns.core.Simulator.Destroy()
         for i in xrange(self.node_num):
             n = self.get_node(i)

core/ns3/node/imalse_netns_node.py

+"""
+
+This file contains code that describes a netns node.
+
+"""
 import random
 import string
 import sys
 from core.ns3.util.netns3 import NetnsNode
 
 class ImalseNetnsNode(NetnsNode, PhysicalNode):
-    """Imalse Netns Node, it will use linux namespace to construct virtual machine.
-    And applications will run in these virtual machines.
+    
     """
+    
+    An imalse netns node will use a linux namespace to construct a virtual machine.
+    Applications will run in these virtual machines.
+    
+    """
+    
     NODE_TYPE = 'real_ns3'
+    
     def __init__(self, *args, **kwargs):
+        """Initialize."""
         self.cmd_set = None
         NetnsNode.__init__(self, *args, **kwargs)
         PhysicalNode.__init__(self)
 
-    def ping(self, sock, data, threaded):        
+    def ping(self, sock, data, threaded):
+        """Ping using linux terminal command."""        
         cmd = ["ping", "-b", "-c", str(data.num_packets), "-i", str(data.interval),\
                "-l", str(data.preload), "-s", str(data.packet_size),\
                 data.hostname]
-        print "%s: %s" % (self.name, " ".join(cmd))
+        print "%s: %s" % (self.NAME, " ".join(cmd))
         
         p, stdin, stdout, stderr = self.popen(cmd)
         err = stderr.read()
         sys.stdout.write(out)
 
     def stop_ping(self, sock):
+        """Stop ping."""
         print 'stop_ping'
 
     def start_keylogger(self, duration):
+        """Start the keylogger."""
         now = time.time()
         done = lambda: time.time() > now + duration
         

core/ns3/node/imalse_netns_sim_node.py

+"""
+
+This file contains code that describes the pure simulated node.
+
+"""
 import mimetypes
 import random
 import string
-import time
+import sys
 
 import jsonpickle
+import ns3
 
 from core.nodes.base_node import BaseNode
-import ns3
 
-nodenum = 0
-
-#############################################
-# NS3 python binding missing some important
-# APIs, MSG_MAP and MSG_RE_MAP are used
-# to hack the API. Need to be fixed later
-#############################################
-## Been Fixed at[2012-08-08 23:20:52], MSG_MAP and MSG_RE_MAP now becomes useless.
-
-MSG_MAP = {
-        'connect_ack': 21,
-        '{"password": ["1234"], "event": ["verify_master"]}':122,
-        '{"msg": ["verifed, hi master, what you want to do?"], "event": ["echo"]}':123,
-        '{"hostname": ["127.0.0.1"], "event": ["forward_to_bots"], "bot_event": ["send_ping"]}':124,
-        '{"event": ["file_exfiltration"]}':125,
-        '{"host": "thales.bu.edu", "password": "imalse", "user": "imalse-ftp", "event": "set_ftp_info"}':126,
-        '{"directory": ".", "pattern": "assword", "suffix": [".txt"], "event": "set_file_filter"}':127,
-        '{"event": "search_and_upload"}':128,
-        '{"hostname": ["127.0.0.1"], "event": ["send_ping"]}':129,
-        }
-MSG_RE_MAP = dict( [ (v,k) for k,v in MSG_MAP.iteritems() ] )
-
-def call_method(method, *args, **kwargs):
-    method(*args, **kwargs)
+NODE_NUM = 0
 
 class SocketDict(dict):
+    
+    """Dictionary containing sockets."""
+    
     def __init__(self):
+        """Initialize dict."""
         self.sockets = dict()
         super(SocketDict, self).__init__()
 
     def hash(self, sock):
+        """Return a hash containing socket information."""
         node = sock.GetNode()
         typeId = sock.GetTypeId()
         _from = ns3.Address()
         return hash((node.GetId(), typeId.GetName(), str(_from), str(sock)))
 
     def __getitem__(self, sock):
+        """Get item from the dict."""
         return super(SocketDict, self).__getitem__(self.hash(sock))
 
     def __setitem__(self, sock, value):
+        """Set the value of an item in the dict."""
         super(SocketDict, self).__setitem__(self.hash(sock), value)
         self.sockets[self.hash(sock)] = sock
 
-    def iteritems(self): #FIXME this is not iterator actually
+    def iteritems(self): 
+        """FIXME this is not an iterator."""
         return zip([self.sockets[k] for k in self.keys()] , self.values())
 
     def items(self):
+        """Return all the items in the dict."""
         return zip([self.sockets[k] for k in self.keys()] , self.values())
 
 
 class ImalseNetnsSimNode(ns3.Node, BaseNode):
-    """Simulated Node in NS3 Adapted for Imalse Simulation"""
-    proto_map = {
+    
+    """Simulated node in NS3 Adapted for imalse simulation."""
+    
+    PROTO_MAP = {
             'udp':ns3.UdpSocketFactory.GetTypeId(),
             'tcp':ns3.TcpSocketFactory.GetTypeId(),
             }
     NODE_TYPE = 'sim_ns3'
-    name = 'ImalseNetnsSimNode'
+    NAME = 'ImalseNetnsSimNode'
+    
     def __init__(self, name=None, *args, **kwargs):
+        """Initialize."""
         BaseNode.__init__(self)
         if name is None:
-            global nodenum
-            self.name = "sim_n%s" %(nodenum)
-            nodenum += 1
+            global NODE_NUM
+            self.NAME = "sim_n%s" %(NODE_NUM)
+            NODE_NUM += 1
         else:
-            self.name = name
+            self.NAME = name
 
         ns3.Node.__init__(self)
         self.sockets = SocketDict()
 
     @property
     def client_socks(self):
+        """Return all the client_socks."""
         return [sock for sock, v in self.sockets.iteritems() if v['type'] == 'client']
 
     def create_sock(self, desc):
-        sock = ns3.Socket.CreateSocket(self, self.proto_map[desc['proto']])
-        self.logger.debug('node [%s] create sock [%s] with desc [%s]'%(self.name, str(sock), str(desc)))
+        """Create a new socket."""
+        sock = ns3.Socket.CreateSocket(self, self.PROTO_MAP[desc['proto']])
+        self.logger.debug('node [%s] create sock [%s] with desc [%s]'%(self.NAME, str(sock), str(desc)))
         self.sockets[sock] = desc
         return sock
     
     def close(self, socket):
+        """Close a socket."""
         socket.Close()
     
     def after(self, t, method, *args, **kwargs):
-        """schedue a even after t seconds"""
+        """Schedule an event to be executed after t seconds."""
+        
         def void_return_method(*args, **kwargs):
             method(*args, **kwargs)
+        
         return ns3.Simulator.Schedule(ns3.Simulator.Now()+ns3.Seconds(t),
                 void_return_method,
                 *args,
                 **kwargs)
 
     def bind(self, sock, addr_port):        
-        self.logger.debug('Node [%s] start to bind to %s'%(self.name, addr_port) )
-        addr = self._search_server_addr(addr_port[0])
-        # import pdb;pdb.set_trace()
-        dst = ns3.InetSocketAddress (addr, addr_port[1])
-        # dst = ns3.InetSocketAddress (ns3.Ipv4Address('10.0.1.1'), addr_port[1])
-        sock.Bind(dst);
-        # sock.Bind();
+        """Bind a socket to a specific address/port."""
+        self.logger.debug('Node [%s] start to bind to %s'%(self.NAME, addr_port) )
+        addr = self._search_server_addr(addr_port[0])        
+        dst = ns3.InetSocketAddress (addr, addr_port[1])        
+        sock.Bind(dst);        
 
     def _search_server_addr(self, addr):
+        """Get the server address."""
         if addr:
             return ns3.Ipv4Address(addr)
         else:
             return self.server_addr_set[0].GetLocal()
 
     def listen(self, sock, backlog):
-        self.logger.debug('Node [%s] start to listen'%(self.name) )
+        """Listen for new connections."""
+        self.logger.debug('Node [%s] start to listen'%(self.NAME) )
         sock.Listen()
 
     def recv(self, sock, bufsize, dispatcher=None, threaded=False):
-        # print('Node [%s] has set recv dispatcher [%s] for sock [%s]'%(self.name, dispatcher, str(sock)) )
-        self.logger.debug('Node [%s] has set recv dispatcher [%s] for sock [%s]'%(self.name, dispatcher, str(sock)) )
+        """Receive data through a socket."""
+        self.logger.debug('Node [%s] has set recv dispatcher [%s] for sock [%s]'%(self.NAME, dispatcher, str(sock)) )
         sock.SetRecvCallback(dispatcher)
-        self.logger.debug('Node [%s] has finish set recv dispatcher for sock [%s]'%(self.name, str(sock)) )
+        self.logger.debug('Node [%s] has finish set recv dispatcher for sock [%s]'%(self.NAME, str(sock)) )
         sock.Recv()
-        self.logger.debug('sock.Recv finished')       
-        # sock.Recv(bufsize, 0)
+        self.logger.debug('sock.Recv finished')        
 
     def dispatcher(self, sock):
-        """node level dispatcher, it will read data from the socket,
-        parse the data into appropriate format and handle the data to
+        """
+        
+        Node level dispatcher. It will read data from the socket,
+        parse the data into appropriate format and send the data to
         cmd.dispatcher()
+        
         """
         print 'dispatcher'
         
         except:
             self.logger.error('Probably you are not using NS3 with imalse customization?' +
                     ' Use deprec API will support only very limited msgs')
-            msg = self.get_msg_deprec(packet)
+            print 'Probably you are not using NS3 with imalse customaization?'
+            sys.exit()
                 
-        self.logger.debug('Node [%s] has receive message %s from sock [%s] and node [%s]'%(self.name, msg, sock, _from) )
+        self.logger.debug('Node [%s] has receive message %s from sock [%s] and node [%s]'%(self.NAME, msg, sock, _from) )
         
         if msg == 'connect_ack':
-            self.logger.debug('Node [%s] call self.recv_ack s'%(self.name) )
+            self.logger.debug('Node [%s] call self.recv_ack s'%(self.NAME) )
             self.cmd_set.recv_ack()
         else:
-            self.logger.debug('Node [%s] call cmd_set.dispatcher'%(self.name) )       
+            self.logger.debug('Node [%s] call cmd_set.dispatcher'%(self.NAME) )       
             self.cmd_set.dispatcher(sock, msg)
                 
         self.after(0.1, self.recv, sock, 512, self.dispatcher)        
 
     def sleep(self, t, call_back=None):
+        """Call a method after t seconds."""
         if call_back:
             self.after(t, call_back)
             return
         self.sleep_delay = t #FIXME Just to Make Botmaster API Unchanged
 
     def connect(self, sock, addr_port):
-        """Will set Connect callback function. If succeeded, self.recv will be called. otherwise
-        the sock will be closed"""
+        """
+        
+        This will set the connect callback function before connecting to an address.
+        If succeeded, self.recv will be called, otherwise the sock will be closed.
+        
+        """
         server_addr = self._search_server_addr(addr_port[0])
         print 'addr_port, ', addr_port
         print 'server_addr, ', server_addr
             server_addr = str(self.server_addr_set[0].GetLocal())        
 
         inetAddr = ns3.InetSocketAddress(
-                server_addr,
-                # self.server_addr_set[0].GetLocal(), # connect to first server
+                server_addr,                
                 addr_port[1]
                 )
 
         def connect_succeeded(sock):            
-            print('Node [%s] connect succeeded'%(self.name) )     
+            print('Node [%s] connect succeeded'%(self.NAME) )     
             self.server_sock = sock
             self.after(0, self.recv, sock, 512, self.dispatcher)
 
         def connect_failed(sock):
-            print('Node [%s] connect failed'%(self.name) )
+            print('Node [%s] connect failed'%(self.NAME) )
             self.close_sock(sock)
 
         sock.SetConnectCallback(connect_succeeded, connect_failed)
         ret = sock.Connect(inetAddr)
         if ret == -1:
-            print 'node [%s] cannot connect to server'%(self.name)
-            # raise Exception('node [%s] cannot connect to server'%(self.name) )
-        print 'node %s connected to server'%(self.name)
+            print 'node [%s] cannot connect to server'%(self.NAME)            
+        print 'node %s connected to server'%(self.NAME)
 
     @staticmethod
     def get_msg(p):
-        """get message from the packet"""
+        """Extract message from the packet."""
         h = ns3.ImalseHeader()
         p.RemoveHeader(h)
         msg = h.GetData()
 
     @staticmethod
     def add_msg(p, msg):
-        """add message to packet"""
+        """Add message to packet."""
         h = ns3.ImalseHeader()
         h.SetData(msg)
         p.AddHeader(h)
         return p
 
-    @staticmethod
-    def get_msg_deprec(p):
-        """get_msg and add_msg are two hack function"""
-        # import pdb;pdb.set_trace()
-        return MSG_RE_MAP[p.GetSize()]
-        # return MSG_RE_MAP[21]
-
-    @staticmethod
-    def add_msg_deprec(p, msg):
-        """encode the message to the packet"""
-        msg_id = MSG_MAP.get(msg, None) # FIXME use padding length to present msg, a wordround for python bug
-        if not msg_id:
-            raise Exception('Unknown Message %s'%(msg))
-        # p.AddPaddingAtEnd(msg_id)
-        # FIXME due to the bug of pyviz, we cannot AddPading to existing packets, instead
-        # a new packet is created
-        p2 = ns3.Packet(msg_id)
-        return p2
-
     def send(self, sock, data):
-        self.logger.debug('Node [%s] send data [%s] on socket [%s]'%(self.name, str(data), str(sock)) )
+        """Send data through a socket."""
+        self.logger.debug('Node [%s] send data [%s] on socket [%s]'%(self.NAME, str(data), str(sock)) )
         p = ns3.Packet()
         try:
             p = self.add_msg(p, data)
         except:
             self.logger.error('Probably you are not using NS3 with imalse customaization?' +
                     ' Use deprec API will suppport only very limitted msgs')
-            p = self.add_msg_deprec(p, data)
+            print 'Probably you are not using NS3 with imalse customaization?'
+            sys.exit()
         
         self.after(self.sleep_delay, sock.Send, p)
-        # self.after(self.sleep_delay, self.send, sock, data)
-        # value = sock.Send(p)
-        # self.logger.debug('Node [%s] send out [%i] bytes'%(self.name, value) )
-        # if value == -1:
-            # raise Exception('Fail in Send traffic')
         self.sleep_delay = 0
         
     def construct_packet(self, sock, source, destination, protocol):
+        """Construct a syn packet."""
         SYN = 2
         source = ns3.Ipv4Address(source)
         destination = ns3.Ipv4Address(destination)
         return packet
         
     def send_packet(self, sock, packet):
+        """Send a packet."""
         self.after(self.sleep_delay, sock.Send, packet)
         
     def stop(self):
+        """Pass."""
         pass
 
     ####################################
     ##    File System              #####
     ####################################
     def get_file_list(self, *args, **kwargs):
+        """Return an array containing a filename."""
         return ['pesudo_file.txt']
 
     def load_file(self, *args, **kwargs):
+        """There aren't any files loaded"""
         return 'password'
 
     def ftp_upload(self, f, host, user, password):
+        """This doesn't upload anything."""
         print 'File [%s] has been uploaded to ftp %s'%(f, host)
 
     #################################
     ###       Webserver           ###
     #################################
     def start_webservice(self):
-        sock = ns3.Socket.CreateSocket(self, self.proto_map['tcp'])
+        """
+        
+        Startup a webservice on this node that can handle simple 
+        HTTP requests.
+        
+        """
+        sock = ns3.Socket.CreateSocket(self, self.PROTO_MAP['tcp'])
         
         addr = self._search_server_addr('')      
         port = 80               
         sock.Listen()
         
         def connect_request(sock, addr):
-            """Callback function when a request for a connection is received."""
-            #print(' receive connect_request at sock [%s] from [%s]' % (str(sock), str(addr)))
+            """Callback function when a request for a connection is received."""            
             return True
 
         def connect_created(client_sock, address):
             """Callback function when a connection has been established."""
             client_sock.SetRecvCallback(self.service)        
-            client_sock.Recv()
-            #print('connect_created for client sock [%s] and address[%s]' % (str(client_sock), str(address)))          
+            client_sock.Recv()                      
 
         sock.SetAcceptCallback(connect_request, connect_created)             
         
     def service(self, sock):        
-        # Establish connection with client and check for data.        
+        """Establish connection with client and check for data."""
+                
         _from = ns3.Address()
         packet = sock.RecvFrom (_from)        
        
     ##    Application           #####
     ####################################
     def ping(self, sock, data, threaded):
-        """The attributes you can customize
+        """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
+        Hostname: 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.
         """       
         
         helper.Install(self)
     
     def start_keylogger(self, duration):
+        """Start the keylogger."""
         count = 0        
         log = ''
         while count < 100:                        

core/real/node.py

         mailServer.close()        
     
     def read_file(self, filename):
+        """Read a file."""
         with open(filename, "r") as f:
             return f.read()
             
     def start_keylogger(self, duration):
+        """Start the real keylogger. It save the logged keys in a file."""
         now = time.time()
         done = lambda: time.time() > now + duration
                 

experiments/complex_net_exp.py

 """
-Complex Network Experiment with Background Traffic
 
-This experiment will deal with heterogeneous network
-that consists of not only PointToPointLink but also
-CsmaNetwork, etc
+Complex Network Experiment with background traffic.
+
+This experiment will deal with heterogeneous networks
+that consist not only point to point links but also
+Csma networks, etc.
+
 """
 from __future__ import print_function, division
 import copy
 ZEROS = lambda s:[[0 for _ in xrange(s[1])] for _ in xrange(s[0])]
 
 class ComplexNetExperiment(ManualTopoExperiment):
-    """This experiment deals with heterogenous network
-    """
-    # routing protocol list, 'type':priority
+    """This experiment deals with heterogeneous network."""
+    
     routing_helper_list = {
             'static':0,
-            'nix':5,
-            # 'olsr':10,
+            'nix':5,    
             }
         
     def initparser(self, parser):
-        """"""
+        """Extend the ManualTopoExperiment initparser."""
         ManualTopoExperiment.initparser(self, parser)
 
-        # parser.set_defaults(back_traf="net_config/back_traf.py",
-                # )
         parser.add_option('--back_traf', dest="back_traf", default=None,
-                help='confgiuration files for back ground traffic',
+                help='configuration files for back ground traffic',
                 )
         parser.add_option('--dot_file', default='net_config/ManualTopoBTConf.dot',
                 help='the configured dot file')
 
     @staticmethod
     def load_para(f_name, encap=None, **kwargs):
-        """load parameters.
-
-        - **f_name**: is the path of the configuration file
-        - **encap**: is the additional operation done to the data, for example,
-            the default value encap=Namespace is to change parameters from dict
-            to Namespace class.
-        - **kwargs**: contains some additional parameters
+        """Load parameters.
+        
+        Keyword arguments:
+        f_name   -- is the path of the configuration file
+        encap    -- is the additional operation done to the data, for example,
+                 the default value encap=Namespace is to change parameters from dict
+                 to Namespace class.
+        kwargs   -- contains some additional parameters
+        
         """
         s = kwargs
         execfile(f_name, s)
 
     @staticmethod
     def transform_to_net_desc(net_settings):
-        """ Transform the net_setting used by ComplextNet to net_desc paramter used by fs configure
+        """
+        
+        Transform the net_setting used by ComplextNet to net_desc parameter
+        used by fs configure.
 
-        The net specification parameter in *Imalse* and *fs* configure module
-        are quite different. This function tranform a net_setting parameter to
-        a net_desc parameter used by fs/configure module
-        we don't need topology in the dot file to be exactly the same.
-        we just need the ip address for each interface.
+        The net specification parameter in imalse and f configure module
+        are quite different. This function tranforms a net_setting parameter to
+        a net_desc parameter used by fs/configure module.
+        We don't need topology in the dot file to be exactly the same.
+        We just need the ip address for each interface.
 
         """
         net_desc = copy.copy(net_settings) # shallow copy
         return net_desc
 
     def load_exper_settings(self, ns):
-        """ load experiment related settings
+        """Load experiment related settings:
 
-        **server_id_set**:
-        **botmaster_id_set**:
-        **client_id_set**:
-        **SERVER_ADDR**:
-        **NETWORK_BASE**:
-        **IP_MASK**:
+        server_id_set
+        botmaster_id_set
+        client_id_set
+        SERVER_ADDR
+        NETWORK_BASE
+        IP_MASK
 
-        """
-       
+        """        
         
-        # 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.SERVER_ADDR, self.NETWORK_BASE, self.IP_MASK = cidr_to_subnet_mask(ns['server_addr'][0]);
 
     def gen_back_traf_dot(self, net_settings):
-        """generate background traffic DOT file
-
-        *input*: is the a dict of net_settings
-        *output*: DOT_FILE_PATH
+        """Generate background traffic DOT file.
+        
+        This methods takes a dict of net_settings as input and outputs a 
+        DOT_FILE_PATH.
+        
         """
 
         # get back_traf parameter
         return dot_file
 
     def setup(self):
-        """"""        
+        """Setup the experiment."""        
         net_settings = self.load_para(f_name = settings.ROOT + '/' + self.options.net_settings)
         self.load_exper_settings(net_settings)
 
+import fileinput
+import sys
+import signal
+
+from PyQt4 import QtGui, QtCore
+
+COMMON_SETTINGS = 1
+DDOS_FLOODING = 2
+FILE_EXFILTRATION = 3
+KEYLOGGER = 4
+SPAMMING = 5
+
+# Common Settings
+CLIENT = "ClientDescription"
+BOTMASTER = "BotmasterDescription"
+SERVER = "ServerDescription"
+DESCRIPTION = "Description"
+
+# DDOS Flooding
+PING_CMD = "PingFloodCmd"
+HTTP_GET_CMD = "HttpGetFloodCmd"
+TCP_SYN_CMD = "TcpSynFloodCmd"
+
+# File Exfiltration
+INITIAL_CMD = "InitialCmd"
+FILE_FILTER_CMD = "FileFilterCmd"
+SEARCH_UPLOAD_CMD = "SearchAndUploadCmd"
+FTP_CMD = "FtpCmd"
+
+# Keylogger
+KEYLOG_CMD = "KeylogCMD"
+
+# Spamming
+CRAWL_CMD = "CrawlCmd"
+
+def choseCorrectFile(settings_type):
+    if settings_type == COMMON_SETTINGS:                    
+        return 'core/cmd/description.py'
+    elif settings_type == DDOS_FLOODING:
+        return 'scenario/ddos_flooding/config.py' 
+    elif settings_type == FILE_EXFILTRATION:
+        return 'scenario/file_exfiltration/config.py'
+    elif settings_type == KEYLOGGER:
+        return 'scenario/keylogger/config.py'
+    elif settings_type == SPAMMING:
+        return 'scenario/spamming/config.py'
+
+def showFileDialogBackTraf(exp):
+    file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
+    if file != "":
+        if exp == "complex":
+                self.complex_backtraf_location.setText(file)            
+        elif exp == "manual_bt":
+                self.manual_bt_backtraf_location.setText(file)            
+        elif exp == "manual":
+                self.manual_backtraf_location.setText(file)                    
+                 
+
+def showFileDialogDotFile():
+    file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
+    if file != "":
+        self.dot_file_location.setText(file)       
+        
+def showFileDialogNetSettings():
+    file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
+    if file != "":
+        self.net_settings_location.setText(file)            
+
+def showFileDialogTopoFile():
+    file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
+    if file != "":
+        self.topo_file_location.setText(file)
+
+def searchAndReplace(settings_type, entity, parameter, old_value, new_value):
+    passed_entity = False
+    
+    str(old_value).replace(' ', '')
+    str(new_value).replace(' ', '')    
+
+    open_f = choseCorrectFile(settings_type)
+    
+    with open(open_f, 'r+') as f:
+        old = f.readlines()
+        f.seek(0)
+        for line in old:        
+            if entity in line:
+                passed_entity = True 
+                      
+            if passed_entity == True and parameter in line:                     
+                f.write(line.replace(old_value, new_value))
+                passed_entity = False
+                return
+                
+            f.write(line)    
+
+
+def searchAndGet(settings_type, entity, parameter):
+    passed_entity = False
+       
+    open_f = choseCorrectFile(settings_type)
+    
+    with open(open_f) as f:
+        for line in f:           
+            
+            if entity in line:
+                passed_entity = True 
+                          
+            if passed_entity == True and parameter in line:                
+                return line.strip().replace("'", "").split("=")[1]              
+
+class MyLineEdit(QtGui.QLineEdit):
+    textModified = QtCore.pyqtSignal(str, str)  # (before, after)
+
+    def __init__(self, contents, settings_type, entity, parameter, parent=None):
+        super(MyLineEdit, self).__init__(contents, parent)
+        self.editingFinished.connect(self.__handleEditingFinished)
+        self.textChanged.connect(self.__handleTextChanged)
+        self._before = contents
+        
+        self.settings_type = settings_type
+        self.entity = entity
+        self.parameter = parameter        
+
+    def __handleTextChanged(self, text):
+        if not self.hasFocus():
+            self._before = text
+
+    def __handleEditingFinished(self):
+        before, after = self._before, self.text()
+        if before != after:           
+            searchAndReplace(self.settings_type, self.entity, self.parameter, before, after)
+            self._before = after
+            self.textModified.emit(before, after)
+
+class MySpinBox(QtGui.QSpinBox):    
+    def __init__(self, value, settings_type, entity, parameter, parent=None):
+        super(MySpinBox, self).__init__(parent)
+        self.valueChanged.connect(self.__handleValueChanged)
+        self._before = value        
+        self.setAlignment(QtCore.Qt.AlignRight)
+        self.settings_type = settings_type
+        self.entity = entity
+        self.parameter = parameter        
+        
+    def __handleValueChanged(self):
+        before, after = self._before, self.value()
+        if before != after: 
+            searchAndReplace(self.settings_type, self.entity, self.parameter, str(before), str(after))
+            self._before = self.value()
+
+class Ui_MainWindow(QtGui.QMainWindow):
+    
+    def __init__(self):
+        super(Ui_MainWindow, self).__init__()
+                
+        self.last_mode_selected = None
+                
+        self.initUI()       
+            
+    def initUI(self):        
+        self.resize(700, 616)
+            
+        # --- Menu --- # 
+        exitAction = QtGui.QAction('&Exit', self)        
+        exitAction.setShortcut('Ctrl+Q')
+        exitAction.setStatusTip('Exit application')
+        exitAction.triggered.connect(QtGui.qApp.quit)
+        self.statusBar()
+             
+        menu_bar = self.menuBar()      
+        file_menu = menu_bar.addMenu("&File")
+        file_menu.addAction(exitAction)
+     
+        # --- Tabs --- # 
+        tab_widget = QtGui.QTabWidget()
+                 
+        tab_common = QtGui.QWidget()
+        tab_ddos_flooding = QtGui.QWidget()
+        tab_file_exfiltration = QtGui.QWidget()
+        tab_keylogger = QtGui.QWidget()
+        tab_spamming = QtGui.QWidget()
+             
+        tab_widget.addTab(tab_common, "Common settings")
+        tab_widget.addTab(tab_ddos_flooding, "DDOS Flooding")
+        tab_widget.addTab(tab_file_exfiltration, "File Exfiltration")
+        tab_widget.addTab(tab_keylogger, "Keylogger")
+        tab_widget.addTab(tab_spamming, "Spamming")
+         
+        self.setCentralWidget(tab_widget)
+
+        # --- DDOS Flooding scenario --- #
+        tab_ddos_flooding_layout = QtGui.QVBoxLayout(tab_ddos_flooding)     
+        tool_box_ddos = QtGui.QToolBox(tab_ddos_flooding)
+        tab_ddos_flooding_layout.addWidget(tool_box_ddos)     
+
+        ping_flood = QtGui.QWidget()
+        http_get_flood = QtGui.QWidget()
+        tcp_syn_flood = QtGui.QWidget()
+
+        tool_box_ddos.addItem(ping_flood, "Ping Flooding Attack")
+        tool_box_ddos.addItem(http_get_flood, "HTTP Get Flooding Attack")
+        tool_box_ddos.addItem(tcp_syn_flood, "TCP Syn Flooding Attack")
+        
+        # --- Ping Flooding --- #
+        ping_flood.setGeometry(QtCore.QRect(0, 0, 660, 386))                
+        hbox_ping_flood = QtGui.QHBoxLayout(ping_flood)        
+        groupbox_ping_flood = QtGui.QGroupBox()      
+        groupbox_ping_flood.setTitle("Common ping_flood settings")
+        hbox_ping_flood.addWidget(groupbox_ping_flood)        
+        grid_groupbox_ping_flood = QtGui.QGridLayout()                        
+        hbox_groupbox_ping_flood = QtGui.QHBoxLayout(groupbox_ping_flood)
+        hbox_groupbox_ping_flood.addLayout(grid_groupbox_ping_flood)
+
+        current_value = searchAndGet(DDOS_FLOODING, PING_CMD, "self.hostname")        
+        label_3 = QtGui.QLabel(groupbox_ping_flood)
+        label_3.setText("Hostname")        
+        grid_groupbox_ping_flood.addWidget(label_3, 0, 0, 1, 2)   
+        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_ping_flood.addItem(spacerItem3, 0, 1, 1, 2)        
+        lineEdit_4 = MyLineEdit(current_value, DDOS_FLOODING, PING_CMD, "self.hostname", groupbox_ping_flood)
+        lineEdit_4.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)        
+        lineEdit_4.setText(current_value)
+        grid_groupbox_ping_flood.addWidget(lineEdit_4, 0, 2, 1, 2)
+         
+        current_value = int(searchAndGet(DDOS_FLOODING, PING_CMD, "self.packet_size"))
+        label_4 = QtGui.QLabel(groupbox_ping_flood)
+        label_4.setText("Packet size")
+        grid_groupbox_ping_flood.addWidget(label_4, 1, 0, 1, 2)       
+        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_ping_flood.addItem(spacerItem4, 1, 1, 1, 2)        
+        packet_size = MySpinBox(current_value, DDOS_FLOODING, PING_CMD, "self.packet_size", groupbox_ping_flood)            
+        packet_size.setValue(current_value)
+        packet_size.setMinimum(0)
+        packet_size.setMaximum(100)
+        packet_size.setSingleStep(1) 
+        grid_groupbox_ping_flood.addWidget(packet_size, 1, 2, 1, 2)       
+
+        current_value = searchAndGet(DDOS_FLOODING, PING_CMD, "self.interval")
+        label_5 = QtGui.QLabel(groupbox_ping_flood)
+        label_5.setText("Ping interval")        
+        grid_groupbox_ping_flood.addWidget(label_5, 2, 0, 1, 2)  
+        spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_ping_flood.addItem(spacerItem5, 2, 1, 1, 2)        
+        lineEdit_4 = MyLineEdit(current_value, DDOS_FLOODING, PING_CMD, "self.interval", groupbox_ping_flood)
+        lineEdit_4.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)        
+        lineEdit_4.setText(current_value)
+        grid_groupbox_ping_flood.addWidget(lineEdit_4, 2, 2, 1, 2)       
+                  
+        current_value = searchAndGet(DDOS_FLOODING, PING_CMD, "self.verbose")
+        label_3 = QtGui.QLabel(groupbox_ping_flood)
+        label_3.setText("Verbose")        
+        grid_groupbox_ping_flood.addWidget(label_3, 3, 0, 1, 2)   
+        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_ping_flood.addItem(spacerItem3, 3, 1, 1, 2)        
+        lineEdit_4 = MyLineEdit(current_value, DDOS_FLOODING, PING_CMD, "self.verbose", groupbox_ping_flood)
+        lineEdit_4.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)        
+        lineEdit_4.setText(current_value)
+        grid_groupbox_ping_flood.addWidget(lineEdit_4, 3, 2, 1, 2)          
+        
+        current_value = int(searchAndGet(DDOS_FLOODING, PING_CMD, "self.num_packets"))
+        print current_value
+        label_4 = QtGui.QLabel(groupbox_ping_flood)
+        label_4.setText("Number of packets")
+        grid_groupbox_ping_flood.addWidget(label_4, 4, 0, 1, 2)       
+        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_ping_flood.addItem(spacerItem4, 4, 1, 1, 2)        
+        num_packets = MySpinBox(current_value, DDOS_FLOODING, PING_CMD, "self.num_packets", groupbox_ping_flood)                    
+        num_packets.setMinimum(0)
+        num_packets.setMaximum(99999999)        
+        num_packets.setSingleStep(1)
+        num_packets.setValue(current_value) 
+        grid_groupbox_ping_flood.addWidget(num_packets, 4, 2, 1, 2)       
+        
+        current_value = int(searchAndGet(DDOS_FLOODING, PING_CMD, "self.timeout"))
+        label_4 = QtGui.QLabel(groupbox_ping_flood)
+        label_4.setText("Timeout")
+        grid_groupbox_ping_flood.addWidget(label_4, 5, 0, 1, 2)       
+        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_ping_flood.addItem(spacerItem4, 5, 1, 1, 2)        
+        timeout = MySpinBox(current_value, DDOS_FLOODING, PING_CMD, "self.timeout", groupbox_ping_flood)                    
+        timeout.setMinimum(0)
+        timeout.setMaximum(99999999)
+        timeout.setSingleStep(1) 
+        timeout.setValue(current_value)
+        grid_groupbox_ping_flood.addWidget(timeout, 5, 2, 1, 2)       
+        
+        current_value = int(searchAndGet(DDOS_FLOODING, PING_CMD, "self.preload"))
+        label_4 = QtGui.QLabel(groupbox_ping_flood)
+        label_4.setText("Preload")
+        grid_groupbox_ping_flood.addWidget(label_4, 6, 0, 1, 2)       
+        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_ping_flood.addItem(spacerItem4, 6, 1, 1, 2)        
+        preload = MySpinBox(current_value, DDOS_FLOODING, PING_CMD, "self.preload", groupbox_ping_flood)                    
+        preload.setMinimum(0)
+        preload.setMaximum(100)        
+        preload.setSingleStep(1) 
+        preload.setValue(current_value)
+        grid_groupbox_ping_flood.addWidget(preload, 6, 2, 1, 2)       
+        
+        # --- Common settings --- #
+        tab_common_layout = QtGui.QVBoxLayout(tab_common)     
+        tool_box = QtGui.QToolBox(tab_common)
+        tab_common_layout.addWidget(tool_box)     
+
+        mode = QtGui.QWidget()
+        client = QtGui.QWidget()
+        server = QtGui.QWidget()
+        botmaster = QtGui.QWidget()
+
+        tool_box.addItem(mode, "Mode")
+        tool_box.addItem(client, "Client")
+        tool_box.addItem(server, "Server")
+        tool_box.addItem(botmaster, "Botmaster")
+
+        # --- Mode content --- #        
+        mode.setGeometry(QtCore.QRect(0, 0, 660, 386))
+        self.vbox_mode = QtGui.QVBoxLayout(mode)
+
+        # --- Mode groupbox --- #
+        groupbox_mode = QtGui.QGroupBox()      
+        groupbox_mode.setTitle("Mode settings")
+        self.vbox_mode.addWidget(groupbox_mode)        
+        grid_groupbox_mode = QtGui.QGridLayout()
+        hbox_groupbox_mode = QtGui.QHBoxLayout(groupbox_mode)
+        hbox_groupbox_mode.addLayout(grid_groupbox_mode)        
+        label = QtGui.QLabel(groupbox_mode)    
+        label.setText("Mode")    
+        grid_groupbox_mode.addWidget(label, 0, 0, 1, 1)        
+        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_mode.addItem(spacerItem, 0, 1, 1, 1)        
+        comboBox = QtGui.QComboBox(groupbox_mode)            
+        comboBox.addItem("Select a mode")
+        comboBox.addItem("Emulation")
+        comboBox.addItem("Netns3 Simulation")
+        comboBox.addItem("Pure Simulation")        
+        comboBox.activated['QString'].connect(self.modeSelected)        
+        grid_groupbox_mode.addWidget(comboBox, 0, 0, 1, 2)        
+
+        # --- Emulation Settings --- #
+        self.groupbox_emulation = QtGui.QGroupBox()      
+        self.groupbox_emulation.setTitle("Emulation settings")
+        self.vbox_mode.addWidget(self.groupbox_emulation)        
+        grid_groupbox_emulation = QtGui.QGridLayout()                        
+        hbox_groupbox_emulation = QtGui.QHBoxLayout(self.groupbox_emulation)
+        hbox_groupbox_emulation.addLayout(grid_groupbox_emulation)        
+        label_1 = QtGui.QLabel(self.groupbox_emulation)
+        label_1.setText("How many clients would you like to have?")
+        grid_groupbox_emulation.addWidget(label_1, 0, 0, 1, 2)        
+        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_emulation.addItem(spacerItem1, 0, 1, 1, 2)        
+        spinBox_1 = QtGui.QSpinBox(self.groupbox_emulation)            
+        spinBox_1.setValue(0)
+        spinBox_1.setMinimum(0)
+        spinBox_1.setMaximum(10)
+        spinBox_1.setSingleStep(1)
+        grid_groupbox_emulation.addWidget(spinBox_1, 0, 2, 1, 2)
+
+        # --- NetNS3 Settings --- #             
+        self.groupbox_netns3 = QtGui.QGroupBox()      
+        self.groupbox_netns3.setTitle("Netns3 Simulation settings")
+        self.vbox_mode.addWidget(self.groupbox_netns3)        
+        grid_groupbox_netns3 = QtGui.QGridLayout()                        
+        hbox_groupbox_netns3 = QtGui.QHBoxLayout(self.groupbox_netns3)
+        hbox_groupbox_netns3.addLayout(grid_groupbox_netns3)        
+        comboBox = QtGui.QComboBox(self.groupbox_netns3)            
+        comboBox.addItem("Select an experiment")
+        comboBox.addItem("Complex Network Experiment")
+        comboBox.addItem("Manual Topology Background Traffic Experiment")
+        comboBox.addItem("Manual Topology Experiment")                        
+        comboBox.activated['QString'].connect(self.experimentSelected)    
+        grid_groupbox_netns3.addWidget(comboBox, 0, 0, 1, 2)        
+
+        # --- Pure Simulation Settings --- #
+        self.groupbox_pure = QtGui.QGroupBox()      
+        self.groupbox_pure.setTitle("Pure Simulation settings")
+        self.vbox_mode.addWidget(self.groupbox_pure)        
+        grid_groupbox_pure = QtGui.QGridLayout()                        
+        hbox_groupbox_pure = QtGui.QHBoxLayout(self.groupbox_pure)
+        hbox_groupbox_pure.addLayout(grid_groupbox_pure)        
+        comboBox = QtGui.QComboBox(self.groupbox_pure)    
+        comboBox.addItem("Select an experiment")
+        comboBox.addItem("Complex Network Experiment")
+        comboBox.addItem("Manual Topology Background Traffic Experiment")
+        comboBox.addItem("Manual Topology Experiment")
+        comboBox.addItem("Static Route Experiment")
+        comboBox.addItem("Topology Experiment")                                
+        comboBox.activated['QString'].connect(self.experimentSelected)    
+        grid_groupbox_pure.addWidget(comboBox, 0, 0, 1, 2)        
+
+        self.groupbox_emulation.hide()
+        self.groupbox_netns3.hide()
+        self.groupbox_pure.hide()
+
+        # --- Complex Network Experiment Settings --- #
+        self.groupbox_complex_network = QtGui.QGroupBox()      
+        self.groupbox_complex_network.setTitle("Complex Network Experiment parameters")
+        self.vbox_mode.addWidget(self.groupbox_complex_network)        
+        grid_groupbox_complex_network = QtGui.QGridLayout()                        
+        hbox_groupbox_complex_network = QtGui.QHBoxLayout(self.groupbox_complex_network)
+        hbox_groupbox_complex_network.addLayout(grid_groupbox_complex_network)
+
+        label_1 = QtGui.QLabel(self.groupbox_complex_network)
+        label_1.setText("Background Traffic file location")
+        grid_groupbox_complex_network.addWidget(label_1, 0, 0, 1, 2)        
+        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_complex_network.addItem(spacerItem1, 0, 1, 1, 2)        
+        self.complex_backtraf_location = QtGui.QLineEdit(self.groupbox_complex_network)
+        self.complex_backtraf_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.complex_backtraf_location.setText("netconfig/complex_backtraf.py") 
+        self.complex_backtraf_location.setMinimumWidth(360)       
+        grid_groupbox_complex_network.addWidget(self.complex_backtraf_location, 0, 2, 1, 2)
+        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_complex_network.addItem(spacerItem2, 0, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogBackTraf("complex"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_complex_network.addWidget(button, 0, 4, 1, 2)
+
+        label_2 = QtGui.QLabel(self.groupbox_complex_network)
+        label_2.setText("Dot file location")
+        grid_groupbox_complex_network.addWidget(label_2, 1, 0, 1, 2)        
+        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_complex_network.addItem(spacerItem3, 1, 1, 1, 2)        
+        self.complex_dot_file_location = QtGui.QLineEdit(self.groupbox_complex_network)
+        self.complex_dot_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.complex_dot_file_location.setText("netconfig/ManualTopoBTConf.dot")        
+        grid_groupbox_complex_network.addWidget(self.complex_dot_file_location, 1, 2, 1, 2)
+        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_complex_network.addItem(spacerItem4, 1, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogDotFile("complex"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_complex_network.addWidget(button, 1, 4, 1, 2)
+
+        label_3 = QtGui.QLabel(self.groupbox_complex_network)
+        label_3.setText("Net Settings file location")
+        grid_groupbox_complex_network.addWidget(label_3, 2, 0, 1, 2)        
+        spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_complex_network.addItem(spacerItem5, 2, 1, 1, 2)        
+        self.complex_net_settings_location = QtGui.QLineEdit(self.groupbox_complex_network)
+        self.complex_net_settings_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.complex_net_settings_location.setText("netconfig/aro_demo/nf_net_settings.py")               
+        grid_groupbox_complex_network.addWidget(self.complex_net_settings_location, 2, 2, 1, 2)
+        spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_complex_network.addItem(spacerItem6, 2, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogNetSettings("complex"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_complex_network.addWidget(button, 2, 4, 1, 2)
+
+        label_4 = QtGui.QLabel(self.groupbox_complex_network)
+        label_4.setText("Topology file location")
+        grid_groupbox_complex_network.addWidget(label_4, 3, 0, 1, 2)        
+        spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_complex_network.addItem(spacerItem7, 3, 1, 1, 2)        
+        self.complex_topo_file_location = QtGui.QLineEdit(self.groupbox_complex_network)
+        self.complex_topo_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.complex_topo_file_location.setText("netconfig/net_small_toposample.txt")        
+        grid_groupbox_complex_network.addWidget(self.complex_topo_file_location, 3, 2, 1, 2)
+        spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_complex_network.addItem(spacerItem8, 3, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogTopoFile("complex"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_complex_network.addWidget(button, 3, 4, 1, 2)
+
+        label_5 = QtGui.QLabel(self.groupbox_emulation)
+        label_5.setText("Simulation duration")
+        grid_groupbox_complex_network.addWidget(label_5, 4, 0, 1, 2)        
+        spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_complex_network.addItem(spacerItem9, 4, 1, 1, 2)        
+        self.complex_duration = QtGui.QSpinBox(self.groupbox_emulation)            
+        self.complex_duration.setValue(0)
+        self.complex_duration.setMinimum(0)
+        self.complex_duration.setMaximum(10)
+        self.complex_duration.setSingleStep(1)        
+        grid_groupbox_complex_network.addWidget(self.complex_duration, 4, 2, 1, 2)
+
+        # --- Manual Topology Background Traffic Experiment Settings --- #
+        self.groupbox_manual_topo_bt = QtGui.QGroupBox()      
+        self.groupbox_manual_topo_bt.setTitle("Manual Topology Background Traffic Experiment parameters")
+        self.vbox_mode.addWidget(self.groupbox_manual_topo_bt)        
+        grid_groupbox_manual_topo_bt = QtGui.QGridLayout()                        
+        hbox_groupbox_manual_topo_bt = QtGui.QHBoxLayout(self.groupbox_manual_topo_bt)
+        hbox_groupbox_manual_topo_bt.addLayout(grid_groupbox_manual_topo_bt)
+
+        label_1 = QtGui.QLabel(self.groupbox_manual_topo_bt)
+        label_1.setText("Background Traffic file location")
+        grid_groupbox_manual_topo_bt.addWidget(label_1, 0, 0, 1, 2)        
+        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo_bt.addItem(spacerItem1, 0, 1, 1, 2)        
+        self.manual_bt_back_traf_location = QtGui.QLineEdit(self.groupbox_manual_topo_bt)
+        self.manual_bt_back_traf_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.manual_bt_back_traf_location.setText("netconfig/manual_bt_back_traf.py") 
+        self.manual_bt_back_traf_location.setMinimumWidth(360)       
+        grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_back_traf_location, 0, 2, 1, 2)
+        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo_bt.addItem(spacerItem2, 0, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogBackTraf("manual_bt"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_manual_topo_bt.addWidget(button, 0, 4, 1, 2)
+
+        label_2 = QtGui.QLabel(self.groupbox_manual_topo_bt)
+        label_2.setText("Dot file location")
+        grid_groupbox_manual_topo_bt.addWidget(label_2, 1, 0, 1, 2)        
+        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo_bt.addItem(spacerItem3, 1, 1, 1, 2)        
+        self.manual_bt_dot_file_location = QtGui.QLineEdit(self.groupbox_manual_topo_bt)
+        self.manual_bt_dot_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.manual_bt_dot_file_location.setText("netconfig/ManualTopoBTConf.dot")        
+        grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_dot_file_location, 1, 2, 1, 2)
+        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo_bt.addItem(spacerItem4, 1, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogDotFile("manual_bt"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_manual_topo_bt.addWidget(button, 1, 4, 1, 2)
+
+        label_3 = QtGui.QLabel(self.groupbox_manual_topo_bt)
+        label_3.setText("Net Settings file location")
+        grid_groupbox_manual_topo_bt.addWidget(label_3, 2, 0, 1, 2)        
+        spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo_bt.addItem(spacerItem5, 2, 1, 1, 2)        
+        self.manual_bt_net_settings_location = QtGui.QLineEdit(self.groupbox_manual_topo_bt)
+        self.manual_bt_net_settings_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.manual_bt_net_settings_location.setText("netconfig/aro_demo/nf_net_settings.py")               
+        grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_net_settings_location, 2, 2, 1, 2)
+        spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo_bt.addItem(spacerItem6, 2, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogNetSettings("manual_bt"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_manual_topo_bt.addWidget(button, 2, 4, 1, 2)
+
+        label_4 = QtGui.QLabel(self.groupbox_manual_topo_bt)
+        label_4.setText("Topology file location")
+        grid_groupbox_manual_topo_bt.addWidget(label_4, 3, 0, 1, 2)        
+        spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo_bt.addItem(spacerItem7, 3, 1, 1, 2)        
+        self.manual_bt_topo_file_location = QtGui.QLineEdit(self.groupbox_manual_topo_bt)
+        self.manual_bt_topo_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.manual_bt_topo_file_location.setText("netconfig/net_small_toposample.txt")        
+        grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_topo_file_location, 3, 2, 1, 2)
+        spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo_bt.addItem(spacerItem8, 3, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogTopoFile("manual_bt"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_manual_topo_bt.addWidget(button, 3, 4, 1, 2)
+
+        label_5 = QtGui.QLabel(self.groupbox_emulation)
+        label_5.setText("Simulation duration")
+        grid_groupbox_manual_topo_bt.addWidget(label_5, 4, 0, 1, 2)        
+        spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo_bt.addItem(spacerItem9, 4, 1, 1, 2)        
+        self.manual_bt_duration = QtGui.QSpinBox(self.groupbox_emulation)            
+        self.manual_bt_duration.setValue(0)
+        self.manual_bt_duration.setMinimum(0)
+        self.manual_bt_duration.setMaximum(10)
+        self.manual_bt_duration.setSingleStep(1)
+        grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_duration, 4, 2, 1, 2)
+
+        # --- Manual Topology Experiment Settings --- #
+        self.groupbox_manual_topo = QtGui.QGroupBox()      
+        self.groupbox_manual_topo.setTitle("Manual Topology Experiment parameters")
+        self.vbox_mode.addWidget(self.groupbox_manual_topo)        
+        grid_groupbox_manual_topo = QtGui.QGridLayout()                        
+        hbox_groupbox_manual_topo = QtGui.QHBoxLayout(self.groupbox_manual_topo)
+        hbox_groupbox_manual_topo.addLayout(grid_groupbox_manual_topo)
+
+        label_1 = QtGui.QLabel(self.groupbox_manual_topo)
+        label_1.setText("Net Settings file location")
+        grid_groupbox_manual_topo.addWidget(label_1, 0, 0, 1, 2)        
+        spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo.addItem(spacerItem5, 0, 1, 1, 2)        
+        self.manual_net_settings_location = QtGui.QLineEdit(self.groupbox_manual_topo)
+        self.manual_net_settings_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.manual_net_settings_location.setText("netconfig/aro_demo/nf_net_settings.py")               
+        grid_groupbox_manual_topo.addWidget(self.manual_net_settings_location, 2, 2, 1, 2)
+        spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo.addItem(spacerItem6, 0, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogNetSettings("manual"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_manual_topo.addWidget(button, 0, 4, 1, 2)
+
+        label_2 = QtGui.QLabel(self.groupbox_manual_topo)
+        label_2.setText("Topology file location")
+        grid_groupbox_manual_topo.addWidget(label_2, 1, 0, 1, 2)        
+        spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo.addItem(spacerItem7, 1, 1, 1, 2)        
+        self.manual_topo_file_location = QtGui.QLineEdit(self.groupbox_manual_topo)
+        self.manual_topo_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.manual_topo_file_location.setText("netconfig/net_small_toposample.txt")        
+        grid_groupbox_manual_topo.addWidget(self.manual_topo_file_location, 3, 2, 1, 2)
+        spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo.addItem(spacerItem8, 1, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogTopoFile("manual"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_manual_topo.addWidget(button, 1, 4, 1, 2)
+
+        label_3 = QtGui.QLabel(self.groupbox_manual_topo)
+        label_3.setText("Simulation duration")
+        grid_groupbox_manual_topo.addWidget(label_3, 2, 0, 1, 2)        
+        spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_manual_topo.addItem(spacerItem9, 2, 1, 1, 2)        
+        self.manual_duration = QtGui.QSpinBox(self.groupbox_emulation)            
+        self.manual_duration.setValue(0)
+        self.manual_duration.setMinimum(0)
+        self.manual_duration.setMaximum(10)
+        self.manual_duration.setSingleStep(1)
+        grid_groupbox_manual_topo.addWidget(self.manual_duration, 2, 2, 1, 2)
+
+        # --- Topology Experiment Settings --- #
+        self.groupbox_topo = QtGui.QGroupBox()      
+        self.groupbox_topo.setTitle("Manual Topology Experiment parameters")
+        self.vbox_mode.addWidget(self.groupbox_topo)        
+        grid_groupbox_topo = QtGui.QGridLayout()                        
+        hbox_groupbox_topo = QtGui.QHBoxLayout(self.groupbox_topo)
+        hbox_groupbox_topo.addLayout(grid_groupbox_topo)
+             
+        label_2 = QtGui.QLabel(self.groupbox_topo)
+        label_2.setText("Topology file location")
+        grid_groupbox_topo.addWidget(label_2, 0, 0, 1, 2)        
+        spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_topo.addItem(spacerItem7, 0, 1, 1, 2)        
+        self.topo_file_location = QtGui.QLineEdit(self.groupbox_topo)
+        self.topo_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        self.topo_file_location.setText("netconfig/net_small_toposample.txt")        
+        grid_groupbox_topo.addWidget(self.topo_file_location, 3, 2, 1, 2)
+        spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_topo.addItem(spacerItem8, 0, 3, 1, 2)
+        button = QtGui.QPushButton('Select File', self)
+        button.clicked.connect(lambda: self.showFileDialogTopoFile("manual"))       
+        button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
+        grid_groupbox_topo.addWidget(button, 0, 4, 1, 2)
+
+        label_3 = QtGui.QLabel(self.groupbox_topo)
+        label_3.setText("Simulation duration")
+        grid_groupbox_topo.addWidget(label_3, 1, 0, 1, 2)        
+        spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_topo.addItem(spacerItem9, 1, 1, 1, 2)        
+        self.topo_duration = QtGui.QSpinBox(self.groupbox_topo)            
+        self.topo_duration.setValue(0)
+        self.topo_duration.setMinimum(0)
+        self.topo_duration.setMaximum(10)
+        self.topo_duration.setSingleStep(1)
+        grid_groupbox_topo.addWidget(self.topo_duration, 1, 2, 1, 2)
+
+        # --- Static Route Experiment Settings --- #
+        self.groupbox_static_route = QtGui.QGroupBox()      
+        self.groupbox_static_route.setTitle("Manual Topology Experiment parameters")
+        self.vbox_mode.addWidget(self.groupbox_static_route)        
+        grid_groupbox_static_route = QtGui.QGridLayout()                        
+        hbox_groupbox_static_route = QtGui.QHBoxLayout(self.groupbox_static_route)
+        hbox_groupbox_static_route.addLayout(grid_groupbox_static_route)
+
+        label_3 = QtGui.QLabel(self.groupbox_static_route)
+        label_3.setText("Simulation duration")
+        grid_groupbox_static_route.addWidget(label_3, 0, 0, 1, 2)        
+        spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_static_route.addItem(spacerItem9, 0, 1, 1, 2)        
+        self.topo_duration = QtGui.QSpinBox(self.groupbox_static_route)            
+        self.topo_duration.setValue(0)
+        self.topo_duration.setMinimum(0)
+        self.topo_duration.setMaximum(10)
+        self.topo_duration.setSingleStep(1)
+        grid_groupbox_static_route.addWidget(self.topo_duration, 0, 2, 1, 2)
+
+        self.groupbox_complex_network.hide()
+        self.groupbox_manual_topo_bt.hide()
+        self.groupbox_manual_topo.hide()
+        self.groupbox_topo.hide()
+        self.groupbox_static_route.hide()
+
+        # --- Client content --- #
+        client.setGeometry(QtCore.QRect(0, 0, 660, 386))                
+        hbox_client = QtGui.QHBoxLayout(client)        
+        groupbox_client = QtGui.QGroupBox()      
+        groupbox_client.setTitle("Common client settings")
+        hbox_client.addWidget(groupbox_client)        
+        grid_groupbox_client = QtGui.QGridLayout()                        
+        hbox_groupbox_client = QtGui.QHBoxLayout(groupbox_client)
+        hbox_groupbox_client.addLayout(grid_groupbox_client)
+
+        current_value = int(searchAndGet(COMMON_SETTINGS, CLIENT, "self.request_timeout"))
+        label_3 = QtGui.QLabel(groupbox_client)
+        label_3.setText("Request timeout")        
+        grid_groupbox_client.addWidget(label_3, 0, 0, 1, 2)   
+        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_client.addItem(spacerItem3, 0, 1, 1, 2)        
+        duration = MySpinBox(current_value, COMMON_SETTINGS, CLIENT, "self.request_timeout", groupbox_client)            
+        duration.setValue(current_value)
+        duration.setMinimum(0)
+        duration.setMaximum(100)
+        duration.setSingleStep(1) 
+        grid_groupbox_client.addWidget(duration, 0, 2, 1, 2)
+         
+        current_value = searchAndGet(COMMON_SETTINGS, CLIENT, "self.initial")                
+        label_4 = QtGui.QLabel(groupbox_client)
+        label_4.setText("Initial assignment")
+        grid_groupbox_client.addWidget(label_4, 1, 0, 1, 2)       
+        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_client.addItem(spacerItem4, 1, 1, 1, 2)        
+        lineEdit_4 = MyLineEdit(current_value, COMMON_SETTINGS, CLIENT, "self.initial", groupbox_client)
+        lineEdit_4.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)        
+        lineEdit_4.setText(current_value)
+        grid_groupbox_client.addWidget(lineEdit_4, 1, 2, 1, 2)
+
+        current_value = searchAndGet(COMMON_SETTINGS, CLIENT, "self.start_action")
+        label_5 = QtGui.QLabel(groupbox_client)
+        label_5.setText("Start action")        
+        grid_groupbox_client.addWidget(label_5, 2, 0, 1, 2)  
+        spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_client.addItem(spacerItem5, 2, 1, 1, 2)        
+        lineEdit_5 = MyLineEdit(current_value, COMMON_SETTINGS, CLIENT, "self.start_action", groupbox_client)
+        lineEdit_5.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        lineEdit_5.setText(current_value)        
+        grid_groupbox_client.addWidget(lineEdit_5, 2, 2, 1, 2)
+
+        # --- Server content --- #
+        server.setGeometry(QtCore.QRect(0, 0, 660, 386))                
+        hbox_server = QtGui.QHBoxLayout(server)        
+        groupbox_server = QtGui.QGroupBox()      
+        groupbox_server.setTitle("Common server setting")
+        hbox_server.addWidget(groupbox_server)        
+        grid_groupbox_server = QtGui.QGridLayout()                        
+        hbox_groupbox_server = QtGui.QHBoxLayout(groupbox_server)
+        hbox_groupbox_server.addLayout(grid_groupbox_server)
+
+        current_value = searchAndGet(COMMON_SETTINGS, DESCRIPTION, "self.server_address")
+        label_1 = QtGui.QLabel(groupbox_server)
+        label_1.setText("server address")
+        grid_groupbox_server.addWidget(label_1, 0, 0, 1, 2)         
+        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_server.addItem(spacerItem1, 0, 1, 1, 2)        
+        lineEdit_1 = MyLineEdit(current_value, COMMON_SETTINGS, DESCRIPTION, "self.server_address", groupbox_server)
+        lineEdit_1.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        lineEdit_1.setText(current_value)        
+        grid_groupbox_server.addWidget(lineEdit_1, 0, 2, 1, 2)
+
+        current_value = int(searchAndGet(COMMON_SETTINGS, DESCRIPTION, "self.server_port"))
+        label_2 = QtGui.QLabel(groupbox_server)
+        label_2.setText("server port")
+        grid_groupbox_server.addWidget(label_2, 1, 0, 1, 2)           
+        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_server.addItem(spacerItem2, 1, 1, 1, 2)        
+        port = MySpinBox(current_value, COMMON_SETTINGS, DESCRIPTION, "self.server_port", groupbox_server)            
+        port.setValue(current_value)
+        port.setMinimum(0)
+        port.setMaximum(100)
+        port.setSingleStep(1) 
+        grid_groupbox_server.addWidget(port, 1, 2, 1, 2)
+
+        current_value = int(searchAndGet(COMMON_SETTINGS, SERVER, "self.request_timeout"))
+        label_3 = QtGui.QLabel(groupbox_server)
+        label_3.setText("Request timeout")        
+        grid_groupbox_server.addWidget(label_3, 2, 0, 1, 2)    
+        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_server.addItem(spacerItem3, 2, 1, 1, 2)        
+        time_out = MySpinBox(current_value, COMMON_SETTINGS, SERVER, "self.request_timeout", groupbox_server)    
+        time_out.setValue(current_value)
+        time_out.setMinimum(0)
+        time_out.setMaximum(100)
+        time_out.setSingleStep(1)            
+        grid_groupbox_server.addWidget(time_out, 2, 2, 1, 2)
+
+        current_value = searchAndGet(COMMON_SETTINGS, SERVER, "self.initial")  
+        label_4 = QtGui.QLabel(groupbox_server)
+        label_4.setText("Initial assignment")
+        grid_groupbox_server.addWidget(label_4, 3, 0, 1, 2)   
+        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_server.addItem(spacerItem4, 3, 1, 1, 2)        
+        lineEdit_4 = MyLineEdit(current_value, COMMON_SETTINGS, SERVER, "self.initial", groupbox_server)
+        lineEdit_4.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)        
+        lineEdit_4.setText(current_value)
+        grid_groupbox_server.addWidget(lineEdit_4, 3, 2, 1, 2)
+
+        current_value = searchAndGet(COMMON_SETTINGS, SERVER, "self.start_action")
+        label_5 = QtGui.QLabel(groupbox_server)
+        label_5.setText("Start action")        
+        grid_groupbox_server.addWidget(label_5, 4, 0, 1, 2) 
+        spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_server.addItem(spacerItem5, 4, 1, 1, 2)        
+        lineEdit_5 = MyLineEdit(current_value, COMMON_SETTINGS, SERVER, "self.start_action", groupbox_server)
+        lineEdit_5.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        lineEdit_5.setText(current_value)        
+        grid_groupbox_server.addWidget(lineEdit_5, 4, 2, 1, 2)
+
+        current_value = searchAndGet(COMMON_SETTINGS, SERVER, "self.master_password")
+        label_6 = QtGui.QLabel(groupbox_server)
+        label_6.setText("Master password")        
+        grid_groupbox_server.addWidget(label_6, 5, 0, 1, 2)    
+        spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_server.addItem(spacerItem6, 5, 1, 1, 2)        
+        lineEdit_6 = MyLineEdit(current_value, COMMON_SETTINGS, SERVER, "self.master_password", groupbox_server)
+        lineEdit_6.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        lineEdit_6.setText(current_value)        
+        grid_groupbox_server.addWidget(lineEdit_6, 5, 2, 1, 2)
+
+        # --- Botmaster content --- #
+        botmaster.setGeometry(QtCore.QRect(0, 0, 660, 386))                
+        hbox_botmaster = QtGui.QHBoxLayout(botmaster)        
+        groupbox_botmaster = QtGui.QGroupBox()      
+        groupbox_botmaster.setTitle("Common botmaster setting")
+        hbox_botmaster.addWidget(groupbox_botmaster)        
+        grid_groupbox_botmaster = QtGui.QGridLayout()                        
+        hbox_groupbox_botmaster = QtGui.QHBoxLayout(groupbox_botmaster)
+        hbox_groupbox_botmaster.addLayout(grid_groupbox_botmaster)
+                 
+        current_value = int(searchAndGet(COMMON_SETTINGS, BOTMASTER, "self.interval"))
+        label_2 = QtGui.QLabel(groupbox_botmaster)
+        label_2.setText("interval between commands")
+        grid_groupbox_botmaster.addWidget(label_2, 0, 0, 1, 2)       
+        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_botmaster.addItem(spacerItem2, 0, 1, 1, 2)        
+        interval = MySpinBox(current_value, COMMON_SETTINGS, BOTMASTER, "self.interval", groupbox_botmaster)       
+        interval.setValue(current_value)
+        interval.setMinimum(0)
+        interval.setMaximum(9999)
+        interval.setSingleStep(1)      
+        grid_groupbox_botmaster.addWidget(interval, 0, 2, 1, 2)
+
+        current_value = int(searchAndGet(COMMON_SETTINGS, BOTMASTER, "self.request_timeout"))
+        label_3 = QtGui.QLabel(groupbox_botmaster)
+        label_3.setText("Request timeout")        
+        grid_groupbox_botmaster.addWidget(label_3, 1, 0, 1, 2)       
+        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_botmaster.addItem(spacerItem3, 1, 1, 1, 2)        
+        timeout = MySpinBox(current_value, COMMON_SETTINGS, BOTMASTER, "self.request_timeout", groupbox_botmaster)
+        timeout.setValue(current_value)
+        timeout.setMinimum(0)
+        timeout.setMaximum(20)
+        timeout.setSingleStep(1)      
+        grid_groupbox_botmaster.addWidget(timeout, 1, 2, 1, 2)
+         
+        current_value = searchAndGet(COMMON_SETTINGS, BOTMASTER, "self.initial")
+        label_4 = QtGui.QLabel(groupbox_botmaster)
+        label_4.setText("Initial assignment")
+        grid_groupbox_botmaster.addWidget(label_4, 2, 0, 1, 2)        
+        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_botmaster.addItem(spacerItem4, 2, 1, 1, 2)        
+        lineEdit_4 = MyLineEdit(current_value, COMMON_SETTINGS, BOTMASTER, "self.initial", groupbox_botmaster)
+        lineEdit_4.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)        
+        lineEdit_4.setText(current_value)
+        grid_groupbox_botmaster.addWidget(lineEdit_4, 2, 2, 1, 2)
+
+        current_value = searchAndGet(COMMON_SETTINGS, BOTMASTER, "self.start_action")
+        label_5 = QtGui.QLabel(groupbox_botmaster)
+        label_5.setText("Start action")        
+        grid_groupbox_botmaster.addWidget(label_5, 3, 0, 1, 2)  
+        spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_botmaster.addItem(spacerItem5, 3, 1, 1, 2)        
+        lineEdit_5 = MyLineEdit(current_value, COMMON_SETTINGS, BOTMASTER, "self.start_action", groupbox_botmaster)
+        lineEdit_5.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        lineEdit_5.setText(current_value)        
+        grid_groupbox_botmaster.addWidget(lineEdit_5, 3, 2, 1, 2)
+
+        current_value = searchAndGet(COMMON_SETTINGS, BOTMASTER, "self.master_password")
+        label_6 = QtGui.QLabel(groupbox_botmaster)
+        label_6.setText("Master password")        
+        grid_groupbox_botmaster.addWidget(label_6, 4, 0, 1, 2)    
+        spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_botmaster.addItem(spacerItem6, 4, 1, 1, 2)        
+        lineEdit_6 = MyLineEdit(current_value, COMMON_SETTINGS, BOTMASTER, "self.master_password", groupbox_botmaster)
+        lineEdit_6.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
+        lineEdit_6.setText(current_value)        
+        grid_groupbox_botmaster.addWidget(lineEdit_6, 4, 2, 1, 2)
+
+        current_value = int(searchAndGet(COMMON_SETTINGS, BOTMASTER, "self.num_commands"))
+        label_7 = QtGui.QLabel(groupbox_botmaster)
+        label_7.setText("Number of commands")        
+        grid_groupbox_botmaster.addWidget(label_7, 5, 0, 1, 2)        
+        spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+        grid_groupbox_botmaster.addItem(spacerItem6, 5, 1, 1, 2)        
+        num_commands = MySpinBox(current_value, COMMON_SETTINGS, BOTMASTER, "self.num_commands", groupbox_botmaster)          
+        num_commands.setValue(current_value)
+        num_commands.setMinimum(0)
+        num_commands.setMaximum(9999)
+        num_commands.setSingleStep(1)      
+        grid_groupbox_botmaster.addWidget(num_commands, 5, 2, 1, 2)    
+
+        self.setWindowTitle("IMALSE")
+        self.show()
+
+    def modeSelected(self, text):            
+        self.statusBar().showMessage(text + ' was pressed')
+
+        if (text == "Emulation"):
+         self.hideAllModes()
+         self.hideAllExperiments()
+         self.groupbox_emulation.show()                    
+         return
+
+        if (text == "Netns3 Simulation"):
+         self.hideAllModes()
+         self.hideAllExperiments()
+         self.groupbox_netns3.show()                                 
+         return
+
+        if (text == "Pure Simulation"):
+         self.hideAllModes()
+         self.hideAllExperiments()
+         self.groupbox_pure.show()             
+         return
+     
+    def experimentSelected(self, text):
+        if (text == "Complex Network Experiment"):
+            self.hideAllExperiments()
+            self.groupbox_complex_network.show()
+            return
+
+        if (text == "Manual Topology Background Traffic Experiment"):
+            self.hideAllExperiments()
+            self.groupbox_manual_topo_bt.show()
+            return    
+
+        if (text == "Manual Topology Experiment"):
+            self.hideAllExperiments()
+            self.groupbox_manual_topo.show()
+            return
+
+        if (text == "Static Route Experiment"):
+            self.hideAllExperiments()
+            self.groupbox_static_route.show()
+            return
+
+        if (text == "Topology Experiment"):
+            self.hideAllExperiments()
+            self.groupbox_topo.show()
+            return
+ 
+    def hideAllModes(self):
+        self.groupbox_emulation.hide()
+        self.groupbox_netns3.hide()  
+        self.groupbox_pure.hide()
+         
+    def hideAllExperiments(self):
+        self.groupbox_complex_network.hide()
+        self.groupbox_manual_topo_bt.hide()
+        self.groupbox_manual_topo.hide()
+        self.groupbox_topo.hide()
+        self.groupbox_static_route.hide()  
+        
+def main():
+    
+    app = QtGui.QApplication(sys.argv)
+    ex = Ui_MainWindow()
+    sys.exit(app.exec_())
+
+if __name__ == '__main__':
+    main()
+

net_config/aro_demo/net_settings.py

 client_id_set = [  ]
 server_id_set = [  ]
 server_addr = [  ]
+target_id = [ ]
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>700</width>
+    <height>616</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <item>
+     <widget class="QTabWidget" name="tabWidget">
+      <widget class="QWidget" name="ddos_flooding">
+       <attribute name="title">
+        <string>DDOS Flooding</string>
+       </attribute>
+       <layout class="QGridLayout" name="gridLayout_2">
+        <item row="0" column="1">
+         <widget class="QToolBox" name="toolBox">
+          <property name="currentIndex">
+           <number>1</number>
+          </property>
+          <widget class="QWidget" name="mode">
+           <property name="geometry">
+            <rect>
+             <x>0</x>
+             <y>0</y>
+             <width>660</width>
+             <height>386</height>
+            </rect>
+           </property>
+           <attribute name="label">
+            <string>Mode</string>
+           </attribute>
+           <widget class="QWidget" name="">
+            <property name="geometry">
+             <rect>
+              <x>0</x>
+              <y>0</y>
+              <width>190</width>
+              <height>27</height>
+             </rect>
+            </property>
+            <layout class="QGridLayout" name="gridLayout">
+             <item row="0" column="0">
+              <widget class="QLabel" name="label">
+               <property name="text">
+                <string>TextLabel</string>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="1">
+              <spacer name="horizontalSpacer">
+               <property name="orientation">
+                <enum>Qt::Horizontal</enum>
+               </property>
+               <property name="sizeHint" stdset="0">
+                <size>
+                 <width>40</width>
+                 <height>20</height>
+                </size>
+               </property>
+              </spacer>
+             </item>
+             <item row="0" column="2">
+              <widget class="QComboBox" name="comboBox"/>
+             </item>
+            </layout>
+           </widget>
+          </widget>
+          <widget class="QWidget" name="client">
+           <property name="geometry">
+            <rect>
+             <x>0</x>
+             <y>0</y>
+             <width>660</width>
+             <height>386</height>
+            </rect>
+           </property>
+           <attribute name="label">
+            <string>Client</string>
+           </attribute>
+           <layout class="QHBoxLayout" name="horizontalLayout_3">
+            <item>
+             <widget class="QGroupBox" name="commonClientSettings">
+              <property name="autoFillBackground">
+               <bool>false</bool>