159 lines
6.9 KiB
YAML
159 lines
6.9 KiB
YAML
id: smb-os-detect
|
|
|
|
info:
|
|
name: SMB Operating System - Detect
|
|
author: pussycat0x
|
|
severity: info
|
|
description: |
|
|
Detect Operating System
|
|
reference:
|
|
- https://nmap.org/nsedoc/scripts/smb-os-discovery.html
|
|
metadata:
|
|
max-request: 1
|
|
shodan-query: "port:445"
|
|
tags: js,network,smb,enum,os
|
|
javascript:
|
|
- code: |
|
|
var m = require("nuclei/smb");
|
|
var c = new m.SMBClient();
|
|
var response = c.ListSMBv2Metadata(Host, Port);
|
|
if (response.OSVersion === "6.3.9600") {
|
|
osInfo = "Windows 8.1";
|
|
} else if (response.OSVersion === "3.10.511") {
|
|
osInfo = "Windows NT 3.1";
|
|
} else if (response.OSVersion === "3.50.807") {
|
|
osInfo = "Windows NT 3.5";
|
|
} else if (response.OSVersion === "3.10.528") {
|
|
osInfo = "Windows NT 3.1, Service Pack 3";
|
|
} else if (response.OSVersion === "3.51.1057") {
|
|
osInfo = "Windows NT 3.51";
|
|
} else if (response.OSVersion === "4.00.950") {
|
|
osInfo = "Windows 95";
|
|
} else if (response.OSVersion === "4.00.950A") {
|
|
osInfo = "Windows 95 OEM Service Release 1";
|
|
} else if (response.OSVersion === "4.00.950B") {
|
|
osInfo = "Windows 95 OEM Service Release 2";
|
|
} else if (response.OSVersion === "4.0.1381") {
|
|
osInfo = "Windows NT 4.0";
|
|
} else if (response.OSVersion === "4.00.950B") {
|
|
osInfo = "Windows 95 OEM Service Release 2.1";
|
|
} else if (response.OSVersion === "4.00.950C") {
|
|
osInfo = "OEM Service Release 2.5";
|
|
} else if (response.OSVersion === "4.10.1998") {
|
|
osInfo = "Windows 98";
|
|
} else if (response.OSVersion === "4.10.2222") {
|
|
osInfo = "Windows 98 Second Edition (SE)";
|
|
} else if (response.OSVersion === "5.0.2195") {
|
|
osInfo = "Windows 2000";
|
|
} else if (response.OSVersion === "4.90.3000") {
|
|
osInfo = "Windows Me";
|
|
} else if (response.OSVersion === "5.1.2600") {
|
|
osInfo = "Windows XP";
|
|
} else if (response.OSVersion === "5.1.2600.1105-1106") {
|
|
osInfo = "Windows XP, Service Pack 1";
|
|
} else if (response.OSVersion === "5.2.3790") {
|
|
osInfo = "Windows Server 2003";
|
|
} else if (response.OSVersion === "5.1.2600.2180") {
|
|
osInfo = "Windows XP, Service Pack 2";
|
|
} else if (response.OSVersion === "5.2.3790.1180") {
|
|
osInfo = "Windows Server 2003, Service Pack 1";
|
|
} else if (response.OSVersion === "5.2.3790") {
|
|
osInfo = "Windows Server 2003 R2";
|
|
} else if (response.OSVersion === "6.0.6000") {
|
|
osInfo = "Windows Vista";
|
|
} else if (response.OSVersion === "5.2.3790") {
|
|
osInfo = "Windows Server 2003, Service Pack 2";
|
|
} else if (response.OSVersion === "5.2.4500") {
|
|
osInfo = "Windows Home Server";
|
|
} else if (response.OSVersion === "6.0.6001") {
|
|
osInfo = "Windows Vista, Service Pack 1";
|
|
} else if (response.OSVersion === "6.0.6001") {
|
|
osInfo = "Windows Server 2008";
|
|
} else if (response.OSVersion === "5.1.2600") {
|
|
osInfo = "Windows XP, Service Pack 3";
|
|
} else if (response.OSVersion === "6.0.6002") {
|
|
osInfo = "Windows Vista, Service Pack 2";
|
|
} else if (response.OSVersion === "6.0.6002") {
|
|
osInfo = "Windows Server 2008, Service Pack 2";
|
|
} else if (response.OSVersion === "6.1.7600") {
|
|
osInfo = "Windows 7";
|
|
} else if (response.OSVersion === "6.1.7600") {
|
|
osInfo = "Windows Server 2008 R2";
|
|
} else if (response.OSVersion === "6.1.7601") {
|
|
osInfo = "Windows 7, Service Pack 1";
|
|
} else if (response.OSVersion === "6.1.7601") {
|
|
osInfo = "Windows Server 2008 R2, Service Pack ";
|
|
} else if (response.OSVersion === "6.1.8400") {
|
|
osInfo = "Windows Home Server 2011";
|
|
} else if (response.OSVersion === "6.2.9200") {
|
|
osInfo = "Windows Server 2012";
|
|
} else if (response.OSVersion === "6.2.9200") {
|
|
osInfo = "Windows 8";
|
|
} else if (response.OSVersion === "6.3.9600") {
|
|
osInfo = "Windows 8.1";
|
|
} else if (response.OSVersion === "6.3.9600") {
|
|
osInfo = "Windows Server 2012 R2";
|
|
} else if (response.OSVersion === "10.0.10240") {
|
|
osInfo = "Windows 10, Version 1507";
|
|
} else if (response.OSVersion === "10.0.10586") {
|
|
osInfo = "Windows 10, Version 1511";
|
|
} else if (response.OSVersion === "10.0.14393") {
|
|
osInfo = "Windows 10, Version 1607";
|
|
} else if (response.OSVersion === "10.0.14393") {
|
|
osInfo = "Windows Server 2016, Version 1607";
|
|
} else if (response.OSVersion === "10.0.15063") {
|
|
osInfo = "Windows 10, Version 1703";
|
|
} else if (response.OSVersion === "10.0.16299") {
|
|
osInfo = "Windows 10, Version 1709";
|
|
} else if (response.OSVersion === "10.0.17134") {
|
|
osInfo = "Windows 10, Version 1803";
|
|
} else if (response.OSVersion === "10.0.17763") {
|
|
osInfo = "Windows Server 2019, Version 1809";
|
|
} else if (response.OSVersion === "10.0.17763") {
|
|
osInfo = "Windows 10, Version 1809";
|
|
} else if (response.OSVersion === "6.0.6003") {
|
|
osInfo = "Windows Server 2008, Service Pack 2, Rollup KB4489887";
|
|
} else if (response.OSVersion === "10.0.18362") {
|
|
osInfo = "Windows 10, Version 1903";
|
|
} else if (response.OSVersion === "10.0.18363") {
|
|
osInfo = "Windows 10, Version 1909";
|
|
} else if (response.OSVersion === "10.0.18363") {
|
|
osInfo = "Windows Server, Version 1909";
|
|
} else if (response.OSVersion === "10.0.19041") {
|
|
osInfo = "Windows 10, Version 2004";
|
|
} else if (response.OSVersion === "10.0.19041") {
|
|
osInfo = "Windows Server, Version 2004";
|
|
} else if (response.OSVersion === "10.0.19042") {
|
|
osInfo = "Windows 10, Version 20H2";
|
|
} else if (response.OSVersion === "10.0.19042") {
|
|
osInfo = "Windows Server, Version 20H2";
|
|
} else if (response.OSVersion === "10.0.19043") {
|
|
osInfo = "Windows 10, Version 21H1";
|
|
} else if (response.OSVersion === "10.0.20348") {
|
|
osInfo = "Windows Server 2022, Version 21H2";
|
|
} else if (response.OSVersion === "10.0.22000") {
|
|
osInfo = "Windows 11, Version 21H2";
|
|
} else if (response.OSVersion === "10.0.19044") {
|
|
osInfo = "Windows 10, Version 21H2";
|
|
} else if (response.OSVersion === "10.0.22621") {
|
|
osInfo = "Windows 11, Version 22H2";
|
|
} else if (response.OSVersion === "10.0.19045") {
|
|
osInfo = "Windows 10, Version 22H2";
|
|
} else if (response.OSVersion === "10.0.25398") {
|
|
osInfo = "Windows Server, Version 23H2";
|
|
} else if (response.OSVersion === "10.0.22631") {
|
|
osInfo = "Windows 11, Version 23H2";
|
|
} else if (response.OSVersion !== "0") {
|
|
osInfo = response.OSVersion;
|
|
}
|
|
osInfo;
|
|
|
|
args:
|
|
Host: "{{Host}}"
|
|
Port: "445"
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- response
|
|
# digest: 4a0a00473045022100df4701782934e9b9355107ec589a67d6a14213c733425996850f43a1b727fffe022036d2fe369dc55006ad286f26b7c1692ecacc8bdec6a02db5344e7a5ae53c12db:922c64590222798bb761d5b6d8e72950 |