Lucene search
+L

Juniper Networks Junos OS Detection (SSH Login)

🗓️ 13 Jul 2011 00:00:00Reported by Copyright (C) 2011 Greenbone AGType 
openvas
 openvas
🔗 plugins.openvas.org👁 17 Views

Juniper Networks Junos OS Detection (SSH Login) program for detecting Junos OS via SSH

Code
# SPDX-FileCopyrightText: 2011 Greenbone AG
# Some text descriptions might be excerpted from (a) referenced
# source(s), and are Copyright (C) by the respective right holder(s).
#
# SPDX-License-Identifier: GPL-2.0-only

if(description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.96200");
  script_version("2026-03-20T16:33:06+0000");
  script_tag(name:"last_modification", value:"2026-03-20 16:33:06 +0000 (Fri, 20 Mar 2026)");
  script_tag(name:"creation_date", value:"2011-07-13 11:48:37 +0200 (Wed, 13 Jul 2011)");
  script_tag(name:"cvss_base", value:"0.0");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N");

  script_tag(name:"qod_type", value:"package");

  script_name("Juniper Networks Junos OS Detection (SSH Login)");

  script_copyright("Copyright (C) 2011 Greenbone AG");
  script_category(ACT_GATHER_INFO);
  script_family("Product detection");
  script_dependencies("gather-package-list.nasl");
  script_mandatory_keys("junos/detected");

  script_tag(name:"summary", value:"SSH login-based detection of Juniper Networks Junos OS.");

  exit(0);
}

include("ssh_func.inc");

if (!soc = ssh_login_or_reuse_connection())
  exit(0);

port = get_kb_item("ssh/login/juniper/junos/port");

if (get_kb_item("junos/cli"))
  sysversion = ssh_cmd(socket: soc, cmd: "show version detail | no-more", nosh: TRUE);
else
  sysversion = ssh_cmd(socket: soc, cmd: "cli show version detail | no-more");

# Some models/versions don't allow to use a pipe in cli. The first page should contain the needed
# info however.
if (!sysversion)
  sysversion = ssh_cmd(socket:soc, cmd:"cli show version detail");

if (!sysversion || "JUNOS" >!< sysversion || sysversion =~ "Junos: [0-9][^E]+\-EVO")
  exit(0);

version = "unknown";
model = "unknown";
build = "unknown";

set_kb_item(name: "juniper/junos/detected", value: TRUE);
set_kb_item(name: "juniper/junos/ssh-login/port", value: port);
set_kb_item(name: "juniper/junos/ssh-login/" + port + "/concluded", value: sysversion);

set_kb_item(name: "junos/show_version", value: sysversion);

# Junos: 22.3R1.11
vers = eregmatch(pattern: 'Junos: ([^\r\n]+)', string: sysversion);
if (isnull(vers[1]) )
  vers = eregmatch(pattern: "KERNEL ([^ ]+) .+on ([0-9]{4}-[0-9]{2}-[0-9]{2})", string: sysversion);

if (!isnull(vers[1]))
  version = vers[1];

b = eregmatch(pattern: "KERNEL ([^ ]+) .+on ([0-9]{4}-[0-9]{2}-[0-9]{2})", string: sysversion);
if (!isnull(b[2]))
  build = b[2];

# Model: vSRX
mod = eregmatch(pattern: 'Model: ([^\r\n]+)', string: sysversion);
if (!isnull(mod[1]))
  model = mod[1];

set_kb_item(name: "juniper/junos/ssh-login/" + port + "/version", value: version);
set_kb_item(name: "juniper/junos/ssh-login/" + port + "/model", value: model);
set_kb_item(name: "juniper/junos/ssh-login/" + port + "/build_date", value: build);

exit(0);

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