Skip to content

Commit

Permalink
Make sure to use version_intensity checks for version category scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Jul 27, 2017
1 parent 091eddf commit 5906182
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/bacnet-info.nse
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ categories = {"discovery", "version"}
--
--

portrule = shortport.port_or_service(47808, "bacnet", {"udp","tcp"})
portrule = shortport.version_port_or_service(47808, "bacnet", {"udp","tcp"})

---
-- Table to look up the Vendor Name based on Vendor ID
Expand Down
2 changes: 2 additions & 0 deletions scripts/fingerprint-strings.nse
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ categories = {"version"}

portrule = function (host, port)
-- Run for any port that has a service fingerprint indicating an unknown service
-- OK to run at any version intensity (e.g. not checking nmap.version_intensity)
-- because no traffic is sent and lower intensity is more likely to not match.
return port.version and port.version.service_fp
end

Expand Down
2 changes: 1 addition & 1 deletion scripts/fox-info.nse
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"discovery", "version"}


portrule = shortport.port_or_service({1911, 4911}, "niagara-fox", "tcp")
portrule = shortport.version_port_or_service({1911, 4911}, "niagara-fox", "tcp")

-- Action Function that is used to run the NSE. This function will send the
-- initial query to the host and port that were passed in via nmap. The
Expand Down
4 changes: 3 additions & 1 deletion scripts/hnap-info.nse
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ categories = {
}


portrule = shortport.http
portrule = function(host, port)
return (shortport.http(host,port) and nmap.version_intensity() >= 7)
end

local ELEMENTS = {["Type"] = "Type",
["DeviceName"] = "Device",
Expand Down
2 changes: 1 addition & 1 deletion scripts/omron-info.nse
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ categories = {"discovery", "version"}
-- Function to define the portrule as per nmap standards
--
--
portrule = shortport.port_or_service(9600, "fins", {"tcp", "udp"})
portrule = shortport.version_port_or_service(9600, "fins", {"tcp", "udp"})

---
-- Function to set the nmap output for the host, if a valid OMRON FINS packet
Expand Down
5 changes: 4 additions & 1 deletion scripts/rpcinfo.nse
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ categories = {"discovery", "default", "safe", "version"}


-- don't match "rpcbind" because that's what version scan labels any RPC service
portrule = shortport.portnumber(111, {"tcp", "udp"} )
portrule = function(host, port)
return nmap.version_intensity() >= 7 and
shortport.portnumber(111, {"tcp", "udp"})(host, port)
end

action = function(host, port)

Expand Down
2 changes: 1 addition & 1 deletion scripts/s7-info.nse
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ categories = {"discovery", "version"}


-- port rule for devices running on TCP/102
portrule = shortport.port_or_service(102, "iso-tsap", "tcp")
portrule = shortport.version_port_or_service(102, "iso-tsap", "tcp")

---
-- Function to send and receive the S7COMM Packet
Expand Down

0 comments on commit 5906182

Please sign in to comment.