-
Notifications
You must be signed in to change notification settings - Fork 322
/
windows_privesc_check.py
executable file
·76 lines (61 loc) · 2.07 KB
/
windows_privesc_check.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
from wpc.parseOptions import parseOptions
from wpc.report.report import report
from wpc.audit.dump import dump
from wpc.audit.dumptab import dumptab
from wpc.audit.audit import audit
import datetime
import time
import wpc.utils
import sys
# ------------------------ Main Code Starts Here ---------------------
# Parse command line arguments
options = parseOptions()
# Initialise WPC
# TODO be able to enable/disable caching
wpc.utils.init(options)
# Object to hold all the issues we find
report = report()
wpc.utils.populate_scaninfo(report)
issues = report.get_issues()
if options.pyshell_mode:
wpc.utils.printline("Python Shell - to exit do CTRL-z or type exit()")
print
import code
code.interact(local=dict(globals(), **locals()))
sys.exit()
wpc.utils.dump_options(options)
wpc.utils.printline("Starting Audit at %s" % datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S'))
start_time = time.time()
# Dump raw data if required
if options.dump_mode:
d = dump(options)
d.run()
# Dump raw data if required
if options.dumptab_mode:
d = dumptab(options, report)
d.run()
# Identify security issues
if options.audit_mode:
a = audit(options, report)
a.run()
if options.report_file_stem:
wpc.utils.printline("Audit Complete at %s" % datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S'))
print
print "[+] Runtime: %.1f seconds" % int(time.time() - start_time)
print
filename = "%s.xml" % options.report_file_stem
print "[+] Saving report file %s" % filename
f = open(filename, 'w')
f.write(report.as_xml_string())
f.close()
filename = "%s.txt" % options.report_file_stem
print "[+] Saving report file %s" % filename
f = open(filename, 'w')
f.write(report.as_text())
f.close()
filename = "%s.html" % options.report_file_stem
print "[+] Saving report file %s" % filename
f = open(filename, 'w')
f.write(report.as_html())
f.close()
#wpc.conf.cache.print_stats()