-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathsysdiagnose-sys.py
34 lines (23 loc) · 915 Bytes
/
sysdiagnose-sys.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
#! /usr/bin/env python
# For Python3
# Script to print the values from /logs/SystemVersion/SystemVersion.plist
# Author: [email protected]
import sys
from optparse import OptionParser
import plistlib
version_string = "sysdiagnose-sys.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/SystemVersion/SystemVersion.plist To Be Searched")
(options, args) = parser.parse_args()
with open(options.inputfile, 'rb') as fp:
pl = plistlib.load(fp)
print("ProductName = " + pl["ProductName"])
print("ProductVersion = " + pl["ProductVersion"])
print("ProductBuildVersion = " + pl["ProductBuildVersion"])