Source

imalse / scenario / ddos_flooding / config.py

Full commit
"""

This file is used to configure the botmaster, clients and server in the file
exfiltration scenario.

"""

from core.cmd.description import ServerDescription, ClientDescription 
from core.cmd.description import BotmasterDescription

class Botmaster(BotmasterDescription):
    
    """
    
    This class is the subclass of the default botmaster description. The
    default settings are:
    
    server_address = '127.0.0.1'
    server_port = 3333
    request_timeout = 10
    initial = 'waiting'
    start_action = 'request_connect'
    self.master_password = '1234'
    self.interval = 2 
    self.num_commands = 1

	There are three types of flooding attacks:
    Ping flooding - PingFloodCmd
    Http get request flooding - HttpGetFloodCmd
    Tcp syn flooding - TcpSynFloodCmd
    
    """
    
    def __init__(self):
        """Initialize the botmaster description."""
        BotmasterDescription.__init__(self)
        self.command =PingFloodCmd()
        
class Client(ClientDescription):
    
    """
    
    This class is the subclass of the default client description. The
    default settings are:
    
    server_address = '127.0.0.1'
    server_port = 3333
    request_timeout = 10
    initial = 'disconn'
    start_action = 'request_connect'
    
    """
    
    def __init__(self):
        """Initialize the client description."""
        ClientDescription.__init__(self)
        
class Server(ServerDescription):
    
    """
    
    This class is the subclass of the default client description. The
    default settings are:
    
    server_address = '127.0.0.1'
    server_port = 3333
    request_timeout = 10    
    initial = 'waiting'
    start_action = 'initialize'
    self.master_password = '1234'
    
    """
    
    def __init__(self):
        """Initialize the server description."""
        ServerDescription.__init__(self)
        
class PingFloodCmd(object):
   
    """
    
    This class specifies the ping command that is send to the bots connected
    to the server.
    
    """
    
    def __init__(self):
        """Specify the settings here."""
        self.event = 'forward_to_bots'
        self.bot_event = 'ping_flood'
        self.hostname = '192.168.1.1'       
        
        self.packet_size = 56  
        self.interval = 0.0001
        self.verbose = True
        
        #Used in netns and emulation mode
        self.num_packets = 113 
    
        #Only used in emulation mode
        self.timeout = 104
       
        #Only used in netns mode
        self.preload = 15       
        
class HttpGetFloodCmd(object):
    """
    
    This class specifies the http get flood command that is send to the 
    bots connected to the server.
    
    """
    
    def __init__(self):
        """Specify the settings here."""
        self.event = 'forward_to_bots'
        self.bot_event = 'get_request_flood'
        self.hostname = 'google.com'
        self.port = 80
        self.num_requests = 10000
        self.num_threads = 10
        self.speed = 1   
        
class TcpSynFloodCmd(object):
    """
    
    This class specifies the tcp syn flood command that is send to the 
    bots connected to the server.
    
    """
    def __init__(self):         
        """Specify the settings here."""
        self.event = 'forward_to_bots'
        self.bot_event = 'syn_flood'
        self.hostname = '192.168.1.1'        
        self.port = 3333
        self.num_packets = 10000
        self.num_threads = 10