Skip to content

Commit

Permalink
fix: [parsers] wifi_known_networks uses plistlib fixes #66
Browse files Browse the repository at this point in the history
  • Loading branch information
cvandeplas committed May 29, 2024
1 parent 1914d69 commit 36cd16b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions parsers/wifi_known_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
import json
import os
from optparse import OptionParser
import biplist
from biplist import Uid, Data
from datetime import datetime
import glob
import config
import misc


class CustomEncoder(json.JSONEncoder):
Expand Down Expand Up @@ -58,12 +57,7 @@ def getKnownWifiNetworks(plistfiles=[], ios_version=13):
for path in plistfiles:
if os.path.basename(path) == "com.apple.wifi.known-networks.plist":
try:
with open(path, 'rb') as fp:
result = biplist.readPlist(fp)
if config.debug:
print(f"Type (result) = {type(result)}", file=sys.stderr)
print("XXXX DEBUG:", file=sys.stderr)
print(json.dumps(result, indent=4, cls=CustomEncoder), file=sys.stderr)
result = misc.load_plist_file_as_json(path)
except Exception as e:
print(f"Could not parse {path}. Reason: {str(e)}", file=sys.stderr)
return json.loads(json.dumps(result, indent=4, cls=CustomEncoder))
Expand Down

0 comments on commit 36cd16b

Please sign in to comment.