|
@@ -52,11 +52,23 @@ class Controller:
|
|
|
input dataset.
|
|
|
:param attacks_config: A list of attacks with their attack parameters.
|
|
|
"""
|
|
|
+ # note if new xml file has been created by MembersMgmtCommAttack
|
|
|
+ created_xml = None
|
|
|
# load attacks sequentially
|
|
|
for attack in attacks_config:
|
|
|
+ # check if new xml file has been created by MembersMgmtCommAttack
|
|
|
+ if attack[0] == "MembersMgmtCommAttack":
|
|
|
+ for param in attack[1:]:
|
|
|
+ key, value = param.split("=")
|
|
|
+ if key == "file.csv":
|
|
|
+ if os.path.isfile(value):
|
|
|
+ created_xml, _ = os.path.splitext(value)
|
|
|
+ created_xml += ".xml"
|
|
|
+ break
|
|
|
temp_attack_pcap = self.attack_controller.process_attack(attack[0], attack[1:])
|
|
|
self.written_pcaps.append(temp_attack_pcap)
|
|
|
|
|
|
+
|
|
|
# merge attack pcaps to get single attack pcap
|
|
|
if len(self.written_pcaps) > 1:
|
|
|
print("\nMerging temporary attack pcaps into single pcap file...", end=" ")
|
|
@@ -89,9 +101,21 @@ class Controller:
|
|
|
|
|
|
# write label file with attacks
|
|
|
self.label_manager.write_label_file(self.pcap_dest_path)
|
|
|
+ if created_xml:
|
|
|
+ pcap_dir = os.path.splitext(self.pcap_dest_path)[0]
|
|
|
+ if "/" in pcap_dir:
|
|
|
+ pcap_dir = "/".join(pcap_dir.split("/")[:-1])
|
|
|
+ xml_name = os.path.splitext(created_xml)[0] + ".xml"
|
|
|
+ if "/" in xml_name:
|
|
|
+ xml_name = xml_name.split("/")[-1]
|
|
|
+ new_xml_path = pcap_dir + "/" + xml_name
|
|
|
+ os.rename(created_xml, new_xml_path)
|
|
|
|
|
|
# print status message
|
|
|
- print('\nOutput files created: \n', self.pcap_dest_path, '\n', self.label_manager.label_file_path)
|
|
|
+ if created_xml:
|
|
|
+ print('\nOutput files created: \n', self.pcap_dest_path, '\n', self.label_manager.label_file_path, '\n', new_xml_path)
|
|
|
+ else:
|
|
|
+ print('\nOutput files created: \n', self.pcap_dest_path, '\n', self.label_manager.label_file_path)
|
|
|
|
|
|
def process_db_queries(self, query, print_results=False):
|
|
|
"""
|