mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +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 = {"intrusive"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if
|
||||
( port.number == 80
|
||||
or port.number == 8080
|
||||
or port.service == "http")
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service({80, 8080}, "http")
|
||||
|
||||
action = function(host, port)
|
||||
local socket
|
||||
|
||||
@@ -12,21 +12,9 @@ license = "See nmaps COPYING for licence"
|
||||
categories = {"discovery", "intrusive"}
|
||||
|
||||
require('stdnse')
|
||||
require "shortport"
|
||||
|
||||
portrule = function(host, port)
|
||||
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
|
||||
portrule = shortport.portnumber({1433, 1434}, "udp", {"open", "open|filtered"})
|
||||
|
||||
action = function(host, port)
|
||||
|
||||
|
||||
@@ -5,17 +5,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"backdoor"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if (port.number == 5900
|
||||
or port.service == "vnc")
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service(5900, "vnc")
|
||||
|
||||
action = function(host, port)
|
||||
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"
|
||||
categories = {"demo"}
|
||||
|
||||
require "shortport"
|
||||
|
||||
ourdomain="scanme.org"
|
||||
|
||||
portrule = function(host, port)
|
||||
if (port.number == 25
|
||||
or port.service == "smtp")
|
||||
and port.protocol == "tcp"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
portrule = shortport.port_or_service(25, "smtp")
|
||||
|
||||
action = function(host, port)
|
||||
local socket = nmap.new_socket()
|
||||
|
||||
@@ -12,19 +12,9 @@ author = "Jason DePriest <jrdepriest@gmail.com>"
|
||||
license = "See nmaps COPYING for licence"
|
||||
categories = {"discovery", "intrusive"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if (port.number == 25
|
||||
or port.number == 587
|
||||
or port.number == 465
|
||||
or port.service == "smtp")
|
||||
and port.state == "open"
|
||||
and port.protocol == "tcp"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service({25, 587, 465}, "smtp")
|
||||
|
||||
action = function(host, port)
|
||||
|
||||
|
||||
@@ -11,19 +11,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"discovery", "safe"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if
|
||||
port.number == 161
|
||||
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
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.portnumber(161, "udp", {"open", "open|filtered"})
|
||||
|
||||
action = function(host, port)
|
||||
|
||||
|
||||
@@ -4,17 +4,9 @@ author = "Brandon Enright <bmenrigh@ucsd.edu>"
|
||||
license = "See nmaps COPYING for licence"
|
||||
categories = {"intrusive"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if (port.number == 22
|
||||
or port.service == "ssh")
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service(22, "ssh")
|
||||
|
||||
action = function(host, port)
|
||||
local socket = nmap.new_socket()
|
||||
|
||||
@@ -5,20 +5,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"intrusive"}
|
||||
|
||||
portrule = function(host, port)
|
||||
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
|
||||
require "shortport"
|
||||
|
||||
end
|
||||
portrule = shortport.port_or_service(443, {"ssl/http", "ssl", "https"})
|
||||
|
||||
hex2dec = function(hex)
|
||||
|
||||
|
||||
@@ -8,17 +8,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"intrusive"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if (port.number == 21
|
||||
or port.service == "ftp")
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service(21, "ftp")
|
||||
|
||||
action = function(host, port)
|
||||
local socket = nmap.new_socket()
|
||||
|
||||
@@ -8,16 +8,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"demo"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if port.number == 19
|
||||
and port.service == "chargen"
|
||||
and port.protocol == "udp"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service(19, "chargen", "udp")
|
||||
|
||||
action = function(host, port)
|
||||
local socket = nmap.new_socket()
|
||||
|
||||
@@ -8,16 +8,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"demo"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if port.number == 13
|
||||
and port.service == "daytime"
|
||||
and port.protocol == "udp"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service(13, "daytime", "udp")
|
||||
|
||||
action = function(host, port)
|
||||
local socket = nmap.new_socket()
|
||||
|
||||
@@ -9,16 +9,9 @@ license = "See nmaps COPYING for licence"
|
||||
categories = {"intrusive"}
|
||||
|
||||
require "bit"
|
||||
require "shortport"
|
||||
|
||||
portrule = function(host, port)
|
||||
if port.number == 53
|
||||
and port.protocol == "udp"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
portrule = shortport.portnumber(53, "udp")
|
||||
|
||||
action = function(host, port)
|
||||
|
||||
|
||||
@@ -9,16 +9,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"demo"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if port.number == 7
|
||||
and port.service == "echo"
|
||||
and port.protocol == "udp"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service(7, "echo", "udp")
|
||||
|
||||
action = function(host, port)
|
||||
local echostr = "hello there"
|
||||
|
||||
@@ -8,17 +8,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"discovery"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if (port.number == 79
|
||||
or port.service == "finger")
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service(79, "finger")
|
||||
|
||||
action = function(host, port)
|
||||
local socket = nmap.new_socket()
|
||||
|
||||
@@ -5,16 +5,9 @@ license="See nmaps COPYING for licence"
|
||||
|
||||
categories = {"intrusive"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if port.service == "ftp"
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.service("ftp")
|
||||
|
||||
line_iterate = function(s)
|
||||
local line
|
||||
|
||||
@@ -9,15 +9,9 @@ license = "See nmap's COPYING for license"
|
||||
|
||||
categories = {"safe", "discovery"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if port.number == 4569 and
|
||||
port.protocol == "udp"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.portnumber(4569, "udp")
|
||||
|
||||
action = function(host, port)
|
||||
local soc = nmap.new_socket()
|
||||
|
||||
@@ -9,14 +9,9 @@ license = "See Nmap's COPYING"
|
||||
categories = {"discovery"}
|
||||
|
||||
require("stdnse")
|
||||
require "shortport"
|
||||
|
||||
portrule = function(host, port)
|
||||
return (portnumber == 6667 or port.service == "irc")
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
end
|
||||
|
||||
|
||||
portrule = shortport.port_or_service(6667, "irc")
|
||||
|
||||
init = function()
|
||||
-- Start of MOTD, we'll take the server name from here
|
||||
|
||||
@@ -9,19 +9,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"malware"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if
|
||||
( port.number == 113
|
||||
or port.service == "auth")
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
end
|
||||
portrule = shortport.port_or_service(113, "auth")
|
||||
|
||||
action = function(host, port)
|
||||
local status = 0
|
||||
|
||||
@@ -16,25 +16,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"malware"}
|
||||
|
||||
portrule = function(host, port)
|
||||
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
|
||||
require "shortport"
|
||||
|
||||
return decision
|
||||
end
|
||||
portrule = shortport.port_or_service({7955, 14920, 42260}, "ftp")
|
||||
|
||||
action = function(host, port)
|
||||
local socket = nmap.new_socket()
|
||||
|
||||
@@ -9,21 +9,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"backdoor"}
|
||||
|
||||
portrule = function(host, port)
|
||||
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
|
||||
require "shortport"
|
||||
|
||||
return decision
|
||||
end
|
||||
portrule = shortport.port_or_service(8888, "auth")
|
||||
|
||||
action = function(host, port)
|
||||
local status = 0
|
||||
|
||||
@@ -17,24 +17,9 @@ categories = {""}
|
||||
|
||||
runlevel = 1.0
|
||||
|
||||
portrule = function(host, port)
|
||||
require "shortport"
|
||||
|
||||
|
||||
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
|
||||
portrule = shortport.port_or_service(80, "http")
|
||||
|
||||
action = function(host, port)
|
||||
|
||||
|
||||
@@ -8,22 +8,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"demo"}
|
||||
|
||||
portrule = function(host, port)
|
||||
local decision
|
||||
|
||||
if
|
||||
( port.number == 25
|
||||
or port.service == "smtp")
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
decision = true
|
||||
else
|
||||
decision = false
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
return decision
|
||||
end
|
||||
portrule = shortport.port_or_service(25, "smtp")
|
||||
|
||||
action = function(host, port)
|
||||
|
||||
|
||||
@@ -9,17 +9,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"demo"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if
|
||||
port.service == "ssh"
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.service("ssh")
|
||||
|
||||
action = function(host, port)
|
||||
local result, socket
|
||||
|
||||
@@ -10,17 +10,9 @@ license = "See nmaps COPYING for licence"
|
||||
|
||||
categories = {"vulnerability"}
|
||||
|
||||
portrule = function(host, port)
|
||||
if port.number == 21
|
||||
and port.service == "ftp"
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service(21, "ftp")
|
||||
|
||||
login = function(socket, user, pass)
|
||||
res = ""
|
||||
|
||||
Reference in New Issue
Block a user