Lucene search
K

Lexmark Printer Detection

🗓️ 11 May 2010 00:00:00Reported by TenableType 
nessus
 nessus
🔗 www.tenable.com👁 68 Views

The remote host is a Lexmark printer. This plugin scrapes model and version info from the web interface

Code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(46311);
  script_version("1.8");
  script_set_attribute(attribute:"plugin_modification_date", value:"2025/12/05");

  script_name(english:"Lexmark Printer Detection");
  script_summary(english:"Scrapes model and other version info from web interface");

  script_set_attribute(attribute:"synopsis", value:"The remote host is a printer.");
  script_set_attribute(attribute:"description", value:
"The remote host is a Lexmark printer.

By querying the device information page, this plugin attempts to
identify the model, and various other key software versions such as
kernel, engine, base installed on the remote Lexmark device.");
  script_set_attribute(attribute:"risk_factor", value:"None");
  script_set_attribute(attribute:"solution", value:"n/a");

  script_set_attribute(attribute:"plugin_publication_date", value:"2010/05/11");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:lexmark:printer_sharing");
  script_set_attribute(attribute:"asset_inventory", value:"True");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Service detection");

  script_copyright(english:"This script is Copyright (C) 2010-2025 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("httpver.nasl");
  script_require_ports("Services/www", 80);
  script_require_keys("Scan/Do_Scan_Printers");

  exit(0);
}

include("http.inc");

var port = get_http_port(default:80, dont_break: 1);
var res = http_get_cache(port:port, item:"/",exit_on_fail: TRUE);
# Poor-man's decode since this is the only one seen so far
res = str_replace(string:res, find:" ", replace:" ");
var data = make_array();
var pat = '<TITLE>Lexmark ([A-Za-z0-9]+)</TITLE>';

var matches, match, item;
if(egrep(pattern:pat,string:res, icase:TRUE) )
{
  matches = eregmatch(pattern:pat,string:res, icase:TRUE);
  foreach match (split(matches, keep:FALSE))
  {
    item = eregmatch(pattern:pat, string:match, icase:TRUE);
    if (!isnull(item))
    {
      data["model"] = item[1];
      data["port"] = port;
      break;
    }
  }
}

if (!max_index(keys(data))) audit(AUDIT_UNKNOWN_WEB_SERVER_VER, "the Lexmark printer", port);

var kb_base = "www/lexmark_printer";
var labels = make_array();

labels['port']             = "HTTP Port";
labels["model"]            = "Model";
labels["base_ver"]         = "Base Version";
labels["loader_ver"]       = "Loader Version";
labels["kernel_ver"]       = "Kernel Version";
labels["engine_ver"]       = "Engine Version";
labels["network_ver"]      = "Network Version";
labels["network_drv_ver"]  = "Network Driver Version";
labels["basic_kernel_ver"] = "Basic Kernel Version";

# Get information about the device.

var url_list = make_list(
             "/printer/info",
             "/cgi-bin/dynamic/config/reports/deviceinfo.html",
             "/cgi-bin/dynamic/information.html?path=/printer/info",
             "/cgi-bin/dynamic/printer/config/reports/deviceinfo.html");

var info = "";

var url, ver_txt, line, element, start_pat, end_pat;
foreach url (url_list)
{
  res = http_send_recv3(method: "GET", item:url, port:port,exit_on_fail:TRUE);

  if (">Printer Revision Levels:<" >< res[1] || ">Printer Revision Levels:<" >< res[2])
  {
    # Version info is either in res[1] or res[2]
    if(">Printer Revision Levels:<" >< res[1])
      res = res[1];
    else
      res = res[2];

    pat = ">([A-Za-z0-9_]+[. ][0-9A-Za-z_-]+[.]*([A-Za-z0-9_-]+)?)</";
    ver_txt = "";

    foreach line (split(res))
    {
      # Set a flag if we find one of the elements
      # we are looking for, and then extract the
      # version from the next line.
     if(">Basic Kernel</" >< line)
         ver_txt = "basic_kernel_ver";
     else if (">Kernel</" >< line)
         ver_txt =  "kernel_ver";
     else if (">Base</" >< line)
         ver_txt =  "base_ver";
      else if (">Network Drvr</" >< line)
         ver_txt =  "network_drv_ver";
      else if (">Engine</" >< line)
         ver_txt =  "engine_ver";
      else if ( ">Network</" >< line)
         ver_txt =  "network_ver";
      else if(ver_txt && ereg(pattern:pat,string:line))
      {
        matches = eregmatch(pattern:pat,string:line);
        if(matches && matches[1])
        {
          data[ver_txt] = matches[1];
          info +=  data[ver_txt];
          ver_txt = "";
        }
      }
    }
  }

  else if(">Device Information<" >< res[2])
  {
    start_pat = "<TR><TD>.+>";
    end_pat   = "</P></TD><TD><P> *= *([A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+) *</P><";

    ver_txt = make_array();

    ver_txt["Engine"]        = "engine_ver";
    ver_txt["Loader"]        = "loader_ver";
    ver_txt["Base"]          = "base_ver";
    ver_txt["Network"]       = "network_ver";
    ver_txt["Network Drvr"]  = "network_drv_ver";

    foreach line (split(res[2]))
    {
      foreach element (make_list("Engine","Loader","Base","Network", "Network Drvr"))
      {
        if(ereg(pattern:start_pat + element + end_pat, string:line, icase:TRUE))
        {
          matches = eregmatch(pattern:start_pat + element + end_pat,string:line, icase:TRUE);
          if(matches && matches[1])
          {
            data[ver_txt[element]] = matches[1];
            info += data[ver_txt[element]];
            break;
          }
        }
      }
    }
  }
  if (info) break;
}

if(!info && !data["model"])
  audit(AUDIT_UNKNOWN_WEB_SERVER_VER, "the Lexmark printer", port);

# Extract the max_label_len, to make the final report
# cleaner.

var max_label_len = 0;

var key, label;
foreach key (keys(data))
{
  label = labels[key];
  if (strlen(label) > max_label_len) max_label_len = strlen(label);
}

var info2 = "";

var val;
foreach key (make_list("port", "model", "base_ver", "engine_ver", "loader_ver", "network_ver", "network_drv_ver","kernel_ver" ,"basic_kernel_ver"))
{
  if (!isnull(data[key]))
  {
    val = data[key];
    set_kb_item(name:kb_base+"/"+key, value:val);

    label = labels[key];
    if (key == "model") val = 'Lexmark ' + val;
    info2 += '  ' + label + crap(data:" ", length:max_label_len-strlen(label)) + ' : ' + val + '\n';
  }
}

var report;

if (info2)
{
  report = '\n' + info2;
  security_report_v4(port:port, extra:report, severity:SECURITY_NOTE);
  exit(0);
}
else
{
  audit(AUDIT_UNKNOWN_WEB_SERVER_VER, "the Lexmark printer", port);
}

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation