printerxpl-forge 6.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. nse/README.md +204 -0
  2. nse/__init__.py +6 -0
  3. nse/install_nse.py +412 -0
  4. nse/lib/printerxpl.lua +238 -0
  5. nse/scripts/cups-info.nse +74 -0
  6. nse/scripts/cups-queue-info.nse +43 -0
  7. nse/scripts/hp-printers-cve-2022-1026.nse +121 -0
  8. nse/scripts/http-device-mac.nse +107 -0
  9. nse/scripts/http-hp-ilo-info.nse +121 -0
  10. nse/scripts/http-info-xerox-enum.nse +101 -0
  11. nse/scripts/http-vuln-cve2022-1026.nse +158 -0
  12. nse/scripts/lexmark-config.nse +89 -0
  13. nse/scripts/pjl-ready-message.nse +106 -0
  14. nse/scripts/printer-banner.nse +217 -0
  15. nse/scripts/printer-cups-rce.nse +189 -0
  16. nse/scripts/printer-cve-detect.nse +279 -0
  17. nse/scripts/printer-discover.nse +205 -0
  18. nse/scripts/printer-firmware-exposed.nse +219 -0
  19. nse/scripts/printer-hp-pjl.nse +192 -0
  20. nse/scripts/printer-http-ews.nse +293 -0
  21. nse/scripts/printer-ipp-info.nse +235 -0
  22. nse/scripts/printer-lexmark-ipp.nse +203 -0
  23. nse/scripts/printer-passback.nse +204 -0
  24. nse/scripts/printer-pjl-info.nse +146 -0
  25. nse/scripts/printer-printnightmare.nse +211 -0
  26. nse/scripts/printer-snmp-info.nse +176 -0
  27. nse/scripts/printer-vuln-check.nse +256 -0
  28. nse/scripts/snmp-device-mac.nse +93 -0
  29. nse/scripts/snmp-info.nse +146 -0
  30. nse/scripts/snmp-sysdescr.nse +70 -0
  31. printerxpl_forge-6.2.0.dist-info/METADATA +919 -0
  32. printerxpl_forge-6.2.0.dist-info/RECORD +97 -0
  33. printerxpl_forge-6.2.0.dist-info/WHEEL +5 -0
  34. printerxpl_forge-6.2.0.dist-info/entry_points.txt +4 -0
  35. printerxpl_forge-6.2.0.dist-info/licenses/LICENSE +21 -0
  36. printerxpl_forge-6.2.0.dist-info/top_level.txt +4 -0
  37. src/assets/fonts/gunplay.pfa +1671 -0
  38. src/assets/fonts/kshandwrt.pfa +315 -0
  39. src/assets/fonts/laksoner.pfa +2402 -0
  40. src/assets/fonts/paintcans.pfa +9699 -0
  41. src/assets/fonts/stencilod.pfa +4076 -0
  42. src/assets/fonts/takecover.pfa +26138 -0
  43. src/assets/fonts/topsecret.pfa +6652 -0
  44. src/assets/fonts/whoa.pfa +773 -0
  45. src/assets/mibs/HOST-RESOURCES-MIB +1540 -0
  46. src/assets/mibs/Printer-MIB +4389 -0
  47. src/assets/mibs/README.md +9 -0
  48. src/assets/mibs/SNMPv2-MIB +854 -0
  49. src/assets/overlays/hacker.eps +596 -0
  50. src/assets/overlays/smiley.eps +214 -0
  51. src/assets/overlays/smiley2.eps +240 -0
  52. src/core/attack_orchestrator.py +1025 -0
  53. src/core/capabilities.py +323 -0
  54. src/core/destructive_audit.py +430 -0
  55. src/core/discovery.py +488 -0
  56. src/core/osdetect.py +74 -0
  57. src/core/poly_runner.py +579 -0
  58. src/core/printer.py +1426 -0
  59. src/main.py +2134 -0
  60. src/modules/install_printer.py +318 -0
  61. src/modules/login_bruteforce.py +852 -0
  62. src/modules/pcl.py +506 -0
  63. src/modules/pjl.py +3575 -0
  64. src/modules/print_job.py +1290 -0
  65. src/modules/ps.py +1102 -0
  66. src/payloads/__init__.py +98 -0
  67. src/payloads/assets/overlays/notice.eps +9 -0
  68. src/protocols/__init__.py +19 -0
  69. src/protocols/firmware.py +738 -0
  70. src/protocols/ipp.py +216 -0
  71. src/protocols/ipp_attacks.py +609 -0
  72. src/protocols/lpd.py +141 -0
  73. src/protocols/network_map.py +1004 -0
  74. src/protocols/raw.py +173 -0
  75. src/protocols/smb.py +359 -0
  76. src/protocols/ssrf_pivot.py +427 -0
  77. src/protocols/storage.py +587 -0
  78. src/ui/__init__.py +6 -0
  79. src/ui/interactive.py +742 -0
  80. src/ui/spinner.py +112 -0
  81. src/ui/tables.py +132 -0
  82. src/utils/banner_grabber.py +852 -0
  83. src/utils/codebook.py +456 -0
  84. src/utils/config.py +522 -0
  85. src/utils/cve_loader.py +158 -0
  86. src/utils/default_creds.py +134 -0
  87. src/utils/discovery_online.py +1327 -0
  88. src/utils/exploit_manager.py +805 -0
  89. src/utils/fuzzer.py +220 -0
  90. src/utils/helper.py +732 -0
  91. src/utils/local_printers.py +307 -0
  92. src/utils/ml_engine.py +491 -0
  93. src/utils/operators.py +474 -0
  94. src/utils/ports.py +234 -0
  95. src/utils/vuln_scanner.py +823 -0
  96. src/utils/wordlist_loader.py +412 -0
  97. src/version.py +36 -0
