Przeglądaj źródła

Sort the messages in the mapping by injection time

dustin.born 6 lat temu
rodzic
commit
99f9faf23d
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      code/ID2TLib/Botnet/MessageMapping.py

+ 1 - 1
code/ID2TLib/Botnet/MessageMapping.py

@@ -30,7 +30,7 @@ class MessageMapping:
         mappings = doc.createElement(self.TAG_MAPPING_GROUP)
         doc.appendChild(mappings)
 
-        for message in self.messages:
+        for message in sorted(self.messages, key=lambda msg: msg.time):
             mapping = doc.createElement(self.TAG_MAPPING)
             mapping.setAttribute(self.ATTR_ID, str(message.msg_id))
             mapping.setAttribute(self.ATTR_LINENO, str(message.line_no))