diff --git a/CHANGELOG b/CHANGELOG index d268b60c6..9193eb6c9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 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 arrays [nnposter] diff --git a/scripts/cups-info.nse b/scripts/cups-info.nse index 3e32e9a2e..9f96c78a9 100644 --- a/scripts/cups-info.nse +++ b/scripts/cups-info.nse @@ -43,6 +43,12 @@ categories = {"safe", "discovery"} 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) local helper = ipp.Helper:new(host, port) @@ -57,18 +63,12 @@ action = function(host, port) local output = {} 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, { name = printer.name, ("DNS-SD Name: %s"):format(printer.dns_sd_name or ""), ("Location: %s"):format(printer.location 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), } ) end