Пример #1
0
    def __init__(self):
        """
        Creates a new instance of the DDoS attack.
        """
        # Initialize attack
        super(DDoSAttack,
              self).__init__("DDoS Attack", "Injects a DDoS attack'",
                             "Resource Exhaustion")

        self.total_pkt_num = 0
        self.default_port = 0

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.PORT_SOURCE, Port()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.PORT_DESTINATION, Port()),
            Parameter(self.PACKETS_PER_SECOND, Float()),
            Parameter(self.NUMBER_ATTACKERS, IntegerPositive()),
            Parameter(self.ATTACK_DURATION, IntegerPositive()),
            Parameter(self.VICTIM_BUFFER, IntegerPositive()),
            Parameter(self.LATENCY_MAX, Float())
        ])
Пример #2
0
    def __init__(self):
        """
        Creates a new instance of the SMBScanAttack.
        This Attack injects TCP Syn Requests to the port 445 of several ips and related response into the output
        pcap file.
        If port 445 is open, it will simulate and inject the SMB Protocol Negotiation too.
        """
        # Initialize attack
        super(SMBScanAttack,
              self).__init__("SMBScan Attack", "Injects an SMB scan",
                             "Scanning/Probing")

        self.host_os = Util.get_rnd_os()

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.TARGET_COUNT, IntegerPositive()),
            Parameter(self.HOSTING_PERCENTAGE, Percentage()),
            Parameter(self.PORT_SOURCE, Port()),
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.IP_SOURCE_RANDOMIZE, Boolean()),
            Parameter(self.PACKETS_PER_SECOND, Float()),
            Parameter(self.PORT_SOURCE_RANDOMIZE, Boolean()),
            Parameter(self.HOSTING_IP, IPAddress()),
            Parameter(self.HOSTING_VERSION, String()),
            Parameter(self.SOURCE_PLATFORM, SpecificString(Util.platforms)),
            Parameter(self.PROTOCOL_VERSION, String())
        ])
Пример #3
0
    def __init__(self):
        """
        Creates a new instance of the PortscanAttack.
        This attack injects TCP Syn-requests and respective responses into the output pcap file.
        """
        # Initialize attack
        super(PortscanAttack, self).__init__("Portscan Attack",
                                             "Injects a nmap 'regular scan'",
                                             "Scanning/Probing")

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.PORT_SOURCE, Port()),
            Parameter(self.PORT_DESTINATION, Port()),
            Parameter(self.PORT_OPEN, Port()),
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.PORT_DEST_SHUFFLE, Boolean()),
            Parameter(self.PORT_DEST_ORDER_DESC, Boolean()),
            Parameter(self.IP_SOURCE_RANDOMIZE, Boolean()),
            Parameter(self.PACKETS_PER_SECOND, Float()),
            Parameter(self.PORT_SOURCE_RANDOMIZE, Boolean())
        ])
