Browse Source

Fix bug in CommunicationProcessor and remove print in MembersMgmtCommAttack

dustin.born 7 years ago
parent
commit
4ff983aa04
2 changed files with 9 additions and 8 deletions
  1. 2 2
      code/Attack/MembersMgmtCommAttack.py
  2. 7 6
      code/ID2TLib/CommunicationProcessor.py

+ 2 - 2
code/Attack/MembersMgmtCommAttack.py

@@ -365,8 +365,8 @@ class MembersMgmtCommAttack(BaseAttack.BaseAttack):
         final_messages = []
         new_id = 0
         for msg in messages:
-            print(msg)
-            print(mapped_ids.keys())
+            #print(msg)
+            #print(mapped_ids.keys())
             type_src, type_dst = bot_configs[msg.src]["Type"], bot_configs[msg.dst]["Type"]
             id_src, id_dst = msg.src, msg.dst
 

+ 7 - 6
code/ID2TLib/CommunicationProcessor.py

@@ -320,6 +320,7 @@ class CommunicationProcessor():
         id_comms = self.id_comms
         external_ids = set()
         local_ids = set()
+        ids = self.ids
 
         def map_init_is_local(id_:str):
             """
@@ -327,13 +328,13 @@ class CommunicationProcessor():
             """
             # loop over all communication entries
             for id_comm in id_comms:
+                ids = id_comm.split("-")
+                other = ids[0] if id_ == ids[1] else ids[1]
+
                 # if id_comm does not contain the ID to be mapped, continue
                 if not (id_ == ids[0] or id_ == ids[1]):
                     continue
 
-                ids = id_comm.split("-")
-                other = ids[0] if id_ == ids[1] else ids[1] 
-
                 # if other is already mapped, continue
                 if other in local_ids or other in external_ids:
                     continue 
@@ -357,13 +358,13 @@ class CommunicationProcessor():
             Map the given ID as external and handle its communication partners' locality
             """
             for id_comm in id_comms:
+                ids = id_comm.split("-")
+                other = ids[0] if id_ == ids[1] else ids[1] 
+
                 # if id_comm does not contain the ID to be mapped, continue
                 if not (id_ == ids[0] or id_ == ids[1]):
                     continue
 
-                ids = id_comm.split("-")
-                other = ids[0] if id_ == ids[1] else ids[1] 
-
                 # if other is already mapped, continue
                 if other in local_ids or other in external_ids:
                     continue