mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 20:51:30 +00:00
merge soc07 r5109, r5117 - Modified some of the scripts to use NSELib for portrule
This commit is contained in:
@@ -13,19 +13,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
-- categories = {"safe"}
|
-- categories = {"safe"}
|
||||||
categories = {"intrusive"}
|
categories = {"intrusive"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if
|
|
||||||
( port.number == 80
|
portrule = shortport.port_or_service({80, 8080}, "http")
|
||||||
or port.number == 8080
|
|
||||||
or port.service == "http")
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket
|
local socket
|
||||||
|
|||||||
@@ -12,21 +12,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
categories = {"discovery", "intrusive"}
|
categories = {"discovery", "intrusive"}
|
||||||
|
|
||||||
require('stdnse')
|
require('stdnse')
|
||||||
|
require "shortport"
|
||||||
|
|
||||||
portrule = function(host, port)
|
portrule = shortport.portnumber({1433, 1434}, "udp", {"open", "open|filtered"})
|
||||||
if
|
|
||||||
( port.number == 1433
|
|
||||||
or port.number == 1434 )
|
|
||||||
and port.protocol == "udp"
|
|
||||||
-- if we only run against open or open|filtered ports anyway, leave next two lines commented
|
|
||||||
-- and ( port.state == "open"
|
|
||||||
-- or port.state == "open|filtered" )
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"backdoor"}
|
categories = {"backdoor"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if (port.number == 5900
|
|
||||||
or port.service == "vnc")
|
portrule = shortport.port_or_service(5900, "vnc")
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
|
|||||||
@@ -14,18 +14,11 @@ id="Open Relay SMTP"
|
|||||||
description="Checks to see if a SMTP server is an open relay"
|
description="Checks to see if a SMTP server is an open relay"
|
||||||
categories = {"demo"}
|
categories = {"demo"}
|
||||||
|
|
||||||
|
require "shortport"
|
||||||
|
|
||||||
ourdomain="scanme.org"
|
ourdomain="scanme.org"
|
||||||
|
|
||||||
portrule = function(host, port)
|
portrule = shortport.port_or_service(25, "smtp")
|
||||||
if (port.number == 25
|
|
||||||
or port.service == "smtp")
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
|
|||||||
@@ -12,19 +12,9 @@ author = "Jason DePriest <jrdepriest@gmail.com>"
|
|||||||
license = "See nmaps COPYING for licence"
|
license = "See nmaps COPYING for licence"
|
||||||
categories = {"discovery", "intrusive"}
|
categories = {"discovery", "intrusive"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if (port.number == 25
|
|
||||||
or port.number == 587
|
portrule = shortport.port_or_service({25, 587, 465}, "smtp")
|
||||||
or port.number == 465
|
|
||||||
or port.service == "smtp")
|
|
||||||
and port.state == "open"
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -11,19 +11,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"discovery", "safe"}
|
categories = {"discovery", "safe"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if
|
|
||||||
port.number == 161
|
portrule = shortport.portnumber(161, "udp", {"open", "open|filtered"})
|
||||||
and port.protocol == "udp"
|
|
||||||
-- if we only run against open or open|filtered ports anyway, leave next two lines commented
|
|
||||||
-- and ( port.state == "open"
|
|
||||||
-- or port.state == "open|filtered" )
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -4,17 +4,9 @@ author = "Brandon Enright <bmenrigh@ucsd.edu>"
|
|||||||
license = "See nmaps COPYING for licence"
|
license = "See nmaps COPYING for licence"
|
||||||
categories = {"intrusive"}
|
categories = {"intrusive"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if (port.number == 22
|
|
||||||
or port.service == "ssh")
|
portrule = shortport.port_or_service(22, "ssh")
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
|
|||||||
@@ -5,20 +5,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"intrusive"}
|
categories = {"intrusive"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if ( port.number == 443
|
|
||||||
or port.service == "ssl/http"
|
|
||||||
or port.service == "ssl"
|
|
||||||
or port.service == "https")
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
portrule = shortport.port_or_service(443, {"ssl/http", "ssl", "https"})
|
||||||
|
|
||||||
hex2dec = function(hex)
|
hex2dec = function(hex)
|
||||||
|
|
||||||
|
|||||||
@@ -8,17 +8,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"intrusive"}
|
categories = {"intrusive"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if (port.number == 21
|
|
||||||
or port.service == "ftp")
|
portrule = shortport.port_or_service(21, "ftp")
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
|
|||||||
@@ -8,16 +8,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"demo"}
|
categories = {"demo"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if port.number == 19
|
|
||||||
and port.service == "chargen"
|
portrule = shortport.port_or_service(19, "chargen", "udp")
|
||||||
and port.protocol == "udp"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
|
|||||||
@@ -8,16 +8,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"demo"}
|
categories = {"demo"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if port.number == 13
|
|
||||||
and port.service == "daytime"
|
portrule = shortport.port_or_service(13, "daytime", "udp")
|
||||||
and port.protocol == "udp"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
|
|||||||
@@ -9,16 +9,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
categories = {"intrusive"}
|
categories = {"intrusive"}
|
||||||
|
|
||||||
require "bit"
|
require "bit"
|
||||||
|
require "shortport"
|
||||||
|
|
||||||
portrule = function(host, port)
|
portrule = shortport.portnumber(53, "udp")
|
||||||
if port.number == 53
|
|
||||||
and port.protocol == "udp"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"demo"}
|
categories = {"demo"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if port.number == 7
|
|
||||||
and port.service == "echo"
|
portrule = shortport.port_or_service(7, "echo", "udp")
|
||||||
and port.protocol == "udp"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local echostr = "hello there"
|
local echostr = "hello there"
|
||||||
|
|||||||
@@ -8,17 +8,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"discovery"}
|
categories = {"discovery"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if (port.number == 79
|
|
||||||
or port.service == "finger")
|
portrule = shortport.port_or_service(79, "finger")
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
|
|||||||
@@ -5,16 +5,9 @@ license="See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"intrusive"}
|
categories = {"intrusive"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if port.service == "ftp"
|
|
||||||
and port.protocol == "tcp"
|
portrule = shortport.service("ftp")
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
line_iterate = function(s)
|
line_iterate = function(s)
|
||||||
local line
|
local line
|
||||||
|
|||||||
@@ -9,15 +9,9 @@ license = "See nmap's COPYING for license"
|
|||||||
|
|
||||||
categories = {"safe", "discovery"}
|
categories = {"safe", "discovery"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if port.number == 4569 and
|
|
||||||
port.protocol == "udp"
|
portrule = shortport.portnumber(4569, "udp")
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local soc = nmap.new_socket()
|
local soc = nmap.new_socket()
|
||||||
|
|||||||
@@ -9,14 +9,9 @@ license = "See Nmap's COPYING"
|
|||||||
categories = {"discovery"}
|
categories = {"discovery"}
|
||||||
|
|
||||||
require("stdnse")
|
require("stdnse")
|
||||||
|
require "shortport"
|
||||||
|
|
||||||
portrule = function(host, port)
|
portrule = shortport.port_or_service(6667, "irc")
|
||||||
return (portnumber == 6667 or port.service == "irc")
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init = function()
|
init = function()
|
||||||
-- Start of MOTD, we'll take the server name from here
|
-- Start of MOTD, we'll take the server name from here
|
||||||
|
|||||||
@@ -9,19 +9,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"malware"}
|
categories = {"malware"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if
|
|
||||||
( port.number == 113
|
|
||||||
or port.service == "auth")
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
portrule = shortport.port_or_service(113, "auth")
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local status = 0
|
local status = 0
|
||||||
|
|||||||
@@ -16,25 +16,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"malware"}
|
categories = {"malware"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
local decision
|
|
||||||
if
|
|
||||||
( port.number == 7955
|
|
||||||
or
|
|
||||||
port.number == 14920
|
|
||||||
or
|
|
||||||
port.number == 42260)
|
|
||||||
and port.service == "ftp"
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
decision = true
|
|
||||||
else
|
|
||||||
decision = false
|
|
||||||
end
|
|
||||||
|
|
||||||
return decision
|
portrule = shortport.port_or_service({7955, 14920, 42260}, "ftp")
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
|
|||||||
@@ -9,21 +9,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"backdoor"}
|
categories = {"backdoor"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
local decision
|
|
||||||
if
|
|
||||||
( port.number == 8888
|
|
||||||
or port.service == "auth")
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
decision = true
|
|
||||||
else
|
|
||||||
decision = false
|
|
||||||
end
|
|
||||||
|
|
||||||
return decision
|
portrule = shortport.port_or_service(8888, "auth")
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local status = 0
|
local status = 0
|
||||||
|
|||||||
@@ -17,24 +17,9 @@ categories = {""}
|
|||||||
|
|
||||||
runlevel = 1.0
|
runlevel = 1.0
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
|
|
||||||
|
portrule = shortport.port_or_service(80, "http")
|
||||||
if
|
|
||||||
-- remove next line if you really want to run this script
|
|
||||||
false and
|
|
||||||
( port.number == 80
|
|
||||||
or port.service == "http" )
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
-- and host.name ~= nil
|
|
||||||
-- and string.match(host.name, "www.+")
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -8,22 +8,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"demo"}
|
categories = {"demo"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
local decision
|
|
||||||
|
|
||||||
if
|
portrule = shortport.port_or_service(25, "smtp")
|
||||||
( port.number == 25
|
|
||||||
or port.service == "smtp")
|
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
decision = true
|
|
||||||
else
|
|
||||||
decision = false
|
|
||||||
end
|
|
||||||
|
|
||||||
return decision
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -9,17 +9,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"demo"}
|
categories = {"demo"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if
|
|
||||||
port.service == "ssh"
|
portrule = shortport.service("ssh")
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local result, socket
|
local result, socket
|
||||||
|
|||||||
@@ -10,17 +10,9 @@ license = "See nmaps COPYING for licence"
|
|||||||
|
|
||||||
categories = {"vulnerability"}
|
categories = {"vulnerability"}
|
||||||
|
|
||||||
portrule = function(host, port)
|
require "shortport"
|
||||||
if port.number == 21
|
|
||||||
and port.service == "ftp"
|
portrule = shortport.port_or_service(21, "ftp")
|
||||||
and port.protocol == "tcp"
|
|
||||||
and port.state == "open"
|
|
||||||
then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
login = function(socket, user, pass)
|
login = function(socket, user, pass)
|
||||||
res = ""
|
res = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user