Selaa lähdekoodia

Merge branch 'develop' of https://git.tk.informatik.tu-darmstadt.de/leon.boeck/ID2T-toolkit-BotnetTraffic into develop

Joshua 7 vuotta sitten
vanhempi
commit
b51b2a53ac
1 muutettua tiedostoa jossa 15 lisäystä ja 0 poistoa
  1. 15 0
      code/Iteration1/ParseXML.py

+ 15 - 0
code/Iteration1/ParseXML.py

@@ -0,0 +1,15 @@
+import xml.etree.ElementTree as ET
+
+# Parses an XML File at the given location
+# It is assumed, that packets are placed on the second hierarchical level and packetinformation encoded as attributes
+# Returns a List of Dictionaries, each Dictionary contains the information for one packet
+def ParseXML(path_xml):
+	tree = ET.parse(path_xml)
+	root = tree.getroot()
+
+	#Convert Tree to List of Dictionaries
+	packets = []
+	for child in root:
+		packets.append(child.attrib)
+
+	return packets