Пример #4
0
    def __init__(self):
        """
        Creates a new instance of the Membership Management Communication.

        """
        # Initialize communication
        super(P2PBotnet, self).__init__("P2P Botnet Communication (P2PBotnet)",
                                        "Injects P2P Botnet Communication",
                                        "Botnet communication")

        # Define allowed parameters and their type
        self.update_params([
            # parameters regarding attack
            Parameter(self.PACKETS_LIMIT, IntegerPositive()),
            Parameter(self.ATTACK_DURATION, IntegerPositive()),

            # use num_attackers to specify number of communicating devices?
            Parameter(self.NUMBER_INITIATOR_BOTS, IntegerPositive()),

            # input file containing botnet communication
            Parameter(self.FILE_CSV, FilePath()),
            Parameter(self.FILE_XML, FilePath()),

            # the percentage of IP reuse (if total and other is specified, percentages are multiplied)
            Parameter(self.IP_REUSE_TOTAL, Percentage()),
            Parameter(self.IP_REUSE_LOCAL, Percentage()),
            Parameter(self.IP_REUSE_EXTERNAL, Percentage()),
            Parameter(self.INJECT_INTO_IPS, IPAddress()),

            # the user-selected padding to add to every packet
            Parameter(self.PACKET_PADDING, IntegerLimited([0, 100])),

            # presence of NAT at the gateway of the network
            Parameter(self.NAT_PRESENT, Boolean()),

            # whether the TTL distribution should be based on the input PCAP
            # or the CAIDA dataset
            Parameter(self.TTL_FROM_CAIDA, Boolean()),

            # whether the destination port of a response should be the ephemeral port
            # its request came from or a static (server)port based on a hostname
            Parameter(self.MULTIPORT, Boolean()),

            # information about the interval selection strategy
            Parameter(self.INTERVAL_SELECT_STRATEGY,
                      SpecificString(["random", "optimal", "custom"])),
            Parameter(self.INTERVAL_SELECT_START, IntegerPositive()),
            Parameter(self.INTERVAL_SELECT_END, IntegerPositive()),

            # determines whether injected packets are marked with an unused IP option
            # to easily filter them in e.g. wireshark
            Parameter(self.HIDDEN_MARK, Boolean())
        ])

        # create dict with MessageType values for fast name lookup
        self.msg_types = {}
        for msg_type in Bmsg.MessageType:
            self.msg_types[msg_type.value] = msg_type

        self.DEFAULT_XML_PATH = None
Пример #5
0
    def __init__(self):
        """
        Creates a new instance of the "Memcrashed" Memcached amplification attack.
        """
        # Initialize attack
        super(MemcrashedSpooferAttack, self).__init__("Memcrashed Attack (Spoofer side)",
                                                      "Injects the spoofer-side of a Memcached amplification attack",
                                                      "Resource Exhaustion")

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.PACKETS_PER_SECOND, Float()),
            Parameter(self.ATTACK_DURATION, IntegerPositive()),
            Parameter(self.IP_VICTIM, IPAddress()),
            Parameter(self.ATTACK_DURATION, IntegerPositive())
        ])
Пример #6
0
    def __init__(self):
        """
        Creates a new instance of the SQLi Attack.
        """
        # Initialize attack
        super(SQLiAttack, self).__init__("SQLi Attack", "Injects a SQLi attack'",
                                         "Privilege elevation")

        self.pkt_num = 0
        self.path_attack_pcap = None

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.PORT_DESTINATION, Port()),
            Parameter(self.TARGET_HOST, Domain()),
            Parameter(self.PACKETS_PER_SECOND, Float())
        ])
Пример #7
0
    def __init__(self):
        """
        Creates a new instance of the EternalBlue Exploit.
        """
        # Initialize attack
        super(MS17ScanAttack,
              self).__init__("MS17ScanAttack", "Injects a MS17 scan'",
                             "Scanning/Probing")

        self.pkt_num = 0
        self.path_attack_pcap = None

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.PORT_SOURCE, Port()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.PORT_DESTINATION, Port()),
            Parameter(self.PACKETS_PER_SECOND, Float())
        ])
Пример #8
0
    def __init__(self):
        """
        Creates a new instance of the FTPExploit.
        This attack injects a buffer overflow for the WinaXe FTP-client into the output pcap file.
        """
        # Initialize attack
        super(FTPWinaXeExploit,
              self).__init__("FTPWinaXe Exploit",
                             "Injects a WinaXe 7.7 FTP buffer overflow.",
                             "Privilege elevation")

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.IP_SOURCE_RANDOMIZE, Boolean()),
            Parameter(self.PACKETS_PER_SECOND, Float()),
            Parameter(self.CUSTOM_PAYLOAD, String()),
            Parameter(self.CUSTOM_PAYLOAD_FILE, FilePath())
        ])
