瀏覽代碼

small enhancements

Roey Regev 6 年之前
父節點
當前提交
abb0c8af3f
共有 4 個文件被更改,包括 24 次插入24 次删除
  1. 19 0
      code/Attack/BaseAttack.py
  2. 2 2
      code/Attack/DDoSAttack.py
  3. 3 3
      code/Attack/EternalBlueExploit.py
  4. 0 19
      code/ID2TLib/Label.py

+ 19 - 0
code/Attack/BaseAttack.py

@@ -672,11 +672,21 @@ class BaseAttack(metaclass=abc.ABCMeta):
         """
 
         def is_invalid(ip_address_param: ipaddress.IPv4Address):
+            """
+            TODO FILL ME
+            :param ip_address_param:
+            :return:
+            """
             return ip_address_param.is_multicast or ip_address_param.is_unspecified or ip_address_param.is_loopback or \
                    ip_address_param.is_link_local or ip_address_param.is_reserved or ip_address_param.is_private
 
         # Generate a random IP from specific class
         def generate_address(ip_class_param):
+            """
+            TODO FILL ME
+            :param ip_class_param:
+            :return:
+            """
             if ip_class_param == "Unknown":
                 return ipaddress.IPv4Address(random.randint(0, 2 ** 32 - 1))
             else:
@@ -718,10 +728,19 @@ class BaseAttack(metaclass=abc.ABCMeta):
         """
 
         def is_invalid(ip_address: ipaddress.IPv6Address):
+            """
+            TODO FILL ME
+            :param ip_address:
+            :return:
+            """
             return ip_address.is_multicast or ip_address.is_unspecified or ip_address.is_loopback or \
                    ip_address.is_link_local or ip_address.is_private or ip_address.is_reserved
 
         def generate_address():
+            """
+            TODO FILL ME
+            :return:
+            """
             return ipaddress.IPv6Address(random.randint(0, 2 ** 128 - 1))
 
         ip_addresses = []

+ 2 - 2
code/Attack/DDoSAttack.py

@@ -288,9 +288,9 @@ class DDoSAttack(BaseAttack.BaseAttack):
 
     def generate_attack_pcap(self):
         """
-                Creates a pcap containing the attack packets.
+        Creates a pcap containing the attack packets.
 
-                :return: The location of the generated pcap file.
+        :return: The location of the generated pcap file.
         """
         if len(self.packets) > 0:
             self.packets = sorted(self.packets, key=lambda pkt: pkt.time)

+ 3 - 3
code/Attack/EternalBlueExploit.py

@@ -80,7 +80,7 @@ class EternalBlueExploit(BaseAttack.BaseAttack):
 
     def generate_attack_packets(self):
         """
-                Creates the attack packets.
+        Creates the attack packets.
         """
         # Timestamp
         timestamp_next_pkt = self.get_param_value(atkParam.Parameter.INJECT_AT_TIMESTAMP)
@@ -315,9 +315,9 @@ class EternalBlueExploit(BaseAttack.BaseAttack):
 
     def generate_attack_pcap(self):
         """
-                Creates a pcap containing the attack packets.
+        Creates a pcap containing the attack packets.
 
-                :return: The location of the generated pcap file.
+        :return: The location of the generated pcap file.
         """
         # Store timestamp of first packet (for attack label)
         self.attack_start_utime = self.packets[0].time

+ 0 - 19
code/ID2TLib/Label.py

@@ -21,34 +21,15 @@ class Label:
         self.parameters = parameters
 
     def __eq__(self, other):
-        """
-        TODO: FILL ME
-        :param other:
-        :return:
-        """
         return self.timestamp == other.timestamp
 
     def __lt__(self, other):
-        """
-        TODO: FILL ME
-        :param other:
-        :return:
-        """
         return self.timestamp_start < other.timestamp_start
 
     def __gt__(self, other):
-        """
-        TODO: FILL ME
-        :param other:
-        :return:
-        """
         return self.timestamp_start > other.timestamp_start
 
     def __str__(self):
-        """
-        TODO: FILL ME
-        :return:
-        """
         return ''.join(
             ['(', self.attack_name, ',', self.attack_note, ',', str(self.timestamp_start), ',', str(self.timestamp_end),
              ')'])