@@ -0,0 +1,93 @@
1
+ local snmp = require "snmp"
2
+ local shortport = require "shortport"
3
+
4
+ description = [[
5
+ Get MAC address from printers
6
+ ]]
7
+
8
+ ---
9
+ -- @usage
10
+ -- nmap -sS -p 161 --script snmp-device-mac <target>
11
+ --
12
+ -- @output
13
+ -- |_snmp-device-mac: 00:01:02:03:04:AB
14
+ -- <snip>
15
+ --
16
+
17
+
18
+ author = "Esteban Dauksis"
19
+ license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
20
+ categories = {"discovery", "safe"}
21
+ dependecies = {"snmp-brute"}
22
+
23
+ -- I prefer a portrule for common tcp ports than upd 161 for printer/scanner discovery
24
+
25
+ -- portrule = shortport.portnumber(161, "udp", {"open", "open|filtered"})
26
+ portrule = shortport.portnumber({515, 631, 9100, 1865}, "tcp", "open")
27
+
28
+ action = function(host,port)
29
+
30
+ local socket = nmap.new_socket()
31
+
32
+ socket:set_timeout(5000)
33
+
34
+ local catch = function()
35
+ socket:close()
36
+ end
37
+
38
+ local try = nmap.new_try(catch)
39
+
40
+ try(socket:connect(host, 161, "udp"))
41
+
42
+ local payload
43
+ local options = {}
44
+ options.reqId = 28428 -- pa que?
45
+ payload = snmp.encode(snmp.buildPacket(snmp.buildGetRequest(options,"1.3.6.1.2.1.2.2.1.6.1")))
46
+
47
+ try(socket:send(payload))
48
+
49
+ local status
50
+ local response
51
+
52
+ status, response = socket:receive_bytes(1)
53
+
54
+ if (not status) or (response == "TIMEOUT") then
55
+ return
56
+ end
57
+
58
+ nmap.set_port_state(host, port, "open")
59
+
60
+ local result
61
+
62
+ local r = snmp.fetchFirst(response)
63
+ if r ~= "" and r ~= nil then
64
+ res1 = string.format("%02x:%02x:%02x:%02x:%02x:%02x",string.byte(r),string.byte(r,2),string.byte(r,3),string.byte(r,4),string.byte(r,5),string.byte(r,6))
65
+ return res1
66
+ end
67
+
68
+
69
+ local payload
70
+ local options = {}
71
+ options.reqId = 28429 -- pa que?
72
+ payload = snmp.encode(snmp.buildPacket(snmp.buildGetRequest(options, "1.3.6.1.2.1.2.2.1.6.2")))
73
+
74
+ try(socket:send(payload))
75
+
76
+ status, response = socket:receive_bytes(1)
77
+
78
+ if (not status) or (response == "TIMEOUT") then
79
+ return
80
+ end
81
+
82
+ local r2 = snmp.fetchFirst(response)
83
+ if r2 ~= "" and r2 ~= nil then
84
+ res2 = string.format("%02x:%02x:%02x:%02x:%02x:%02x",string.byte(r2),string.byte(r2,2),string.byte(r2,3),string.byte(r2,4),string.byte(r2,5),string.byte(r2,6))
85
+ return res2
86
+ end
87
+
88
+
89
+ try(socket:close())
90
+
91
+
92
+ end
93
+
@@ -0,0 +1,146 @@
1
+ local datetime = require "datetime"
2
+ local datafiles = require "datafiles"
3
+ local ipOps = require "ipOps"
4
+ local nmap = require "nmap"
5
+ local shortport = require "shortport"
6
+ local snmp = require "snmp"
7
+ local stdnse = require "stdnse"
8
+ local string = require "string"
9
+ local U = require "lpeg-utility"
10
+ local comm = require "comm"
11
+
12
+ description = [[
13
+ Extracts basic information from an SNMPv3 GET request. The same probe is used
14
+ here as in the service version detection scan.
15
+ ]]
16
+
17
+ ---
18
+ --@output
19
+ --161/udp open snmp udp-response ttl 244 ciscoSystems SNMPv3 server (public)
20
+ --| snmp-info:
21
+ --| enterprise: ciscoSystems
22
+ --| engineIDFormat: mac
23
+ --| engineIDData: 00:d4:8c:00:11:22
24
+ --| snmpEngineBoots: 6
25
+ --|_ snmpEngineTime: 358d01h13m46s
26
+ --
27
+ --@xmloutput
28
+ -- <elem key="enterprise">ciscoSystems</elem>
29
+ -- <elem key="engineIDFormat">mac</elem>
30
+ -- <elem key="engineIDData">00:d4:8c:b5:32:bc</elem>
31
+ -- <elem key="snmpEngineBoots">6</elem>
32
+ -- <elem key="snmpEngineTime">358d01h26m34s</elem>
33
+
34
+ author = "Daniel Miller"
35
+
36
+ license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
37
+
38
+ categories = {"default", "version", "safe"}
39
+
40
+ portrule = shortport.version_port_or_service(161, "snmp", "udp")
41
+
42
+ -- Lifted from nmap-service-probes:
43
+ local SNMPv3GetRequest = "\x30\x3a\x02\x01\x03\x30\x0f\x02\x02\x4a\x69\x02\x03\0\xff\xe3\x04\x01\x04\x02\x01\x03\x04\x10\x30\x0e\x04\0\x02\x01\0\x02\x01\0\x04\0\x04\0\x04\0\x30\x12\x04\0\x04\0\xa0\x0c\x02\x02\x37\xf0\x02\x01\0\x02\x01\0\x30\0"
44
+
45
+ -- TODO: This should probably check for version 1 and version 2, since those
46
+ -- can operate on the same port. Right now it's really just "snmp3-info"
47
+ action = function (host, port)
48
+ local ENTERPRISE_NUMS = nmap.registry.enterprise_numbers
49
+ if not ENTERPRISE_NUMS then
50
+ local status
51
+ status, ENTERPRISE_NUMS = datafiles.parse_file("nselib/data/enterprise_numbers.txt",
52
+ {[function(l) return tonumber(l:match("^%d+")) end] = "\t(.*)$"})
53
+ if not status then
54
+ stdnse.debug1("Couldn't parse enterprise numbers datafile: %s", ENTERPRISE_NUMS)
55
+ ENTERPRISE_NUMS = {}
56
+ setmetatable(ENTERPRISE_NUMS, {__index = function(i) return "unknown" end})
57
+ end
58
+ nmap.registry.enterprise_numbers = ENTERPRISE_NUMS
59
+ end
60
+
61
+ local response
62
+ -- Did the service engine already do the hard work?
63
+ if port.version and port.version.service_fp then
64
+ -- Probes sent, replies received, but no match.
65
+ response = U.get_response(port.version.service_fp, "SNMPv3GetRequest")
66
+ end
67
+
68
+ if not response then
69
+ -- Have to send the probe ourselves
70
+ local status
71
+ status, response = comm.exchange(host, port, SNMPv3GetRequest)
72
+ if not status then
73
+ stdnse.debug1("Couldn't get a response: %s", response)
74
+ return nil
75
+ end
76
+ end
77
+
78
+ local decoded = snmp.decode(response)
79
+
80
+ -- Check for SNMP version 3 and msgid 0x4a69 (from the probe)
81
+ if ((not decoded) or
82
+ (decoded[1] or false) ~= 3 or
83
+ (not decoded[2]) or
84
+ (decoded[2][1] or false) ~= 0x4a69) then
85
+ stdnse.debug1("Service is not SNMPv3, or packet structure not recognized")
86
+ return nil
87
+ end
88
+
89
+ -- This really only works for User-based Security Model (USM)
90
+ if decoded[2][4] ~= 3 then
91
+ -- TODO: at least report the security model in use
92
+ stdnse.debug1("SNMP service not using User-based Security Model")
93
+ return nil
94
+ end
95
+
96
+ -- Decode the msgSecurityParameters octet-string
97
+ decoded = snmp.decode(decoded[3])
98
+
99
+ local output = stdnse.output_table()
100
+ -- Decode the msgAuthoritativeEngineID octet-string
101
+ local engineID = decoded[1]
102
+ local enterprise, pos = string.unpack(">I4", engineID)
103
+ if enterprise > 0x80000000 then
104
+ enterprise = enterprise - 0x80000000
105
+ output.enterprise = ENTERPRISE_NUMS[enterprise]
106
+ local format, data
107
+ format, pos = string.unpack("B", engineID, pos)
108
+ if format == 1 then
109
+ output.engineIDFormat = "ipv4"
110
+ output.engineIDData = ipOps.str_to_ip(engineID:sub(pos,pos+3))
111
+ elseif format == 2 then
112
+ output.engineIDFormat = "ipv6"
113
+ output.engineIDData = ipOps.str_to_ip(engineID:sub(pos,pos+15))
114
+ elseif format == 3 then
115
+ output.engineIDFormat = "mac"
116
+ output.engineIDData = stdnse.tohex(engineID:sub(pos,pos+5), {separator=':'})
117
+ elseif format == 4 then
118
+ output.engineIDFormat = "text"
119
+ output.engineIDData = engineID:sub(pos)
120
+ elseif format == 5 then
121
+ output.engineIDFormat = "octets"
122
+ output.engineIDData = stdnse.tohex(engineID:sub(pos))
123
+ else
124
+ output.engineIDFormat = "unknown"
125
+ output.engineIDData = stdnse.tohex(engineID:sub(pos))
126
+ end
127
+ else
128
+ output.enterprise = ENTERPRISE_NUMS[enterprise] or enterprise
129
+ output.engineIDFormat = "unknown"
130
+ output.engineIDData = stdnse.tohex(engineID:sub(5))
131
+ end
132
+ output.snmpEngineBoots = decoded[2]
133
+ output.snmpEngineTime = datetime.format_time(decoded[3])
134
+
135
+ port.version = port.version or {}
136
+ port.version.service = "snmp"
137
+ if port.version.product and port.version.product ~= "SNMPv3 server" then
138
+ port.version.product = ("%s; %s SNMPv3 server"):format(port.version.product, output.enterprise)
139
+ else
140
+ port.version.product = ("%s SNMPv3 server"):format(output.enterprise)
141
+ end
142
+ nmap.set_port_version(host, port, "hardmatched")
143
+
144
+ return output
145
+ end
146
+
@@ -0,0 +1,70 @@
1
+ local datetime = require "datetime"
2
+ local nmap = require "nmap"
3
+ local shortport = require "shortport"
4
+ local snmp = require "snmp"
5
+ local string = require "string"
6
+
7
+ description = [[
8
+ Attempts to extract system information from an SNMP service.
9
+ ]]
10
+
11
+ ---
12
+ -- @usage
13
+ -- nmap -sU -p 161 --script snmp-sysdescr <target>
14
+ --
15
+ -- @output
16
+ -- | snmp-sysdescr: HP ETHERNET MULTI-ENVIRONMENT,ROM A.25.80,JETDIRECT,JD117,EEPROM V.28.22,CIDATE 08/09/2006
17
+ -- |_ System uptime: 28 days, 17:18:59 (248153900 timeticks)
18
+
19
+ author = "Thomas Buchanan"
20
+
21
+ license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
22
+
23
+ categories = {"default", "discovery", "safe"}
24
+
25
+ dependencies = {"snmp-brute"}
26
+
27
+
28
+ portrule = shortport.port_or_service(161, "snmp", "udp", {"open", "open|filtered"})
29
+
30
+ ---
31
+ -- Sends SNMP packets to host and reads responses
32
+ action = function(host, port)
33
+
34
+ local snmpHelper = snmp.Helper:new(host, port)
35
+ snmpHelper:connect()
36
+
37
+ -- build a SNMP v1 packet
38
+ -- copied from packet capture of snmpget exchange
39
+ -- get value: 1.3.6.1.2.1.1.1.0 (SNMPv2-MIB::sysDescr.0)
40
+ local status, response = snmpHelper:get({reqId=28428}, "1.3.6.1.2.1.1.1.0")
41
+
42
+ if not status then
43
+ return
44
+ end
45
+
46
+ -- since we got something back, the port is definitely open
47
+ nmap.set_port_state(host, port, "open")
48
+
49
+ local result = response and response[1] and response[1][1]
50
+
51
+ -- build a SNMP v1 packet
52
+ -- copied from packet capture of snmpget exchange
53
+ -- get value: 1.3.6.1.2.1.1.3.0 (SNMPv2-MIB::sysUpTime.0)
54
+ status, response = snmpHelper:get({reqId=28428}, "1.3.6.1.2.1.1.3.0")
55
+
56
+ if not status then
57
+ return result
58
+ end
59
+
60
+ local uptime = response and response[1] and response[1][1]
61
+ if not uptime then
62
+ return
63
+ end
64
+
65
+ result = result .. "\n" .. string.format(" System uptime: %s (%s timeticks)", datetime.format_time(uptime, 100), tostring(uptime))
66
+
67
+ return result
68
+ end
69
+
70
+