-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c71421
commit 8e608c3
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
id: db2-discover | ||
|
||
info: | ||
name: Broadcast DB2 Discover | ||
author: pussycat0x | ||
severity: info | ||
description: | | ||
Attempts to discover DB2 servers on the network by sending a broadcast request to port 523/udp. | ||
reference: | ||
- https://nmap.org/nsedoc/scripts/broadcast-db2-discover.html | ||
metadata: | ||
shodan-query: port:523 | ||
tags: ibm,network,js,udp | ||
|
||
javascript: | ||
- pre-condition: | | ||
isUDPPortOpen(Host,Port); | ||
code: | | ||
let packet = bytes.NewBuffer(); | ||
const c = require("nuclei/net"); | ||
const cmd = "DB2GETADDR\0SQL09010\0" | ||
packet.WriteString(cmd) | ||
let conn = c.Open('udp', `${Host}:${Port}`); | ||
conn.SendHex(packet.Hex()); | ||
const result = conn.RecvString() | ||
const cleanedString = result.replace(/\x00/g, ''); | ||
let combinedResult; | ||
if (cleanedString.includes("DB2RETADDRSQL")) { | ||
const regex = /^DB2RETADDRSQL(\d{2})(\d{2})(\d{1})(.*)$/; | ||
const matches = cleanedString.match(regex); | ||
const formattedNumber = matches ? `${matches[1]}.${matches[2]}.${matches[3]}` : ''; | ||
const hostname = matches ? matches[4] : ''; | ||
combinedResult = `Db2 Version: ${formattedNumber}, Hostname: ${hostname}`; | ||
} else { | ||
conn.Close(); | ||
} | ||
combinedResult; | ||
args: | ||
Host: "{{Host}}" | ||
Port: 523 | ||
matchers: | ||
- type: dsl | ||
dsl: | ||
- "success == true" | ||
extractors: | ||
- type: dsl | ||
dsl: | ||
- response |