123456789101112131415161718192021222324252627 |
- import xml.etree.ElementTree as ET
- import csv
- def parse_csv(file: str):
-
- root = ET.Element("mmcommunication")
-
- with open(file) as csvFile:
- reader = csv.reader(csvFile, delimiter=",")
-
- for line in reader:
- packet = ET.SubElement(root, "packet")
- for element in line:
- element = element.replace(" ", "")
- splitel = element.split(":")
- key, value = splitel[0], splitel[1]
- packet.attrib[key] = value
-
- tree = ET.ElementTree(root)
- tree.write("ExampleCSVBotnetCommunication.xml")
- parse_csv("ExampleCSVBotnetCommunication.txt")
|