|
@@ -48,7 +48,7 @@ from Attack.AttackParameters import ParameterTypes
|
|
|
|
|
|
from ID2TLib import FileUtils, PaddingGenerator
|
|
|
from ID2TLib.PacketGenerator import PacketGenerator
|
|
|
-from ID2TLib.IPGenerator import IPGenerator
|
|
|
+from ID2TLib.IPGenerator import IPGenerator
|
|
|
from ID2TLib.PcapAddressOperations import PcapAddressOperations
|
|
|
from ID2TLib.CommunicationProcessor import CommunicationProcessor
|
|
|
from ID2TLib.MacAddressGenerator import MacAddressGenerator
|
|
@@ -259,7 +259,7 @@ class MembersMgmtCommAttack(BaseAttack.BaseAttack):
|
|
|
else:
|
|
|
return 0
|
|
|
|
|
|
- def assign_realistic_ttls(bot_configs):
|
|
|
+ def assign_realistic_ttls2(bot_configs):
|
|
|
# Gamma distribution parameters derived from MAWI 13.8G dataset
|
|
|
ids = sorted(bot_configs.keys())
|
|
|
alpha, loc, beta = (2.3261710235, -0.188306914406, 44.4853123884)
|
|
@@ -277,6 +277,31 @@ class MembersMgmtCommAttack(BaseAttack.BaseAttack):
|
|
|
pos = index_increment(pos, pos_max)
|
|
|
bot_configs[bot]["TTL"] = ttl
|
|
|
|
|
|
+
|
|
|
+ def assign_realistic_ttls(bot_configs):
|
|
|
+ '''
|
|
|
+ Assigns a realisitic ttl to each bot from @param: bot_configs. Uses statistics and distribution to be able
|
|
|
+ to calculate a realisitc ttl.
|
|
|
+ :param bot_configs:
|
|
|
+ :return:
|
|
|
+ '''
|
|
|
+ ids = sorted(bot_configs.keys())
|
|
|
+ for pos,bot in enumerate(ids):
|
|
|
+ #print(type(bot_configs))
|
|
|
+ # Set TTL based on TTL distribution of IP address
|
|
|
+ bot_ttl_dist = self.statistics.get_ttl_distribution(bot_configs[bot]["IP"])
|
|
|
+ if len(bot_ttl_dist) > 0:
|
|
|
+ source_ttl_prob_dict = Lea.fromValFreqsDict(bot_ttl_dist)
|
|
|
+ bot_configs[bot]["TTL"] = source_ttl_prob_dict.random()
|
|
|
+ else:
|
|
|
+ bot_configs[bot]["TTL"] = self.statistics.process_db_query("most_used(ttlValue)")
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
# parse input CSV or XML
|
|
|
filepath_xml = self.get_param_value(Param.FILE_XML)
|
|
|
filepath_csv = self.get_param_value(Param.FILE_CSV)
|