mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
IPP printer status is already converted to an integer
This commit is contained in:
@@ -55,6 +55,9 @@ o [NSE][GH#2063] IPP request object conversion to string was not working
|
|||||||
o [NSE][GH#2063] IPP response parser was not correctly processing
|
o [NSE][GH#2063] IPP response parser was not correctly processing
|
||||||
end-of-attributes-tag [nnposter]
|
end-of-attributes-tag [nnposter]
|
||||||
|
|
||||||
|
o [NSE] Script cups-info was failing due to erroneous double-decoding
|
||||||
|
of the IPP printer status [nnposter]
|
||||||
|
|
||||||
o [NSE][GH#2010] Oracle TNS parser was incorrectly unmarshalling DALC byte
|
o [NSE][GH#2010] Oracle TNS parser was incorrectly unmarshalling DALC byte
|
||||||
arrays [nnposter]
|
arrays [nnposter]
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ categories = {"safe", "discovery"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service(631, "ipp", "tcp", "open")
|
portrule = shortport.port_or_service(631, "ipp", "tcp", "open")
|
||||||
|
|
||||||
|
local verbose_states = {
|
||||||
|
[ipp.IPP.PrinterState.IPP_PRINTER_IDLE] = "Idle",
|
||||||
|
[ipp.IPP.PrinterState.IPP_PRINTER_PROCESSING] = "Processing",
|
||||||
|
[ipp.IPP.PrinterState.IPP_PRINTER_STOPPED] = "Stopped",
|
||||||
|
}
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
local helper = ipp.Helper:new(host, port)
|
local helper = ipp.Helper:new(host, port)
|
||||||
@@ -57,18 +63,12 @@ action = function(host, port)
|
|||||||
|
|
||||||
local output = {}
|
local output = {}
|
||||||
for _, printer in ipairs(printers) do
|
for _, printer in ipairs(printers) do
|
||||||
local states = {
|
|
||||||
[ipp.IPP.PrinterState.IPP_PRINTER_IDLE] = "Idle",
|
|
||||||
[ipp.IPP.PrinterState.IPP_PRINTER_PROCESSING] = "Processing",
|
|
||||||
[ipp.IPP.PrinterState.IPP_PRINTER_STOPPED] = "Stopped",
|
|
||||||
}
|
|
||||||
local state = string.unpack(">I4", printer.state)
|
|
||||||
table.insert(output, {
|
table.insert(output, {
|
||||||
name = printer.name,
|
name = printer.name,
|
||||||
("DNS-SD Name: %s"):format(printer.dns_sd_name or ""),
|
("DNS-SD Name: %s"):format(printer.dns_sd_name or ""),
|
||||||
("Location: %s"):format(printer.location or ""),
|
("Location: %s"):format(printer.location or ""),
|
||||||
("Model: %s"):format(printer.model or ""),
|
("Model: %s"):format(printer.model or ""),
|
||||||
("State: %s"):format(states[state] or ""),
|
("State: %s"):format(verbose_states[printer.state] or ""),
|
||||||
("Queue: %s print jobs"):format(tonumber(printer.queue_count) or 0),
|
("Queue: %s print jobs"):format(tonumber(printer.queue_count) or 0),
|
||||||
} )
|
} )
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user