Merge from Dependencies branch (nmap-exp/patrick/dependencies)

with modifications from [2].

** Short description from [1] **

I have created a patch to NSE that replaces runlevels with a table of
dependencies that clearly outlines what other scripts the script
depends on. The table is of the form:

dependences = {"script1", script2", ...}

Runlevels become an internal representation of the order of scripts
that are generated by the dependencies. Dependencies only enforce
an execution order and not a requirement for execution.

[1] http://seclists.org/nmap-dev/2009/q4/295
[2] http://seclists.org/nmap-dev/2009/q4/446
This commit is contained in:
batrick 2009-12-30 02:34:05 +00:00
parent 0f367454f3
commit 610bd0a55b
24 changed files with 126 additions and 43 deletions

View file

@ -37,8 +37,6 @@ server (your default DNS server, or whichever one you specified with the
author = "jah, Michael"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery", "external", "safe"}
runlevel = 1
local dns = require "dns"

View file

@ -13,7 +13,6 @@ increase in the level of verbosity requested on the command line.
author = "jah <jah at zadkiel.plus.com>"
license = "See Nmap License: http://nmap.org/book/man-legal.html"
runlevel = 1
categories = {"discovery", "safe"}

View file

@ -59,7 +59,6 @@ require('dns')
author = 'Eddie Bell'
license = 'Same as Nmap--See http://nmap.org/book/man-legal.html'
categories = {'default', 'intrusive', 'discovery'}
runlevel = 1.0
portrule = shortport.portnumber(53, 'tcp')

View file

@ -67,9 +67,6 @@ author = "Ron Bowes (with research from Symantec Security Response)"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"default","safe"}
-- Set the runlevel to 2. This means this script will run last, but it will also run in parallel with smb-check-vulns.nse,
-- which will generally be run at the same time. So, by setting this to 2, we increase our parallelism.
runlevel = 2
require 'smb'
require 'stdnse'

View file

@ -24,7 +24,6 @@ require('http')
author = "Eddie Bell"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"default", "discovery", "safe"}
runlevel = 1.0
portrule = shortport.port_or_service({80, 8080,443}, {"http","https"})
local last_len = 0

View file

@ -33,7 +33,7 @@ When an account is discovered, it's saved in the <code>smb</code> module (which
registry). If an account is already saved, the account's privileges are checked; accounts
with administrator privileges are kept over accounts without. The specific method for checking
is by calling GetShareInfo("IPC$"), which requires administrative privileges. Once this script
is finished (since it's runlevel 0.5, it'll run first), other scripts will use the saved account
is finished (all other smb scripts depend on it, it'll run first), other scripts will use the saved account
to perform their checks.
The blank password is always tried first, followed by "special passwords" (such as the username
@ -95,8 +95,6 @@ determined with a fairly efficient bruteforce. For example, if the actual passwo
author = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
-- Set the runlevel to <1 to ensure that it runs before other scripts
runlevel = 0.5
categories = {"intrusive", "auth"}

View file

@ -79,9 +79,15 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"intrusive","exploit","dos","vuln"}
-- Set the runlevel to >2 so this runs last (so if it DOES crash something, it doesn't
-- till other scans have had a chance to run)
runlevel = 2
-- run after all smb-* scripts (so if it DOES crash something, it doesn't till
-- other scans have had a chance to run)
dependencies = {
"smb-brute", smb-enum-sessions", "smb-security-mode",
"smb-check-vulns", "smb-enum-shares", "smb-server-stats",
"smb-enum-domains", "smb-enum-users", "smb-system-info",
"smb-enum-groups", "smb-os-discovery", "smb-enum-processes",
"smb-psexec",
};
require 'msrpc'
require 'smb'

View file

@ -52,6 +52,7 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery","intrusive"}
dependencies = {"smb-brute"}
require 'msrpc'
require 'smb'

View file

@ -57,6 +57,7 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery","intrusive"}
dependencies = {"smb-brute"}
require 'msrpc'
require 'smb'

View file

@ -76,6 +76,7 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery", "intrusive"}
dependencies = {"smb-brute"}
require "bin"
require "msrpc"

View file

@ -58,6 +58,7 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery","intrusive"}
dependencies = {"smb-brute"}
require 'msrpc'
require 'smb'

View file

@ -57,6 +57,7 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery","intrusive"}
dependencies = {"smb-brute"}
require 'msrpc'
require 'smb'

View file

@ -136,6 +136,7 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery","intrusive"}
dependencies = {"smb-brute"}
require 'msrpc'
require 'smb'

View file

@ -37,6 +37,7 @@ they likely won't change the outcome in any meaningful way.
author = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"default", "discovery", "safe"}
dependencies = {"smb-brute"}
require 'smb'
require 'stdnse'

View file

@ -406,6 +406,7 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"intrusive"}
dependencies = {"smb-brute"}
require 'bit'
require 'msrpc'

View file

@ -29,6 +29,7 @@ set the username and password, etc.), but it probably won't ever require them.
author = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery", "safe"}
dependencies = {"smb-brute"}
require 'smb'
require 'stdnse'

View file

@ -30,6 +30,7 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery","intrusive"}
dependencies = {"smb-brute"}
require 'msrpc'
require 'smb'

View file

@ -48,6 +48,7 @@ author = "Ron Bowes"
copyright = "Ron Bowes"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery","intrusive"}
dependencies = {"smb-brute"}
require 'msrpc'
require 'smb'

View file

@ -17,9 +17,6 @@ categories = {"intrusive", "auth"}
require "shortport"
require "snmp"
-- runs before snmp-sysdescr.nse
runlevel = 1
portrule = shortport.portnumber(161, "udp", {"open", "open|filtered"})
action = function(host, port)

View file

@ -13,12 +13,11 @@ license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"default", "discovery", "safe"}
dependencies = {"snmp-brute"}
require "shortport"
require "snmp"
-- runs after snmp-brute.nse
runlevel = 2
portrule = shortport.portnumber(161, "udp", {"open", "open|filtered"})
---

View file

@ -25,7 +25,6 @@ require('nsedebug')
author = "Eddie Bell"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"intrusive", "vuln"}
runlevel = 1.0
-- Change this to increase depth of crawl
local maxdepth = 10

View file

@ -75,7 +75,6 @@ the RIRs.
author = "jah <jah at zadkiel.plus.com>"
license = "See Nmap License: http://nmap.org/book/man-legal.html"
runlevel = 1
categories = {"discovery", "external", "safe"}
local url = require "url"