Пример #9
0
    def __init__(self):
        """
        Creates a new instance of the SMBLorisAttack.
        This attack injects special SMB-packets, which exploit the SMBLoris DoS vulnerability, into the output pcap
        file.
        """
        # Initialize attack
        super(SMBLorisAttack,
              self).__init__("SMBLoris Attack",
                             "Injects an SMBLoris (D)DoS Attack",
                             "Resource Exhaustion")

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.PACKETS_PER_SECOND, Float()),
            Parameter(self.ATTACK_DURATION, IntegerPositive()),
            Parameter(self.NUMBER_ATTACKERS, IntegerPositive()),
        ])
Пример #10
0
    def __init__(self):
        """
        Creates a new instance of the EternalBlue Exploit.
        """
        # Initialize attack
        super(EternalBlueExploit,
              self).__init__("EternalBlue Exploit",
                             "Injects an EternalBlue exploit'",
                             "Privilege elevation")

        self.pkt_num = 0
        self.path_attack_pcap = None

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.PORT_SOURCE, Port()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.PORT_DESTINATION, Port()),
            Parameter(self.PACKETS_PER_SECOND, Float())
        ])
Пример #11
0
    def __init__(self):
        """
        Creates a new instance of the Joomla Registeration Privileges Escalation Exploit.
        """
        # Initialize attack
        super(JoomlaRegPrivExploit,
              self).__init__("JoomlaRegPrivesc Exploit",
                             "Injects an JoomlaRegPrivesc exploit'",
                             "Privilege elevation")

        self.pkt_num = 0
        self.path_attack_pcap = None

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.MAC_DESTINATION, MACAddress()),
            Parameter(self.IP_DESTINATION, IPAddress()),
            Parameter(self.PORT_DESTINATION, Port()),
            Parameter(self.TARGET_HOST, Domain()),
            Parameter(self.PACKETS_PER_SECOND, Float())
        ])
Пример #12
0
    def __init__(self):
        """
        Creates a new instance of the Sality botnet.
        """
        # Initialize attack
        super(SalityBotnet,
              self).__init__("Sality Botnet", "Injects an Sality botnet'",
                             "Botnet")

        self.pkt_num = 0
        self.path_attack_pcap = None

        # Define allowed parameters and their type
        self.update_params([
            Parameter(self.MAC_SOURCE, MACAddress()),
            Parameter(self.IP_SOURCE, IPAddress()),
            Parameter(self.PACKETS_PER_SECOND, Float())
        ])
Пример #13
0
 def test_generate_random_ipv6_address(self):
     ip_list = BAtk.BaseAttack.generate_random_ipv6_address(10)
     for ip in ip_list:
         with self.subTest(ip=ip):
             self.assertTrue(IPAddress._is_ip_address(ip))
Пример #14
0
 def test_is_ip_address_v4_valid(self):
     self.assertTrue(IPAddress._is_ip_address("192.168.178.1")[0])
Пример #15
0
 def test_is_ip_address_v4_invalid(self):
     self.assertFalse(IPAddress._is_ip_address("192.1689.178.1")[0])
Пример #16
0
 def test_is_ip_address_v6_invalid(self):
     self.assertFalse(
         IPAddress._is_ip_address(
             "2001:0db8:85a3:08d3X:1319:8a2e:0370:7344")[0])
Пример #17
0
 def test_is_ip_address_empty(self):
     self.assertFalse(IPAddress._is_ip_address("")[0])
Пример #18
0
 def test_is_ip_address_v6_shortened_valid(self):
     self.assertTrue(
         IPAddress._is_ip_address("2001:0db8:85a3:08d3:1319::0370:7344")[0])
Пример #19
0
 def test_is_ip_address_comma_list_invalid(self):
     self.assertFalse(
         IPAddress._is_ip_address("192.168.178.1,192.1689.178.10")[0])
Пример #20
0
 def test_is_ip_address_list_invalid(self):
     self.assertFalse(
         IPAddress._is_ip_address(["192.1689.178.1", "192.168.178.10"])[0])
Пример #21
0
 def test_is_ip_address_v6_shortened_invalid(self):
     self.assertFalse(
         IPAddress._is_ip_address("2001::85a3:08d3X::8a2e:0370:7344")[0])