forked from cheeky4n6monkey/iOS_sysdiagnose_forensic_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sysdiagnose-mobileactivation.py
124 lines (104 loc) · 4.07 KB
/
sysdiagnose-mobileactivation.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#! /usr/bin/env python
# For Python3
# Script to print Mobile Activation Startup and Upgrade info from logs/MobileActivation/mobileactivationd.log.*
# Author: cheeky4n6monkey@gmail.com
import sys
from optparse import OptionParser
version_string = "sysdiagnose-mobileactivation.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="logs/MobileActivation/mobileactivationd.log.* To Be Searched")
(options, args) = parser.parse_args()
#no arguments given by user, print help and exit
if len(sys.argv) == 1:
parser.print_help()
exit(-1)
linecount = 0
hitcount = 0
activationcount = 0
with open(options.inputfile, 'r') as fp:
data = fp.readlines()
for line in data:
linecount += 1
if 'perform_data_migration' in line:
hitcount += 1
#print("\n" + line)
txts = line.split()
#print(txts, linecount)
#print(len(txts))
dayofweek = txts[0]
month = txts[1]
day = txts[2]
time = txts[3]
year = txts[4]
frombuild = txts[12]
tobuild = txts[14]
print("\n" + day + " " + month + " " + year + " " + time + " Upgraded from " + frombuild + " to " + tobuild + " [line " + str(linecount) + "]")
if 'MA: main: ____________________ Mobile Activation Startup _____________________' in line:
activationcount += 1
#print("\n" + line)
txts = line.split()
#print(txts, linecount)
#print(len(txts))
dayofweek = txts[0]
month = txts[1]
day = txts[2]
time = txts[3]
year = txts[4]
print("\n" + day + " " + month + " " + year + " " + time + " Mobile Activation Startup " + " [line " + str(linecount) + "]")
if 'MA: main: build_version:' in line:
#print("\n" + line)
txts = line.split()
#print(txts, linecount)
#print(len(txts))
dayofweek = txts[0]
month = txts[1]
day = txts[2]
time = txts[3]
year = txts[4]
buildver = txts[11]
print(day + " " + month + " " + year + " " + time + " Mobile Activation Build Version = " + buildver)
if 'MA: main: hardware_model:' in line:
#print("\n" + line)
txts = line.split()
#print(txts, linecount)
#print(len(txts))
dayofweek = txts[0]
month = txts[1]
day = txts[2]
time = txts[3]
year = txts[4]
hwmodel = txts[11]
print(day + " " + month + " " + year + " " + time + " Mobile Activation Hardware Model = " + hwmodel)
if 'MA: main: product_type:' in line:
#print("\n" + line)
txts = line.split()
#print(txts, linecount)
#print(len(txts))
dayofweek = txts[0]
month = txts[1]
day = txts[2]
time = txts[3]
year = txts[4]
prod = txts[11]
print(day + " " + month + " " + year + " " + time + " Mobile Activation Product Type = " + prod)
if 'MA: main: device_class:' in line:
#print("\n" + line)
txts = line.split()
#print(txts, linecount)
#print(len(txts))
dayofweek = txts[0]
month = txts[1]
day = txts[2]
time = txts[3]
year = txts[4]
devclass = txts[11]
print(day + " " + month + " " + year + " " + time + " Mobile Activation Device Class = " + devclass)
print("\nFound " + str(hitcount) + " Upgrade entries")
print("Found " + str(activationcount) + " Mobile Activation Startup entries\n")