forked from cheeky4n6monkey/iOS_sysdiagnose_forensic_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sysdiagnose-wifi-icloud.py
86 lines (67 loc) · 3.24 KB
/
sysdiagnose-wifi-icloud.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#! /usr/bin/env python
# For Python3
# Script to print the values from WiFi/ICLOUD_com.apple.wifid.plist
# Author: cheeky4n6monkey@gmail.com
import sys
from optparse import OptionParser
import plistlib
version_string = "sysdiagnose-wifi-icloud.py v2019-05-10 Version 1.0"
if sys.version_info[0] < 3:
print("Must be using Python 3! Exiting ...")
exit(-1)
print("Running " + version_string + "\n")
usage = "\n%prog -i inputfile\n"
parser = OptionParser(usage=usage)
parser.add_option("-i", dest="inputfile",
action="store", type="string",
help="WiFi/ICLOUD_com.apple.wifid.plist To Be Searched")
parser.add_option("-t", dest="outputtsv",
action="store_true", default=False,
help="Write TSV output file called sysdiagnose-wifi-icloud-output.TSV")
(options, args) = parser.parse_args()
netlist = []
with open(options.inputfile, 'rb') as fp:
pl = plistlib.load(fp)
if 'values' in pl.keys():
name = ""
timestamp =""
bssid = ""
ssid = ""
addedat = ""
addedby = ""
enabled = ""
for key, val in pl['values'].items(): # values contains an entry for each wifi net
print("==================================")
print("Name = " + key)
name = key
if type(val) == dict:
for key2, val2 in val.items():
if key2 == 'timestamp':
print("timestamp = " + str(val2))
timestamp = str(val2)
if key2 == 'value':
if type(val2) == dict:
for key3, val3 in val2.items():
if key3 == 'BSSID':
print("BSSID = " + str(val3))
bssid = str(val3)
if key3 == 'SSID_STR':
print("SSID_STR = " + str(val3))
ssid = str(val3)
if key3 == 'added_at':
print("added_at = " + str(val3))
addedat = str(val3)
if key3 == 'added_by':
print("added_by = " + str(val3))
addedby = str(val3)
if key3 == 'enabled':
print("enabled = " + str(val3))
enabled = str(val3)
netlist.append((name, timestamp, bssid, ssid, addedat, addedby, enabled))
print("\nRetrieved " + str(len(pl['values'].keys())) + " wifi entries\n")
if (options.outputtsv):
with open("sysdiagnose-wifi-icloud-output.TSV", 'w') as wp:
wp.write("NAME\tTIMESTAMP\tBSSID\tSSID\tADDEDAT\tADDEDBY\tENABLED\n") # header
for name, timestamp, bssid, ssid, addedat, addedby, enabled in netlist:
wp.write(name+"\t"+timestamp+"\t"+bssid+"\t"+ssid+"\t"+addedat+"\t"+addedby+"\t"+enabled+"\n")
print("Also outputted to sysdiagnose-wifi-icloud-output.TSV\n")