OXIESEC PANEL
- Current Dir:
/
/
usr
/
share
/
nmap
/
nselib
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2020 12:36:00 PM
rwxr-xr-x
📄
afp.lua
71.92 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ajp.lua
16.69 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
amqp.lua
10.5 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
anyconnect.lua
4.45 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
asn1.lua
14.57 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
base32.lua
7.33 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
base64.lua
5.67 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bin.lua
12.89 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bit.lua
2.43 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bitcoin.lua
16.99 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bits.lua
1.82 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bittorrent.lua
40.77 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bjnp.lua
9.45 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
brute.lua
50.04 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
cassandra.lua
5.78 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
citrixxml.lua
16 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
coap.lua
76.24 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
comm.lua
10.75 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
creds.lua
18.22 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
cvs.lua
3.13 KB
04/16/2018 01:11:39 AM
rw-r--r--
📁
data
-
08/07/2020 12:36:00 PM
rwxr-xr-x
📄
datafiles.lua
11.05 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
datetime.lua
1.16 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dhcp.lua
29.17 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dhcp6.lua
19.87 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dns.lua
51.44 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dnsbl.lua
19.02 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dnssd.lua
12.57 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
drda.lua
24.2 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
eap.lua
7.64 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
eigrp.lua
14.47 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
formulas.lua
5.35 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ftp.lua
9.03 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
geoip.lua
1.71 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
giop.lua
18.44 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
gps.lua
3.05 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
http.lua
105.81 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
httpspider.lua
36.15 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
iax2.lua
9.6 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ike.lua
15.02 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
imap.lua
9.59 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
informix.lua
39.76 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ipOps.lua
26.92 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ipmi.lua
10.02 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ipp.lua
12.54 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
irc.lua
757 bytes
04/16/2018 01:11:39 AM
rw-r--r--
📄
iscsi.lua
21.45 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
isns.lua
15.34 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
jdwp.lua
43.57 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
json.lua
11.65 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ldap.lua
31.86 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
lfs.luadoc
1.68 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
libssh2-utility.lua
4.39 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
libssh2.luadoc
4.75 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
listop.lua
4.66 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
lpeg-utility.lua
5.64 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
lpeg.luadoc
351 bytes
04/16/2018 01:11:39 AM
rw-r--r--
📄
ls.lua
10.96 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
match.lua
2.05 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
membase.lua
9.88 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mobileme.lua
8.46 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mongodb.lua
21.29 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mqtt.lua
28.95 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
msrpc.lua
179.93 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
msrpcperformance.lua
29.72 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
msrpctypes.lua
167.61 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mssql.lua
110.87 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
multicast.lua
6.1 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mysql.lua
17.09 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
natpmp.lua
5.04 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ncp.lua
36 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ndmp.lua
11.58 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
netbios.lua
13.9 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
nmap.luadoc
40.34 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
nrpc.lua
4.42 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
nsedebug.lua
3.49 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
omp2.lua
4.77 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
openssl.luadoc
7.08 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ospf.lua
15.29 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
packet.lua
36.65 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
pcre.luadoc
6.79 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
pgsql.lua
20.61 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
pop3.lua
5.7 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
pppoe.lua
29.95 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
proxy.lua
12.04 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rdp.lua
11.05 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
re.lua
8.22 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
redis.lua
3.59 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rmi.lua
47.89 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rpc.lua
106.22 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rpcap.lua
11.19 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rsync.lua
5.19 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rtsp.lua
8.67 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
sasl.lua
16.38 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
shortport.lua
8.01 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
sip.lua
30.56 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
slaxml.lua
17.9 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
smb.lua
175.85 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
smb2.lua
16.32 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
smbauth.lua
37.53 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
smtp.lua
19.81 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
snmp.lua
15.99 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
socks.lua
8.26 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
srvloc.lua
12.25 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ssh1.lua
8.88 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ssh2.lua
11.88 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
sslcert.lua
33.34 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
sslv2.lua
9.63 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
stdnse.lua
45.93 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
strbuf.lua
4.52 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
strict.lua
2.53 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
stun.lua
11.51 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tab.lua
3.35 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
target.lua
3.93 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tftp.lua
9.38 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tls.lua
56.16 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tn3270.lua
43.75 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tns.lua
64.17 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
unicode.lua
14.32 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
unittest.lua
12.33 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
unpwdb.lua
10.08 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
upnp.lua
11.18 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
url.lua
12.09 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
versant.lua
8.6 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
vnc.lua
23.3 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
vulns.lua
76.29 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
vuzedht.lua
16.62 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
wsdd.lua
12.03 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
xdmcp.lua
11.9 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
xmpp.lua
15.88 KB
04/16/2018 01:11:39 AM
rw-r--r--
Editing: unittest.lua
Close
--- -- Unit testing support for NSE libraries. -- -- This library will import all NSE libraries looking for a global variable -- <code>test_suite</code>. This must be a callable that returns true or false -- and the number of tests that failed. For convenience, the -- <code>unittest.TestSuite</code> class has this property, and tests can be -- added with <code>add_test</code>. Example: -- -- <code> -- local data = {"foo", "bar", "baz"} -- test_suite = unittest.TestSuite:new() -- test_suite:add_test(equal(data[2], "bar"), "data[2] should equal 'bar'") -- </code> -- -- The library is driven by the unittest NSE script. -- -- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html local stdnse = require "stdnse" local string = require "string" local table = require "table" local nmap = require "nmap" local nsedebug = require "nsedebug" local listop = require "listop" _ENV = stdnse.module("unittest", stdnse.seeall) local libs = { "afp", "ajp", "amqp", "anyconnect", "asn1", "base32", "base64", "bin", "bit", "bitcoin", "bits", "bittorrent", "bjnp", "brute", "cassandra", "citrixxml", "coap", "comm", "creds", "cvs", "datafiles", "datetime", "dhcp", "dhcp6", "dns", "dnsbl", "dnssd", "drda", "eap", "eigrp", "formulas", "ftp", "geoip", "giop", "gps", "http", "httpspider", "iax2", "ike", "imap", "informix", "ipOps", "ipmi", "ipp", "irc", "iscsi", "isns", "jdwp", "json", "ldap", "lfs", "libssh2-utility", "listop", "lpeg-utility", "ls", "match", "membase", "mobileme", "mongodb", "mqtt", "msrpc", "msrpcperformance", "msrpctypes", "mssql", "multicast", "mysql", "natpmp", "ncp", "ndmp", "netbios", "nmap", "nrpc", "nsedebug", "omp2", "openssl", "ospf", "packet", "pcre", "pgsql", "pop3", "pppoe", "proxy", "rdp", "re", "redis", "rmi", "rpc", "rpcap", "rsync", "rtsp", "sasl", "shortport", "sip", "slaxml", "smb", "smb2", "smbauth", "smtp", "snmp", "socks", "srvloc", "ssh1", "ssh2", "sslcert", "sslv2", "stdnse", "strbuf", --"strict", -- behaves oddly "stun", "tab", "target", "tftp", "tls", "tn3270", "tns", "unicode", "unittest", "unpwdb", "upnp", "url", "versant", "vnc", "vulns", "vuzedht", "wsdd", "xdmcp", "xmpp", } -- This script-arg is documented in the unittest script to avoid cluttering -- NSEdoc of all the libraries which include this one. local am_testing = stdnse.get_script_args('unittest.run') ---Check whether tests are being run -- -- Libraries can use this function to avoid the overhead of creating tests if -- the user hasn't chosen to run them. Unittesting is turned on with the -- <code>unittest.run</code> script-arg. -- @return true if unittests are being run, false otherwise. function testing() return am_testing end --- -- Run tests provided by NSE libraries -- @param to_test A list (table) of libraries to test. If none is provided, all -- libraries are tested. run_tests = function(to_test) am_testing = true if to_test == nil then to_test = libs end local fails = stdnse.output_table() for _,lib in ipairs(to_test) do stdnse.debug1("Testing %s", lib) local status, thelib = pcall(require, lib) if not status then stdnse.debug1("Failed to load %s: %s", lib, thelib) else local failed = 0 if rawget(thelib,"test_suite") ~= nil then failed = thelib.test_suite() end if failed ~= 0 then fails[lib] = failed end end end return fails end --- The TestSuite class -- -- Holds and runs tests. TestSuite = { --- Creates a new TestSuite object -- -- @name TestSuite.new -- @return TestSuite object new = function(self) local o = {} setmetatable(o, self) self.__index = self o.tests = {} return o end, --- Set up test environment. Override this. -- @name TestSuite.setup setup = function(self) return true end, --- Tear down test environment. Override this. -- @name TestSuite.teardown teardown = function(self) return true end, --- Add a test. -- @name TestSuite.add_test -- @param test Function that will be called with the TestSuite object as its only parameter. -- @param description A description of the test being run add_test = function(self, test, description) self.tests[#self.tests+1] = {test, description} end, --- Run tests. -- Runs all tests in the TestSuite, and returns the number of failures. -- @name TestSuite.__call -- @return failures The number of tests that failed -- @return tests The number of tests run __call = function(self) local failures = 0 local passes = 0 self:setup() for _,test in ipairs(self.tests) do stdnse.debug2("| Test: %s...", test[2]) local status, note = test[1](self) local result local lvl = 2 if status then result = "Pass" passes = passes + 1 else result = "Fail" lvl = 1 if nmap.debugging() < 2 then stdnse.debug1("| Test: %s...", test[2]) end failures = failures + 1 end if note then stdnse.debug(lvl, "| \\_result: %s (%s)", result, note) else stdnse.debug(lvl, "| \\_result: %s", result) end end stdnse.debug1("|_%d of %d tests passed", passes, #self.tests) self:teardown() return failures, #self.tests end, } --- Test creation helper function. -- Turns a simple function into a test factory. -- @param test A function that returns true or false depending on test -- @param fmt A format string describing the failure condition using the -- arguments to the test function -- @return function that generates tests suitable for use in add_test make_test = function(test, fmt) return function(...) local args={...} local nargs = select("#", ...) return function(suite) if not test(table.unpack(args,1,nargs)) then return false, string.format(fmt, table.unpack(listop.map(nsedebug.tostr, args),1,nargs)) end return true end end end --- Test for nil -- @param value The value to test -- @return bool True if the value is nil, false otherwise. is_nil = function(value) return value == nil end is_nil = make_test(is_nil, "Expected not nil, got %s") --- Test for not nil -- @param value The value to test -- @return bool True if the value is not nil, false otherwise. not_nil = function(value) return value ~= nil end not_nil = make_test(not_nil, "Expected not nil, got %s") --- Test tables for equality, 1 level deep -- @param a The first table to test -- @param b The second table to test -- @return bool True if #a == #b and a[i] == b[i] for every i<#a, false otherwise. table_equal = function(a, b) return function (suite) if #a ~= #b then return false, "Length not equal" end for i, v in ipairs(a) do if b[i] ~= v then return false, string.format("%s ~= %s at position %d", v, b[i], i) end end return true end end --- Test associative tables for equality, 1 level deep -- @param a The first table to test -- @param b The second table to test -- @return bool True if a[k] == b[k] for all k in a and b keys_equal = function(a, b) return function (suite) local seen = {} for k, v in pairs(a) do if b[k] ~= v then return false, ("%s ~= %s at key %s"):format(v, b[k], k) end seen[k] = true end for k, v in pairs(b) do if not seen[k] then return false, ("Key %s not present in table a"):format(k) end end return true end end --- Test two values for equality, recursively if necessary. -- -- This function checks that both values are indistinguishable in all -- but memory location. -- -- @param a The first value to test. -- @param b The second value to test -- @return bool True if values are indistinguishable, false otherwise. -- @return note Nil if values are indistinguishable, description of -- distinguishability otherwise. identical = function(a, b) return function(suite) local function _identical(val1, val2, path) local table_size = function(tbl) local count = 0 for k in pairs(tbl) do count = count + 1 end return count end -- Both values must be of the same type local t1, t2 = type(val1), type(val2) if t1 ~= t2 then return false, string.format("Types of %s are not equal: %s ~= %s", path, t1, t2) end -- For non-tables, we can make a direct comparison. if t1 ~= "table" then if val1 ~= val2 then return false, string.format("Values of %s are not equal: %s ~= %s", path, val1, val2) end return true end -- For tables, we must first check that they are of equal size. local len1, len2 = table_size(val1), table_size(val2) if len1 ~= len2 then return false, string.format("Sizes of %s are not equal: %s ~= %s", path, len1, len2) end -- Finally, we must recursively check all of the values in the tables. for k,v in pairs(val1) do -- Check that the key's value is identical in both tables, passing -- along the path of keys we have taken to get here. local status, note = _identical(val1[k], val2[k], string.format('%s["%s"]', path, k)) if not status then return false, note end end return true end return _identical(a, b, "<top>") end end --- Test for equality -- @param a The first value to test -- @param b The second value to test -- @return bool True if a == b, false otherwise. equal = function(a, b) return a == b end equal = make_test(equal, "%s not equal to %s") --- Test for inequality -- @param a The first value to test -- @param b The second value to test -- @return bool True if a != b, false otherwise. not_equal = function(a, b) return a ~= b end not_equal = make_test(not_equal, "%s unexpectedly equal to %s") --- Test for truth -- @param value The value to test -- @return bool True if value is a boolean and true is_true = function(value) return value == true end is_true = make_test(is_true, "Expected true, got %s") --- Test for falsehood -- @param value The value to test -- @return bool True if value is a boolean and false is_false = function(value) return value == false end is_false = make_test(is_false, "Expected false, got %s") --- Test less than -- @param a The first value to test -- @param b The second value to test -- @return bool True if a < b, false otherwise. lt = function(a, b) return a < b end lt = make_test(lt, "%s not less than %s") --- Test less than or equal to -- @param a The first value to test -- @param b The second value to test -- @return bool True if a <= b, false otherwise. lte = function(a, b) return a <= b end lte = make_test(lte, "%s not less than %s") --- Test length -- @param t The table to test -- @param l The length to test -- @return bool True if the length of t is l length_is = function(t, l) return #t == l end length_is = make_test(length_is, "Length of %s is not %s") --- Expected failure test -- @param test The test to run -- @return function A test for expected failure of the test expected_failure = function(test) return function(suite) if test(suite) then return false, "Test unexpectedly passed" end return true, "Test failed as expected" end end if not testing() then return _ENV end -- Self test test_suite = TestSuite:new() test_suite:add_test(is_nil(test_suite["asdfdoesnotexist"]), "Nonexistent key does not exist") test_suite:add_test(equal(1+1336, 7 * 191), "Arithmetically equal expressions are equal") test_suite:add_test(not_equal( true, "true" ), "Boolean true not equal to string \"true\"") test_suite:add_test(is_true("test" == "test"), "Boolean expression evaluates to true") test_suite:add_test(is_false(1.9999 == 2.0), "Boolean expression evaluates to false") test_suite:add_test(lt(1, 999), "1 < 999") test_suite:add_test(lte(8, 8), "8 <= 8") test_suite:add_test(expected_failure(not_nil(nil)), "Test expected to fail fails") test_suite:add_test(expected_failure(expected_failure(is_nil(nil))), "Test expected to succeed does not fail") test_suite:add_test(keys_equal({one=1,two=2,[3]="three"},{[3]="three",one=1,two=2}), "identical tables are identical") test_suite:add_test(expected_failure(keys_equal({one=1,two=2},{[3]="three",one=1,two=2}), "dissimilar tables are dissimilar")) test_suite:add_test(identical(0, 0), "integer === integer") test_suite:add_test(identical(nil, nil), "nil === nil") test_suite:add_test(identical({}, {}), "{} === {}") test_suite:add_test(length_is(test_suite.tests, 15), "Number of tests is 15") return _ENV;