11import os
22import sys
3- import json
4- from xmltodict import parse
53from time import sleep
64from csv import reader
75from base64 import b64encode
@@ -381,19 +379,15 @@ def extract_password(self, context):
381379 xml_doc_path = os .path .abspath (self .local_export_path + "/" + self .export_name )
382380 xml_tree = ElementTree .parse (xml_doc_path )
383381 root = xml_tree .getroot ()
384- to_string = ElementTree .tostring (root , encoding = "UTF-8" , method = "xml" )
385- xml_to_dict = parse (to_string )
386- dump = json .dumps (xml_to_dict )
387- obj = json .loads (dump )
388-
382+
389383 root_entries = root .find ("./Root/Entry" )
390384 if root_entries is not None :
391385 for entry in root_entries :
392386 if entry is not None :
393387 self .print_password (context , entry )
394388 else :
395389 context .log .highlight ("None" )
396-
390+
397391 objects = root .findall ("./Root/Group" )
398392 while objects :
399393 current_object = objects .pop (0 )
@@ -403,12 +397,12 @@ def extract_password(self, context):
403397 for history_entry in history .findall ("./Entry" ):
404398 self .print_password (context , history_entry )
405399 objects .extend (current_object .findall ("./Group" ))
406-
400+
407401 def print_password (self , context , entries ):
408402 for entry in entries .findall ("./String" ):
409403 key = entry .find ("./Key" )
410404 value = entry .find ("./Value" )
411405 key_text = key .text if key is not None else "None"
412406 value_text = value .text if value is not None and value .text is not None else "None"
413- context .log .highlight (( f"{ key_text } : { value_text } " ))
414- context .log .highlight (str ( "-------------------------------------" ) )
407+ context .log .highlight (f"{ key_text } : { value_text } " )
408+ context .log .highlight ("-------------------------------------" )
0 commit comments