Browse Source

Adding different computation for both local and external TTL

christof 7 years ago
parent
commit
fa7478fe42
1 changed files with 12 additions and 8 deletions
  1. 12 8
      code/Attack/MembersMgmtCommAttack.py

+ 12 - 8
code/Attack/MembersMgmtCommAttack.py

@@ -295,14 +295,18 @@ class MembersMgmtCommAttack(BaseAttack.BaseAttack):
             '''
             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)")
+                bot_type = bot_configs[bot]["Type"]
+                print(bot_type)
+                if(bot_type == "local"): # Set fix TTL for local Bots
+                    bot_configs[bot]["TTL"] = 128
+                    # Set TTL based on TTL distribution of IP address
+                else: # Set varying TTl for external Bots
+                    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