Newer
Older
DirtyScripts / privesc / windows_privesc_check.py
root on 12 Nov 2019 2 KB added some stuff
  1. from wpc.parseOptions import parseOptions
  2. from wpc.report.report import report
  3. from wpc.audit.dump import dump
  4. from wpc.audit.dumptab import dumptab
  5. from wpc.audit.audit import audit
  6. import datetime
  7. import time
  8. import wpc.utils
  9. import sys
  10.  
  11. # ------------------------ Main Code Starts Here ---------------------
  12.  
  13. # Parse command line arguments
  14. options = parseOptions()
  15.  
  16. # Initialise WPC
  17. # TODO be able to enable/disable caching
  18. wpc.utils.init(options)
  19.  
  20. # Object to hold all the issues we find
  21. report = report()
  22. wpc.utils.populate_scaninfo(report)
  23. issues = report.get_issues()
  24.  
  25. if options.pyshell_mode:
  26. wpc.utils.printline("Python Shell - to exit do CTRL-z or type exit()")
  27. print
  28. import code
  29. code.interact(local=dict(globals(), **locals()))
  30. sys.exit()
  31.  
  32. wpc.utils.dump_options(options)
  33.  
  34. wpc.utils.printline("Starting Audit at %s" % datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S'))
  35. start_time = time.time()
  36.  
  37. # Dump raw data if required
  38. if options.dump_mode:
  39. d = dump(options)
  40. d.run()
  41.  
  42. # Dump raw data if required
  43. if options.dumptab_mode:
  44. d = dumptab(options, report)
  45. d.run()
  46.  
  47. # Identify security issues
  48. if options.audit_mode:
  49. a = audit(options, report)
  50. a.run()
  51.  
  52. if options.report_file_stem:
  53. wpc.utils.printline("Audit Complete at %s" % datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S'))
  54. print
  55. print "[+] Runtime: %.1f seconds" % int(time.time() - start_time)
  56. print
  57. filename = "%s.xml" % options.report_file_stem
  58. print "[+] Saving report file %s" % filename
  59. f = open(filename, 'w')
  60. f.write(report.as_xml_string())
  61. f.close()
  62.  
  63. filename = "%s.txt" % options.report_file_stem
  64. print "[+] Saving report file %s" % filename
  65. f = open(filename, 'w')
  66. f.write(report.as_text())
  67. f.close()
  68.  
  69. filename = "%s.html" % options.report_file_stem
  70. print "[+] Saving report file %s" % filename
  71. f = open(filename, 'w')
  72. f.write(report.as_html())
  73. f.close()
  74.  
  75. #wpc.conf.cache.print_stats()
Buy Me A Coffee