|
@@ -9,7 +9,7 @@ from Attack import BaseAttack
|
|
|
from Attack.AttackParameters import Parameter as Param
|
|
|
from Attack.AttackParameters import ParameterTypes
|
|
|
from ID2TLib.Utility import update_timestamp, generate_source_port_from_platform, get_rnd_x86_nop, forbidden_chars,\
|
|
|
- get_rnd_bytes , check_payload_len
|
|
|
+ get_rnd_bytes , check_payload_len, handle_most_used_outputs
|
|
|
|
|
|
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
|
|
|
# noinspection PyPep8
|
|
@@ -52,11 +52,9 @@ class FTPWinaXeExploit(BaseAttack.BaseAttack):
|
|
|
# PARAMETERS: initialize with default values
|
|
|
# (values are overwritten if user specifies them)
|
|
|
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]
|
|
|
|
|
|
# The most used IP class in background traffic
|
|
|
- most_used_ip_class = self.statistics.process_db_query("most_used(ipClass)")
|
|
|
+ most_used_ip_class = handle_most_used_outputs(self.statistics.process_db_query("most_used(ipClass)"))
|
|
|
attacker_ip = self.generate_random_ipv4_address(most_used_ip_class)
|
|
|
self.add_param_value(Param.IP_DESTINATION, attacker_ip)
|
|
|
self.add_param_value(Param.MAC_DESTINATION, self.generate_random_mac_address())
|
|
@@ -91,7 +89,7 @@ class FTPWinaXeExploit(BaseAttack.BaseAttack):
|
|
|
mss_prob_dict = Lea.fromValFreqsDict(mss_dist)
|
|
|
mss_value = mss_prob_dict.random()
|
|
|
else:
|
|
|
- mss_value = self.statistics.process_db_query("most_used(mssValue)")
|
|
|
+ mss_value = handle_most_used_outputs(self.statistics.process_db_query("most_used(mssValue)"))
|
|
|
|
|
|
# Set TTL based on TTL distribution of IP address
|
|
|
ttl_dist = self.statistics.get_ttl_distribution(ip_address)
|
|
@@ -99,7 +97,7 @@ class FTPWinaXeExploit(BaseAttack.BaseAttack):
|
|
|
ttl_prob_dict = Lea.fromValFreqsDict(ttl_dist)
|
|
|
ttl_value = ttl_prob_dict.random()
|
|
|
else:
|
|
|
- ttl_value = self.statistics.process_db_query("most_used(ttlValue)")
|
|
|
+ ttl_value = handle_most_used_outputs(self.statistics.process_db_query("most_used(ttlValue)"))
|
|
|
|
|
|
# Set Window Size based on Window Size distribution of IP address
|
|
|
win_dist = self.statistics.get_win_distribution(ip_address)
|
|
@@ -107,7 +105,7 @@ class FTPWinaXeExploit(BaseAttack.BaseAttack):
|
|
|
win_prob_dict = Lea.fromValFreqsDict(win_dist)
|
|
|
win_value = win_prob_dict.random()
|
|
|
else:
|
|
|
- win_value = self.statistics.process_db_query("most_used(winSize)")
|
|
|
+ win_value = handle_most_used_outputs(self.statistics.process_db_query("most_used(winSize)"))
|
|
|
|
|
|
return mss_value, ttl_value, win_value
|
|
|
|
|
@@ -134,7 +132,7 @@ class FTPWinaXeExploit(BaseAttack.BaseAttack):
|
|
|
# Create random victim if specified
|
|
|
if self.get_param_value(Param.IP_SOURCE_RANDOMIZE):
|
|
|
# The most used IP class in background traffic
|
|
|
- most_used_ip_class = self.statistics.process_db_query("most_used(ipClass)")
|
|
|
+ most_used_ip_class = handle_most_used_outputs(self.statistics.process_db_query("most_used(ipClass)"))
|
|
|
ip_victim = self.generate_random_ipv4_address(most_used_ip_class, 1)
|
|
|
mac_victim = self.generate_random_mac_address()
|
|
|
|