|
@@ -9,7 +9,7 @@ from definitions import ROOT_DIR
|
|
|
from Attack import BaseAttack
|
|
|
from Attack.AttackParameters import Parameter as Param
|
|
|
from Attack.AttackParameters import ParameterTypes
|
|
|
-from ID2TLib.Utility import update_timestamp, get_interval_pps
|
|
|
+from ID2TLib.Utility import update_timestamp, get_interval_pps, handle_most_used_outputs
|
|
|
|
|
|
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
|
|
|
|
|
@@ -55,8 +55,6 @@ class PortscanAttack(BaseAttack.BaseAttack):
|
|
|
|
|
|
|
|
|
most_used_ip_address = self.statistics.get_most_used_ip_address()
|
|
|
- if isinstance(most_used_ip_address, list):
|
|
|
- most_used_ip_address = most_used_ip_address[0]
|
|
|
|
|
|
self.add_param_value(Param.IP_SOURCE, most_used_ip_address)
|
|
|
self.add_param_value(Param.IP_SOURCE_RANDOMIZE, 'False')
|
|
@@ -167,13 +165,13 @@ class PortscanAttack(BaseAttack.BaseAttack):
|
|
|
source_mss_prob_dict = Lea.fromValFreqsDict(source_mss_dist)
|
|
|
source_mss_value = source_mss_prob_dict.random()
|
|
|
else:
|
|
|
- source_mss_value = self.statistics.process_db_query("most_used(mssValue)")
|
|
|
+ source_mss_value = handle_most_used_outputs(self.statistics.process_db_query("most_used(mssValue)"))
|
|
|
destination_mss_dist = self.statistics.get_mss_distribution(ip_destination)
|
|
|
if len(destination_mss_dist) > 0:
|
|
|
destination_mss_prob_dict = Lea.fromValFreqsDict(destination_mss_dist)
|
|
|
destination_mss_value = destination_mss_prob_dict.random()
|
|
|
else:
|
|
|
- destination_mss_value = self.statistics.process_db_query("most_used(mssValue)")
|
|
|
+ destination_mss_value = handle_most_used_outputs(self.statistics.process_db_query("most_used(mssValue)"))
|
|
|
|
|
|
|
|
|
source_ttl_dist = self.statistics.get_ttl_distribution(ip_source)
|
|
@@ -181,13 +179,13 @@ class PortscanAttack(BaseAttack.BaseAttack):
|
|
|
source_ttl_prob_dict = Lea.fromValFreqsDict(source_ttl_dist)
|
|
|
source_ttl_value = source_ttl_prob_dict.random()
|
|
|
else:
|
|
|
- source_ttl_value = self.statistics.process_db_query("most_used(ttlValue)")
|
|
|
+ source_ttl_value = handle_most_used_outputs(self.statistics.process_db_query("most_used(ttlValue)"))
|
|
|
destination_ttl_dist = self.statistics.get_ttl_distribution(ip_destination)
|
|
|
if len(destination_ttl_dist) > 0:
|
|
|
destination_ttl_prob_dict = Lea.fromValFreqsDict(destination_ttl_dist)
|
|
|
destination_ttl_value = destination_ttl_prob_dict.random()
|
|
|
else:
|
|
|
- destination_ttl_value = self.statistics.process_db_query("most_used(ttlValue)")
|
|
|
+ destination_ttl_value = handle_most_used_outputs(self.statistics.process_db_query("most_used(ttlValue)"))
|
|
|
|
|
|
|
|
|
source_win_dist = self.statistics.get_win_distribution(ip_source)
|
|
@@ -195,13 +193,13 @@ class PortscanAttack(BaseAttack.BaseAttack):
|
|
|
source_win_prob_dict = Lea.fromValFreqsDict(source_win_dist)
|
|
|
source_win_value = source_win_prob_dict.random()
|
|
|
else:
|
|
|
- source_win_value = self.statistics.process_db_query("most_used(winSize)")
|
|
|
+ source_win_value = handle_most_used_outputs(self.statistics.process_db_query("most_used(winSize)"))
|
|
|
destination_win_dist = self.statistics.get_win_distribution(ip_destination)
|
|
|
if len(destination_win_dist) > 0:
|
|
|
destination_win_prob_dict = Lea.fromValFreqsDict(destination_win_dist)
|
|
|
destination_win_value = destination_win_prob_dict.random()
|
|
|
else:
|
|
|
- destination_win_value = self.statistics.process_db_query("most_used(winSize)")
|
|
|
+ destination_win_value = handle_most_used_outputs(self.statistics.process_db_query("most_used(winSize)"))
|
|
|
|
|
|
minDelay,maxDelay = self.get_reply_delay(ip_destination)
|
|
|
|