mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Spelling fixes for Lua files
Mostly in documentation/comments, but a couple code bugs were caught, including a call to stdnse.pirnt_debug and a mis-declared variable.
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
-- </code>
|
||||
--
|
||||
-- The next step needed to be performed is to authenticate to the server. We need to do this even for
|
||||
-- functions that are available publically. In order to authenticate as the public user simply
|
||||
-- functions that are available publicly. In order to authenticate as the public user simply
|
||||
-- authenticate using nil for both username and password. This can be achieved by calling the Login method
|
||||
-- without any parameters, like this:
|
||||
-- <code>
|
||||
@@ -76,7 +76,7 @@
|
||||
-- status, shares = helper:ListShares()
|
||||
-- </code>
|
||||
--
|
||||
-- Once we're finnished, we need to logout and close the AFP session this is done by calling the
|
||||
-- Once we're finished, we need to logout and close the AFP session this is done by calling the
|
||||
-- following two methods of the Helper class:
|
||||
-- <code>
|
||||
-- status, response = helper:Logout()
|
||||
@@ -107,7 +107,7 @@
|
||||
-- Revised 03/05/2010 - v0.4 - changed output table of Helper:Dir to include type and ID
|
||||
-- - added support for --without-openssl
|
||||
--
|
||||
-- Revised 03/09/2010 - v0.5 - documentation, documenation and more documentation
|
||||
-- Revised 03/09/2010 - v0.5 - documentation, documentation and more documentation
|
||||
-- Revised 04/03/2011 - v0.6 - add support for getting file- sizes, dates and Unix ACLs
|
||||
-- - moved afp.username & afp.password arguments to library
|
||||
|
||||
@@ -337,7 +337,7 @@ local ERROR_MSG = {
|
||||
[ERROR.FPBadUAM]="Specified UAM is unknown",
|
||||
[ERROR.FPBadVersNum]="Server does not support the specified AFP version",
|
||||
[ERROR.FPBitmapErr]="Attempt was made to get or set a parameter that cannot be obtained or set with this command, or a required bitmap is null",
|
||||
[ERROR.FPCantMove]="Attempt was made to move a directory into one of its descendent directories.",
|
||||
[ERROR.FPCantMove]="Attempt was made to move a directory into one of its descendant directories.",
|
||||
[ERROR.FPEOFErr]="No more matches or end of fork reached.",
|
||||
[ERROR.FPLockErr]="Some or all of the requested range is locked by another user; a lock range conflict exists.",
|
||||
[ERROR.FPMiscErr]="Non-AFP error occurred.",
|
||||
@@ -385,7 +385,7 @@ Response = {
|
||||
if self.error_msg then
|
||||
return self.error_msg
|
||||
else
|
||||
return ERROR_MSG[self.error_code] or ("Unknown error (%d) occured"):format(self.error_code)
|
||||
return ERROR_MSG[self.error_code] or ("Unknown error (%d) occurred"):format(self.error_code)
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -566,11 +566,11 @@ Proto = {
|
||||
--
|
||||
-- @param src_vol number containing the ID of the src file volume
|
||||
-- @param srd_did number containing the directory id of the src file
|
||||
-- @param src_path string containingt the file path/name of the src file
|
||||
-- @param src_path string containing the file path/name of the src file
|
||||
-- @param dst_vol number containing the ID of the dst file volume
|
||||
-- @param dst_did number containing the id of the dest. directory
|
||||
-- @param dst_path string containing the dest path (can be nil or "")
|
||||
-- @param new_name string containign the new name of the destination
|
||||
-- @param new_name string containing the new name of the destination
|
||||
-- @return Response object
|
||||
fp_copy_file = function(self, src_vol, src_did, src_path, dst_vol, dst_did, dst_path, new_name )
|
||||
local pad, data_offset = 0, 0
|
||||
@@ -643,7 +643,7 @@ Proto = {
|
||||
offsets.directory_names_count, offsets.utf8_server_name
|
||||
= bin.unpack(">SSSS", packet.data, pos)
|
||||
|
||||
-- this sets up all the server flaqs in the response table as booleans
|
||||
-- this sets up all the server flags in the response table as booleans
|
||||
result.flags.SuperClient = flag_is_set(result.flags.raw, SERVERFLAGS.SuperClient)
|
||||
result.flags.UUIDs = flag_is_set(result.flags.raw, SERVERFLAGS.UUIDs)
|
||||
result.flags.UTF8ServerName = flag_is_set(result.flags.raw, SERVERFLAGS.UTF8ServerName)
|
||||
@@ -848,7 +848,7 @@ Proto = {
|
||||
data = response:getPacketData()
|
||||
pos, parms.server_time, parms.vol_count = bin.unpack("IC", data)
|
||||
|
||||
-- we should now be at the leading zero preceeding the first volume name
|
||||
-- we should now be at the leading zero preceding the first volume name
|
||||
-- next is the length of the volume name, move pos there
|
||||
pos = pos + 1
|
||||
|
||||
@@ -875,7 +875,7 @@ Proto = {
|
||||
-- o DHCAST128
|
||||
--
|
||||
-- The DHCAST128 UAM should work against most servers even though it's
|
||||
-- superceeded by the DHX2 UAM.
|
||||
-- superceded by the DHX2 UAM.
|
||||
--
|
||||
-- @param afp_version string (AFP3.3|AFP3.2|AFP3.1)
|
||||
-- @param uam string containing authentication information
|
||||
@@ -1350,8 +1350,8 @@ Helper = {
|
||||
|
||||
--- Connects to the remote server and establishes a new AFP session
|
||||
--
|
||||
-- @param host table as recieved by the action function of the script
|
||||
-- @param port table as recieved by the action function of the script
|
||||
-- @param host table as received by the action function of the script
|
||||
-- @param port table as received by the action function of the script
|
||||
-- @return status boolean
|
||||
-- @return string containing error message (if status is false)
|
||||
OpenSession = function( self, host, port )
|
||||
@@ -1386,7 +1386,7 @@ Helper = {
|
||||
return status, packet
|
||||
end,
|
||||
|
||||
--- Terminates the connection, withou closing the AFP session
|
||||
--- Terminates the connection, without closing the AFP session
|
||||
--
|
||||
-- @return status (always true)
|
||||
-- @return string (always "")
|
||||
@@ -1904,7 +1904,7 @@ Util =
|
||||
|
||||
--- Converts a numeric acl to string
|
||||
--
|
||||
-- @param acls number containig acls as recieved from <code>fp_get_file_dir_parms</code>
|
||||
-- @param acls number containing acls as received from <code>fp_get_file_dir_parms</code>
|
||||
-- @return table of long ACLs
|
||||
acls_to_long_string = function( acls )
|
||||
|
||||
@@ -2066,7 +2066,7 @@ Util =
|
||||
local offset, p, name
|
||||
pos, offset = bin.unpack(">S", data, pos)
|
||||
|
||||
-- TODO: This really needs to be adressed someway
|
||||
-- TODO: This really needs to be addressed someway
|
||||
-- Barely, never, ever happens, which makes it difficult to pin down
|
||||
-- http://developer.apple.com/mac/library/documentation/Networking/Reference/
|
||||
-- AFP_Reference/Reference/reference.html#//apple_ref/doc/uid/TP40003548-CH3-CHDBEHBG [URL is wrapped]
|
||||
|
||||
@@ -286,7 +286,7 @@ Comm = {
|
||||
-- Sends a request to the server
|
||||
--
|
||||
-- @param req instance of object that can be serialized with tostring
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return err string containing error message on failure
|
||||
send = function(self, req)
|
||||
return self.socket:send(tostring(req))
|
||||
@@ -294,7 +294,7 @@ Comm = {
|
||||
|
||||
-- Receives an AJP response from the server
|
||||
--
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response table containing the following fields, or string
|
||||
-- containing error message on failure
|
||||
-- <code>status</code> - status of response (see HTTP status codes)
|
||||
@@ -380,7 +380,7 @@ Helper = {
|
||||
-- @param headers table containing optional headers
|
||||
-- @param attributes table containing optional attributes
|
||||
-- @param options table with request specific options
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response table (@see Comm.receive), or string containing error
|
||||
-- message on failure
|
||||
request = function(self, method, url, headers, attributes, options)
|
||||
@@ -437,7 +437,7 @@ Helper = {
|
||||
-- @param headers table containing optional headers
|
||||
-- @param attributes table containing optional attributes
|
||||
-- @param options table with request specific options
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response table (@see Comm.receive), or string containing error
|
||||
-- message on failure
|
||||
get = function(self, url, headers, attributes, options)
|
||||
@@ -450,7 +450,7 @@ Helper = {
|
||||
-- @param headers table containing optional headers
|
||||
-- @param attributes table containing optional attributes
|
||||
-- @param options table with request specific options
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response table (@see Comm.receive), or string containing error
|
||||
-- message on failure
|
||||
head = function(self, url, headers, attributes, options)
|
||||
@@ -463,7 +463,7 @@ Helper = {
|
||||
-- @param headers table containing optional headers
|
||||
-- @param attributes table containing optional attributes
|
||||
-- @param options table with request specific options
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response table (@see Comm.receive), or string containing error
|
||||
-- message on failure
|
||||
trace = function(self, url, headers, attributes, options)
|
||||
@@ -476,7 +476,7 @@ Helper = {
|
||||
-- @param headers table containing optional headers
|
||||
-- @param attributes table containing optional attributes
|
||||
-- @param options table with request specific options
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response table (@see Comm.receive), or string containing error
|
||||
-- message on failure
|
||||
put = function(self, url, headers, attributes, options)
|
||||
@@ -489,7 +489,7 @@ Helper = {
|
||||
-- @param headers table containing optional headers
|
||||
-- @param attributes table containing optional attributes
|
||||
-- @param options table with request specific options
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response table (@see Comm.receive), or string containing error
|
||||
-- message on failure
|
||||
delete = function(self, url, headers, attributes, options)
|
||||
@@ -502,7 +502,7 @@ Helper = {
|
||||
-- @param headers table containing optional headers
|
||||
-- @param attributes table containing optional attributes
|
||||
-- @param options table with request specific options
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response table (@see Comm.receive), or string containing error
|
||||
-- message on failure
|
||||
options = function(self, url, headers, attributes, options)
|
||||
|
||||
@@ -171,7 +171,7 @@ ASN1Decoder = {
|
||||
end,
|
||||
|
||||
-- Decode one component of an OID from a byte string. 7 bits of the component
|
||||
-- are stored in each octet, most significant first, with the eigth bit set in
|
||||
-- are stored in each octet, most significant first, with the eighth bit set in
|
||||
-- all octets but the last. These encoding rules come from
|
||||
-- http://luca.ntop.org/Teaching/Appunti/asn1.html, section 5.9 OBJECT
|
||||
-- IDENTIFIER.
|
||||
@@ -324,7 +324,7 @@ ASN1Encoder = {
|
||||
registerBaseEncoders = function(self)
|
||||
self.encoder = {}
|
||||
|
||||
-- Bolean encoder
|
||||
-- Boolean encoder
|
||||
self.encoder['boolean'] = function( self, val )
|
||||
if val then
|
||||
return bin.pack('H','01 01 FF')
|
||||
@@ -362,7 +362,7 @@ ASN1Encoder = {
|
||||
end,
|
||||
|
||||
-- Encode one component of an OID as a byte string. 7 bits of the component are
|
||||
-- stored in each octet, most significant first, with the eigth bit set in all
|
||||
-- stored in each octet, most significant first, with the eighth bit set in all
|
||||
-- octets but the last. These encoding rules come from
|
||||
-- http://luca.ntop.org/Teaching/Appunti/asn1.html, section 5.9 OBJECT
|
||||
-- IDENTIFIER.
|
||||
|
||||
@@ -28,7 +28,7 @@ local b32standard = {
|
||||
'Y', 'Z', '2', '3', '4', '5', '6', '7',
|
||||
}
|
||||
|
||||
local b32dcstandard = {} -- efficency
|
||||
local b32dcstandard = {} -- efficiency
|
||||
b32dcstandard['A'] = '00000'
|
||||
b32dcstandard['B'] = '00001'
|
||||
b32dcstandard['C'] = '00010'
|
||||
@@ -69,7 +69,7 @@ local b32hexExtend = {
|
||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
||||
}
|
||||
|
||||
local b32dchexExtend = {} -- efficency
|
||||
local b32dchexExtend = {} -- efficiency
|
||||
b32dchexExtend['0'] = '00000'
|
||||
b32dchexExtend['1'] = '00001'
|
||||
b32dchexExtend['2'] = '00010'
|
||||
|
||||
@@ -26,7 +26,7 @@ local b64table = {
|
||||
'4', '5', '6', '7', '8', '9', '+', '/'
|
||||
}
|
||||
|
||||
local b64dctable = {} -- efficency
|
||||
local b64dctable = {} -- efficiency
|
||||
b64dctable['A'] = '000000'
|
||||
b64dctable['B'] = '000001'
|
||||
b64dctable['C'] = '000010'
|
||||
|
||||
@@ -410,7 +410,7 @@ end
|
||||
--- This thread sends a DHT find_node query to every node in
|
||||
-- pnt.nodes_find_node, after which every node is moved to pnt.nodes_get_peers
|
||||
-- to be processed by the get_peers_thread() function. The responses to these
|
||||
-- queries contain adresses of other DHT nodes (usually 8) which are added to
|
||||
-- queries contain addresses of other DHT nodes (usually 8) which are added to
|
||||
-- the pnt.nodes_find_node list. This action is done for a timeout with a
|
||||
-- default value of 30 seconds.
|
||||
local find_node_thread = function(pnt, timeout)
|
||||
@@ -430,7 +430,7 @@ local find_node_thread = function(pnt, timeout)
|
||||
|
||||
-- standard bittorrent protocol specified find_node query with y = q (query),
|
||||
-- q = "find_node" (type of query),
|
||||
-- find_node Query = {"t":<trainsaction_id>, "y":"q", "q":"find_node", "a": {"id":<node_id>, "target":<info_hash>}}
|
||||
-- find_node Query = {"t":<transaction_id>, "y":"q", "q":"find_node", "a": {"id":<node_id>, "target":<info_hash>}}
|
||||
local find_node_query = "d1:ad2:id20:" .. pnt.node_id .. "6:target20:" ..
|
||||
pnt.info_hash .. "e1:q9:find_node1:t2:" .. openssl.rand_bytes(2) .. "1:y1:qe"
|
||||
|
||||
@@ -1173,7 +1173,7 @@ Torrent =
|
||||
|
||||
-- the action in the response has to be 0 too
|
||||
if not r_action == "00000000" then
|
||||
return false, "Wrong action field, usualy caused by an erroneous request"
|
||||
return false, "Wrong action field, usually caused by an erroneous request"
|
||||
end
|
||||
|
||||
-- established a connection, and now for an announce message, to which a
|
||||
|
||||
@@ -284,7 +284,7 @@ Helper = {
|
||||
-- @return attribs table containing device attributes when status is true
|
||||
-- errmsg string containing the error message when status is false
|
||||
getDeviceIdentity = function(self, devtype)
|
||||
-- Were currenlty only decoding this as I don't know what the other cruft is
|
||||
-- Were currently only decoding this as I don't know what the other cruft is
|
||||
local attrib_names = {
|
||||
["scanner"] = {
|
||||
{ ['MFG'] = "Manufacturer" },
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
-- The brute library is an attempt to create a common framework for performing
|
||||
-- password guessing against remote services.
|
||||
--
|
||||
-- The library currently attempts to parallellize the guessing by starting
|
||||
-- The library currently attempts to parallelize the guessing by starting
|
||||
-- a number of working threads. The number of threads can be defined using
|
||||
-- the brute.threads argument, it defaults to 10.
|
||||
--
|
||||
@@ -73,7 +73,7 @@
|
||||
-- The <code>connect</code> method provides the framework with the ability to
|
||||
-- ensure that the thread can run once it has been dispatched a set of
|
||||
-- credentials. As the sockets in NSE are limited we want to limit the risk of
|
||||
-- a thread blocking, due to insufficient free sockets, after it has aquired a
|
||||
-- a thread blocking, due to insufficient free sockets, after it has acquired a
|
||||
-- username and password pair.
|
||||
--
|
||||
-- The following sample code illustrates how to implement a sample
|
||||
@@ -141,7 +141,7 @@
|
||||
-- @args brute.passonly iterate over passwords only for services that provide
|
||||
-- only a password for authentication. (default: false)
|
||||
-- @args brute.retries the number of times to retry if recoverable failures
|
||||
-- occure. (default: 3)
|
||||
-- occur. (default: 3)
|
||||
-- @args brute.delay the number of seconds to wait between guesses (default: 0)
|
||||
-- @args brute.threads the number of initial worker threads, the number of
|
||||
-- active threads will be automatically adjusted.
|
||||
@@ -214,7 +214,7 @@ _ENV = stdnse.module("brute", stdnse.seeall)
|
||||
-- * mode - can be set to either cred, user or pass and controls
|
||||
-- whether the engine should iterate over users, passwords
|
||||
-- or fetch a list of credentials from a single file.
|
||||
-- (can be set using script-arg brut.mode)
|
||||
-- (can be set using script-arg brute.mode)
|
||||
-- * title - changes the title of the result table where the
|
||||
-- passwords are returned.
|
||||
-- * nostore - don't store the results in the credential library
|
||||
@@ -502,7 +502,7 @@ Engine =
|
||||
local driver = self.driver:new( self.host, self.port, self.driver_options )
|
||||
status = driver:connect()
|
||||
|
||||
-- Did we succesfully connect?
|
||||
-- Did we successfully connect?
|
||||
if ( status ) then
|
||||
if ( not(username) and not(password) ) then
|
||||
repeat
|
||||
@@ -545,7 +545,7 @@ Engine =
|
||||
retries = retries - 1
|
||||
|
||||
-- End if:
|
||||
-- * The guess was successfull
|
||||
-- * The guess was successful
|
||||
-- * The response was not set to retry
|
||||
-- * We've reached the maximum retry attempts
|
||||
until( status or ( response and not( response:isRetry() ) ) or retries == 0)
|
||||
@@ -621,7 +621,7 @@ Engine =
|
||||
stdnse.print_debug(2, "threads=%d,tps=%d", self:activeThreads(), tps )
|
||||
end
|
||||
|
||||
-- if delay was speciefied, do sleep
|
||||
-- if delay was specified, do sleep
|
||||
if ( self.options.delay > 0 ) then stdnse.sleep( self.options.delay ) end
|
||||
end
|
||||
condvar "signal"
|
||||
@@ -775,7 +775,7 @@ Engine =
|
||||
|
||||
result = ( #result ) and stdnse.format_output( true, result ) or ""
|
||||
|
||||
-- Did any error occure? If so add this to the result.
|
||||
-- Did any error occur? If so add this to the result.
|
||||
if ( self.error ) then
|
||||
result = result .. (" \n ERROR: %s"):format( self.error )
|
||||
return false, result
|
||||
|
||||
@@ -102,7 +102,7 @@ function sendcmd (socket, command, cnt)
|
||||
response = response .. resp2
|
||||
end
|
||||
|
||||
-- magic response starts at 5th byte for 4 bytes, 4 byte for length + length of string commmand
|
||||
-- magic response starts at 5th byte for 4 bytes, 4 byte for length + length of string command
|
||||
if (string.sub(response,5,8+4+string.len(command)) ~= CASSANDRARESP..pack4str(command)) then
|
||||
return false, "protocol response error"
|
||||
end
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
-- </code>
|
||||
--
|
||||
-- Supported output formats are CSV, verbose and plain. In both verbose and plain
|
||||
-- records are seperated by colons. The difference between the two is that verbose
|
||||
-- records are separated by colons. The difference between the two is that verbose
|
||||
-- includes the credential state. The file extension is automatically added to
|
||||
-- the filename based on the type requested.
|
||||
--
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
-- 2011-12-28 - Revised by Patrik Karlsson <patrik@cqure.net>
|
||||
-- o Split dhcp_send into dhcp_send, dhcp_receive
|
||||
-- o Added basic support for adding options to requests
|
||||
-- o Added possibility to ovverride transaction id
|
||||
-- o Added possibility to override transaction id
|
||||
-- o Added WPAD action
|
||||
|
||||
local bin = require "bin"
|
||||
|
||||
@@ -581,7 +581,7 @@ Helper = {
|
||||
self.__index = self
|
||||
|
||||
local info, err = nmap.get_interface_info(iface)
|
||||
-- if we faile to get interface info, don't return a helper
|
||||
-- if we fail to get interface info, don't return a helper
|
||||
-- this is true on OS X for interfaces like: p2p0 and vboxnet0
|
||||
if ( not(info) and err ) then
|
||||
return
|
||||
@@ -593,7 +593,7 @@ Helper = {
|
||||
return o
|
||||
end,
|
||||
|
||||
-- Sends a DHCP6 Solicit message to the server, essentiall requesting a new
|
||||
-- Sends a DHCP6 Solicit message to the server, essentially requesting a new
|
||||
-- IPv6 non-temporary address
|
||||
-- @return table of results suitable for use with
|
||||
-- <code>stdnse.format_output</code>
|
||||
|
||||
@@ -167,7 +167,7 @@ local function sendPacketsTCP(data, host, port, timeout)
|
||||
end
|
||||
|
||||
---
|
||||
-- Call appropriate protocol handeler
|
||||
-- Call appropriate protocol handler
|
||||
-- @param data Data to be sent.
|
||||
-- @param host Host to connect to.
|
||||
-- @param port Port to connect to.
|
||||
@@ -682,7 +682,7 @@ additionalFetcher[types.TXT] = function(dec, retAll)
|
||||
if not retAll and dec.add[1].data then
|
||||
return true, string.sub(dec.add[1].data, 2)
|
||||
elseif not retAll then
|
||||
stdnse.print_debug(1, "dns.aditionalFetcher found no records of the required type: TXT")
|
||||
stdnse.print_debug(1, "dns.additionalFetcher found no records of the required type: TXT")
|
||||
return false, "No Answers"
|
||||
else
|
||||
for _, v in ipairs(dec.add) do
|
||||
@@ -1413,7 +1413,7 @@ local function encodeOPT_Z(flags)
|
||||
end
|
||||
|
||||
---
|
||||
-- Adds an client-subnet paylod to the OPT packet
|
||||
-- Adds an client-subnet payload to the OPT packet
|
||||
-- implementing http://tools.ietf.org/html/draft-vandergaast-edns-client-subnet-00
|
||||
-- @param pkt Table representing DNS packet.
|
||||
-- @param Z Table of Z flags. Only DO is supported.
|
||||
@@ -1431,7 +1431,7 @@ function addClientSubnet(pkt,Z,subnet)
|
||||
end
|
||||
|
||||
---
|
||||
-- Adds an NSID paylod to the OPT packet
|
||||
-- Adds an NSID payload to the OPT packet
|
||||
-- @param pkt Table representing DNS packet.
|
||||
-- @param Z Table of Z flags. Only DO is supported.
|
||||
function addNSID (pkt,Z)
|
||||
|
||||
@@ -102,7 +102,7 @@ SERVICES = {
|
||||
local rev_ip = dns.reverse(self.ip):match("^(.*)%.in%-addr%.arpa$")
|
||||
return ("%s.spam.dnsbl.sorbs.net"):format(rev_ip)
|
||||
end,
|
||||
-- This function parses the response and supports borth long and
|
||||
-- This function parses the response and supports both long and
|
||||
-- short mode.
|
||||
resp_parser = function(self, r)
|
||||
local responses = {
|
||||
@@ -384,7 +384,7 @@ SERVICES = {
|
||||
local octet1, octet2, octet3, octet4 = table.unpack(parts)
|
||||
|
||||
if ( octet1 ~= 127 ) then
|
||||
-- This should'nt happen :P
|
||||
-- This shouldn't happen :P
|
||||
stdnse.print_debug(
|
||||
"The request made to dnsbl.httpbl.org was considered invalid (%i)",
|
||||
octet1)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
-- The library supports
|
||||
-- * Unicast and Multicast requests
|
||||
-- * Decoding responses
|
||||
-- * Running requests in parallell using Lua coroutines
|
||||
-- * Running requests in parallel using Lua coroutines
|
||||
--
|
||||
-- The library contains the following classes
|
||||
-- * <code>Comm</code>
|
||||
@@ -14,15 +14,15 @@
|
||||
-- * <code>Util</code>
|
||||
-- ** The <code>Util</code> class contains a number of static functions mainly used to convert data.
|
||||
--
|
||||
-- The following code snipplet queries all mDNS resolvers on the network for a
|
||||
-- full list of their supported services and returns the formated output:
|
||||
-- The following code snippet queries all mDNS resolvers on the network for a
|
||||
-- full list of their supported services and returns the formatted output:
|
||||
-- <code>
|
||||
-- local helper = dnssd.Helper:new( )
|
||||
-- helper:setMulticast(true)
|
||||
-- return stdnse.format_output(helper:queryServices())
|
||||
-- </code>
|
||||
--
|
||||
-- This next snipplet queries a specific host for the same information:
|
||||
-- This next snippet queries a specific host for the same information:
|
||||
-- <code>
|
||||
-- local helper = dnssd.Helper:new( host, port )
|
||||
-- return stdnse.format_output(helper:queryServices())
|
||||
@@ -86,7 +86,7 @@ Util = {
|
||||
local services = {}
|
||||
-- Create unique table of services
|
||||
for _, r in ipairs( response ) do
|
||||
-- do we really have mutliple responses?
|
||||
-- do we really have multiple responses?
|
||||
if ( not(r.output) ) then return end
|
||||
for _, svc in ipairs(r.output ) do
|
||||
services[svc] = services[svc] or {}
|
||||
@@ -116,7 +116,7 @@ Util = {
|
||||
return services
|
||||
end,
|
||||
|
||||
--- Returns the amount of currenlty active threads
|
||||
--- Returns the amount of currently active threads
|
||||
--
|
||||
-- @param threads table containing the list of threads
|
||||
-- @return count number containing the number of non-dead threads
|
||||
|
||||
@@ -634,9 +634,9 @@ Helper = {
|
||||
-- At this point we have a few differences in behaviour
|
||||
-- * DB2 has told us earlier if the DB does not exist
|
||||
-- * Apache Derby will do so here, regardless of the login was
|
||||
-- successfull or not
|
||||
-- successful or not
|
||||
-- * Informix will tell us that the DB does not exist IF the
|
||||
-- login was successfull
|
||||
-- login was successful
|
||||
--
|
||||
-- Therefore the order of these checks are important!!
|
||||
if ( packet:getDRDAByCodePoint( CodePoint.ACCRDBRM ) ) then
|
||||
@@ -778,7 +778,7 @@ StringUtil =
|
||||
--
|
||||
-- @param str string to pad
|
||||
-- @param chr char to pad with
|
||||
-- @param len the total length of the finnished string
|
||||
-- @param len the total length of the finished string
|
||||
-- @return str string containing the padded string
|
||||
padWithChar = function( str, chr, len )
|
||||
if ( len < #str ) then
|
||||
|
||||
@@ -88,7 +88,7 @@ EIGRP = {
|
||||
return o
|
||||
end,
|
||||
|
||||
--- Parses a raw eigrp packet and returns a structred response.
|
||||
--- Parses a raw eigrp packet and returns a structured response.
|
||||
-- @param eigrp_raw string EIGRP Raw packet.
|
||||
-- @return response table Structured eigrp packet.
|
||||
parse = function(eigrp_raw)
|
||||
|
||||
@@ -95,8 +95,8 @@ Packet.GIOP = {
|
||||
|
||||
--- Creates a Packet.GIOP
|
||||
--
|
||||
-- @param msgtype number containing the messaget type
|
||||
-- @param data string conatining the message data
|
||||
-- @param msgtype number containing the message type
|
||||
-- @param data string containing the message data
|
||||
-- @return obj a new Packet.GIOP instance
|
||||
new = function( self, msgtype, data )
|
||||
local o = {}
|
||||
@@ -422,7 +422,7 @@ MessageDecoder = {
|
||||
|
||||
--- Decodes a get response
|
||||
--
|
||||
-- @param packet the GIOP packet as recieved by the comm
|
||||
-- @param packet the GIOP packet as received by the comm
|
||||
-- <code>exchGIOPPacket</code> function
|
||||
-- @return status true on success, false on failure
|
||||
-- @return table containing <code>ip</code> and <code>ctx</code>
|
||||
@@ -445,7 +445,7 @@ MessageDecoder = {
|
||||
|
||||
--- Decodes a _is_a response (not implemented)
|
||||
--
|
||||
-- @param packet the GIOP packet as recieved by the comm
|
||||
-- @param packet the GIOP packet as received by the comm
|
||||
-- <code>exchGIOPPacket</code> function
|
||||
-- @return status, always true
|
||||
["_is_a"] = function( packet )
|
||||
@@ -454,7 +454,7 @@ MessageDecoder = {
|
||||
|
||||
--- Decodes a list response
|
||||
--
|
||||
-- @param packet the GIOP packet as recieved by the comm
|
||||
-- @param packet the GIOP packet as received by the comm
|
||||
-- <code>exchGIOPPacket</code> function
|
||||
-- @return status true on success, false on failure
|
||||
-- @return table containing <code>id</code>, <code>kind</code> and
|
||||
@@ -509,7 +509,7 @@ Comm = {
|
||||
return o
|
||||
end,
|
||||
|
||||
--- Sends and recieves a GIOP packet
|
||||
--- Sends and receives a GIOP packet
|
||||
--
|
||||
-- @param packet containing a Packet.* object, the object must
|
||||
-- implement the __tostring meta method
|
||||
|
||||
@@ -72,7 +72,7 @@ NMEA = {
|
||||
return true
|
||||
end,
|
||||
|
||||
-- Parses a GPS sentence using the apropriate parser
|
||||
-- Parses a GPS sentence using the appropriate parser
|
||||
--
|
||||
-- @param str containing the GPS sentence
|
||||
-- @return entry table containing the parsed response or
|
||||
|
||||
@@ -620,7 +620,7 @@ local function recv_body(s, response, method, partial)
|
||||
end
|
||||
|
||||
-- 4. If the message uses the media type "multipart/byteranges", and the
|
||||
-- ransfer-length is not otherwise specified, then this self- elimiting
|
||||
-- transfer-length is not otherwise specified, then this self-delimiting
|
||||
-- media type defines the transfer-length. [sic]
|
||||
|
||||
-- Case 4 is unhandled.
|
||||
@@ -998,7 +998,7 @@ local function lookup_cache (method, host, port, path, options)
|
||||
end
|
||||
|
||||
local function response_is_cacheable(response)
|
||||
-- if response.status is nil, then an error must have occured during the request
|
||||
-- if response.status is nil, then an error must have occurred during the request
|
||||
-- and we probably don't want to cache the response
|
||||
if not response.status then
|
||||
return false
|
||||
@@ -1444,7 +1444,7 @@ local function get_redirect_ok(host, port, options)
|
||||
end
|
||||
|
||||
---Fetches a resource with a GET request and returns the result as a table. This is a simple
|
||||
-- wraper around <code>generic_request</code>, with the added benefit of having local caching
|
||||
-- wrapper around <code>generic_request</code>, with the added benefit of having local caching
|
||||
-- and support for HTTP redirects. Redirects are followed only if they pass all the
|
||||
-- validation rules of the redirect_ok function. This function may be overridden by supplying
|
||||
-- a custom function in the <code>redirect_ok</code> field of the options array. The default
|
||||
@@ -1621,7 +1621,7 @@ end
|
||||
--
|
||||
-- @param path The path to retrieve.
|
||||
-- @param options [optional] A table that lets the caller control socket timeouts, HTTP headers, and other parameters. For full documentation, see the module documentation (above).
|
||||
-- @param all_requests [optional] The current pipeline queue (retunred from a previous <code>add_pipeline</code> call), or nil if it's the first call.
|
||||
-- @param all_requests [optional] The current pipeline queue (returned from a previous <code>add_pipeline</code> call), or nil if it's the first call.
|
||||
-- @param method [optional] The HTTP method ('GET', 'HEAD', 'POST', etc). Default: 'GET'.
|
||||
-- @return Table with the pipeline get requests (plus this new one)
|
||||
-- @see http.pipeline_go
|
||||
|
||||
@@ -41,16 +41,16 @@
|
||||
-- For advanced use, the library currently supports a number of closures (withinhost,
|
||||
-- withindomain, doscraping). Please note, that withinhost and withindomain options also
|
||||
-- support boolean values. You will want to override them only for advanced use. You can
|
||||
-- define them using the following ultities:
|
||||
-- define them using the following utilities:
|
||||
--
|
||||
-- * <code>iswithinhost</code>
|
||||
-- ** You can use this ultity to check if the resource exists within the host.
|
||||
-- ** You can use this utility to check if the resource exists within the host.
|
||||
--
|
||||
-- * <code>iswithindomain</code>
|
||||
-- ** You can use this ultity to check if the resource exists within the domain.
|
||||
-- ** You can use this utility to check if the resource exists within the domain.
|
||||
--
|
||||
-- * <code>isresource</code>
|
||||
-- ** You can use this ultity to check the type of the resource (for example "js").
|
||||
-- ** You can use this utility to check the type of the resource (for example "js").
|
||||
-- ** A third option may hold a number of signs that may exist after the extension
|
||||
-- ** of the resource. By default, these are [#, ?]. For example, if we want to return
|
||||
-- only php resources, the function will also return example.php?query=foo or
|
||||
@@ -506,7 +506,7 @@ UrlQueue = {
|
||||
return o
|
||||
end,
|
||||
|
||||
-- get's the next available url in the queue
|
||||
-- gets the next available url in the queue
|
||||
getNext = function(self)
|
||||
return table.remove(self.urls,1)
|
||||
end,
|
||||
@@ -548,7 +548,7 @@ Crawler = {
|
||||
|
||||
removewww = function(url) return string.gsub(url, "^www%.", "") end,
|
||||
|
||||
-- An ultity when defining closures. Checks if the resource exists within host.
|
||||
-- An utility when defining closures. Checks if the resource exists within host.
|
||||
-- @param u URL that points to the resource we want to check.
|
||||
iswithinhost = function(self, u)
|
||||
local parsed_u = url.parse(tostring(u))
|
||||
@@ -565,7 +565,7 @@ Crawler = {
|
||||
return true
|
||||
end,
|
||||
|
||||
-- An ultity when defining closures. Checks if the resource exists within domain.
|
||||
-- An utility when defining closures. Checks if the resource exists within domain.
|
||||
-- @param u URL that points to the resource we want to check.
|
||||
iswithindomain = function(self, u)
|
||||
local parsed_u = url.parse(tostring(u))
|
||||
@@ -581,7 +581,7 @@ Crawler = {
|
||||
return true
|
||||
end,
|
||||
|
||||
-- An ultity when defining closures. Checks the type of the resource.
|
||||
-- An utility when defining closures. Checks the type of the resource.
|
||||
-- @param u URL that points to the resource we want to check.
|
||||
-- @param ext the extension of the resource.
|
||||
-- @param signs table of signs that may exist after the extension of the resource.
|
||||
@@ -663,12 +663,12 @@ Crawler = {
|
||||
o.options.timeout = o.options.timeout or 10000
|
||||
o.processed = {}
|
||||
|
||||
-- script arguments have precedense
|
||||
-- script arguments have precedence
|
||||
if ( not(o.options.maxdepth) ) then
|
||||
o.options.maxdepth = tonumber(stdnse.get_script_args("httpspider.maxdepth"))
|
||||
end
|
||||
|
||||
-- script arguments have precedense
|
||||
-- script arguments have precedence
|
||||
if ( not(o.options.maxpagecount) ) then
|
||||
o.options.maxpagecount = tonumber(stdnse.get_script_args("httpspider.maxpagecount"))
|
||||
end
|
||||
@@ -678,7 +678,7 @@ Crawler = {
|
||||
end
|
||||
|
||||
if ( o.options.useheadfornonwebfiles ) then
|
||||
-- Load web files extensitons from a file in nselib/data folder.
|
||||
-- Load web files extensions from a file in nselib/data folder.
|
||||
-- For more information on individual file formats, see
|
||||
-- http://en.wikipedia.org/wiki/List_of_file_formats.
|
||||
o.web_files_extensions = {}
|
||||
|
||||
@@ -269,7 +269,7 @@ Helper = {
|
||||
end,
|
||||
|
||||
-- Request a session release
|
||||
-- @param username string containing the extention (username)
|
||||
-- @param username string containing the extension (username)
|
||||
-- @param password string containing the password
|
||||
regRelease = function(self, username, password)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ local io = require "io"
|
||||
description = [[
|
||||
A very basic IKE library.
|
||||
|
||||
The current funcionality includes:
|
||||
The current functionality includes:
|
||||
1. Generating a Main or Aggressive Mode IKE request packet with a variable amount of transforms and a vpn group.
|
||||
2. Sending a packet
|
||||
3. Receiving the response
|
||||
@@ -271,7 +271,7 @@ local function lookup(vendor_ids)
|
||||
|
||||
if row.category == 'vid_ordering' and all_vids:find(row.fingerprint) then
|
||||
|
||||
-- Use ordering information if there where no vendor matches from prevoius step
|
||||
-- Use ordering information if there where no vendor matches from previous step
|
||||
if info.vendor == nil then
|
||||
info.vendor = row
|
||||
|
||||
@@ -489,7 +489,7 @@ end
|
||||
|
||||
|
||||
-- Generate multiple transforms
|
||||
-- Input nust be a table of complete transforms
|
||||
-- Input must be a table of complete transforms
|
||||
--
|
||||
local function generate_transforms(transform_table)
|
||||
local transforms = ''
|
||||
@@ -504,7 +504,7 @@ end
|
||||
|
||||
-- Create a request packet
|
||||
-- Support for multiple transforms, which minimizes the
|
||||
-- the amount of traffic/packets needed to be sendt
|
||||
-- the amount of traffic/packets needed to be sent
|
||||
--
|
||||
function request(port, proto, mode, transforms, diffie, id)
|
||||
local payload_after_sa, str_aggressive, l, l_sa, l_pro
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
-- interface for script writers, and the <code>IMAP</code> class providing
|
||||
-- all protocol-level functionality.
|
||||
--
|
||||
-- The following example illustrates the reommended use of the library:
|
||||
-- The following example illustrates the recommended use of the library:
|
||||
-- <code>
|
||||
-- local helper = imap.Helper:new(host, port)
|
||||
-- helper:connect()
|
||||
@@ -130,7 +130,7 @@ IMAP = {
|
||||
status, data = self.socket:send("TlRMTVNTUAABAAAAB7IIogYABgA3AAAADwAPACgAAAAFASgKAAAAD0FCVVNFLUFJUi5MT0NBTERPTUFJTg==\r\n")
|
||||
if ( not(status) ) then return false, "ERROR: Failed to send NTLM packet" end
|
||||
status, data = self:receive()
|
||||
if ( not(status) ) then return false, "ERROR: Failed to receieve NTLM challenge" end
|
||||
if ( not(status) ) then return false, "ERROR: Failed to receive NTLM challenge" end
|
||||
end
|
||||
|
||||
if ( data:match(("^A%04d "):format(self.counter-1)) ) then
|
||||
@@ -245,7 +245,7 @@ Helper = {
|
||||
return self.client:connect()
|
||||
end,
|
||||
|
||||
--- Login to the server using eithe plain-text or using the authentication
|
||||
--- Login to the server using either plain-text or using the authentication
|
||||
-- mechanism provided in the mech argument.
|
||||
--
|
||||
-- @param username string containing the username
|
||||
|
||||
@@ -372,7 +372,7 @@ MessageDecoders = {
|
||||
_, len = bin.unpack(">S", data )
|
||||
|
||||
-- For some *@#! reason the SQ_DONE packet sometimes contains an
|
||||
-- length exeeding the length of the packet by one. Attempt to
|
||||
-- length exceeding the length of the packet by one. Attempt to
|
||||
-- detect this and fix.
|
||||
status, data = socket:receive_buf(match.numbytes(len), true)
|
||||
_, tmp = bin.unpack(">S", data, len - 2)
|
||||
@@ -471,7 +471,7 @@ MessageDecoders = {
|
||||
--
|
||||
-- @param socket already connected to the Informix database server
|
||||
-- @param info table containing the following fields:
|
||||
-- <code>metadata</code> as recieved from <code>SQ_DESCRIBE</code>
|
||||
-- <code>metadata</code> as received from <code>SQ_DESCRIBE</code>
|
||||
-- <code>rows</code> containing already retrieved rows
|
||||
-- <code>id</code> containing the statement id as sent to SQ_ID
|
||||
-- @return status true on success, false on failure
|
||||
@@ -1026,7 +1026,7 @@ Packet.Connect = {
|
||||
pos, tmp = bin.unpack(">S", data, pos)
|
||||
|
||||
if ( 108 ~= tmp ) then
|
||||
return false, "Connect recieved unexpected response"
|
||||
return false, "Connect received unexpected response"
|
||||
end
|
||||
|
||||
pos = pos + 12
|
||||
@@ -1058,7 +1058,7 @@ Packet.Connect = {
|
||||
pos, tmp = bin.unpack(">S", data, pos)
|
||||
|
||||
if ( tmp ~= 102 ) then
|
||||
return false, "Connect recieved unexpected response"
|
||||
return false, "Connect received unexpected response"
|
||||
end
|
||||
|
||||
pos = pos + 6
|
||||
@@ -1066,7 +1066,7 @@ Packet.Connect = {
|
||||
pos, self.oserror = bin.unpack(">s", data, pos )
|
||||
|
||||
if ( self.svcerror ~= 0 ) then
|
||||
self.errmsg = Constants.ErrorMsg[self.svcerror] or ("Unknown error %d occured"):format( self.svcerror )
|
||||
self.errmsg = Constants.ErrorMsg[self.svcerror] or ("Unknown error %d occurred"):format( self.svcerror )
|
||||
end
|
||||
|
||||
return true
|
||||
@@ -1204,7 +1204,7 @@ Helper = {
|
||||
|
||||
--- Attempts to login to the Informix database server
|
||||
-- The optional parameters parameter takes any informix specific parameters
|
||||
-- used to connect to the database. In case it's ommited a set of default
|
||||
-- used to connect to the database. In case it's omitted a set of default
|
||||
-- parameters are set. Parameters should be past as key, value pairs inside
|
||||
-- of a table array as the following example:
|
||||
--
|
||||
|
||||
@@ -398,7 +398,7 @@ Helper = {
|
||||
for _, ag in ipairs(response:getAttributeGroups(IPP.Attribute.IPP_TAG_JOB)) do
|
||||
local uri = ag:getAttributeValue("printer-uri")
|
||||
local printer = uri:match(".*/(.*)$") or "Unknown"
|
||||
-- some jobs have mutlitple state attributes, so far the ENUM ones have been correct
|
||||
-- some jobs have multiple state attributes, so far the ENUM ones have been correct
|
||||
local state = ag:getAttributeValue("job-state", IPP.Attribute.IPP_TAG_ENUM) or ag:getAttributeValue("job-state")
|
||||
-- some jobs have multiple id tag, so far the INTEGER type have shown the correct ID
|
||||
local id = ag:getAttributeValue("job-id", IPP.Attribute.IPP_TAG_INTEGER) or ag:getAttributeValue("job-id")
|
||||
|
||||
@@ -261,7 +261,7 @@ Request = {
|
||||
-- @param func_id number containing the function ID of the message
|
||||
-- @param flags number containing the message flags
|
||||
-- @param data string containing the opaque raw data
|
||||
-- @param auth string containing the opaqur raw auth data
|
||||
-- @param auth string containing the opaque raw auth data
|
||||
-- @param trans_id number containing the transaction id
|
||||
-- @param seq_id number containing the sequence id
|
||||
-- @return o new instance of Request
|
||||
@@ -452,7 +452,7 @@ Helper = {
|
||||
--
|
||||
-- Lists portals
|
||||
-- @return status true on success, false on failure
|
||||
-- @return resulst list of iSCSI nodes, err string on failure
|
||||
-- @return results list of iSCSI nodes, err string on failure
|
||||
listPortals = function(self)
|
||||
local attribs, name = Attributes:new(), "iqn.control.node\0por"
|
||||
|
||||
@@ -510,7 +510,7 @@ Helper = {
|
||||
--
|
||||
-- Lists iSCSI nodes
|
||||
-- @return status true on success, false on failure
|
||||
-- @return resulst list of iSCSI nodes, err string on failure
|
||||
-- @return results list of iSCSI nodes, err string on failure
|
||||
listISCINodes = function(self)
|
||||
local attribs = Attributes:new()
|
||||
local name = "iqn.control.node\0por"
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- JDWP (Java Debug Wire Protocol) library implementing a set of commands needed to
|
||||
-- use remote debugging port and inject java bytecode.
|
||||
--
|
||||
-- There are two basic packet types in JDWP protool.
|
||||
-- There are two basic packet types in JDWP protocol.
|
||||
-- Command packet and reply packet. Command packets are sent by
|
||||
-- a debugger to a remote port which replies with a reply packet.
|
||||
--
|
||||
-- Simple handshake is needed to start the communication.
|
||||
-- The debugger sends a "JDWP-Handshake" string and gets the same as a reply.
|
||||
-- Each (command and reply packet) has an id field since communication can be asynchronous.
|
||||
-- Packet id can be monothonicaly increasing.
|
||||
-- Packet id can be monotonicaly increasing.
|
||||
-- Although communication can be asynchronous, it is not (at least in my tests) so the same
|
||||
-- packet id can be used for all communication.
|
||||
--
|
||||
@@ -128,13 +128,13 @@ JDWPCommandPacket = {
|
||||
end,
|
||||
|
||||
-- Packs command packet as a string od bytes, ready to be sent
|
||||
-- to the target debugee.
|
||||
-- to the target debuggee.
|
||||
pack = function(self)
|
||||
local packed_packet
|
||||
if self.data == nil then
|
||||
packed_packet = bin.pack(">I",11) -- lenght - minimal header is 11 bytes
|
||||
packed_packet = bin.pack(">I",11) -- length - minimal header is 11 bytes
|
||||
else
|
||||
packed_packet = bin.pack(">I",11 + #self.data) -- lenght with data
|
||||
packed_packet = bin.pack(">I",11 + #self.data) -- length with data
|
||||
end
|
||||
packed_packet = packed_packet .. bin.pack(">I",self.id)
|
||||
packed_packet = packed_packet .. bin.pack(">C",0) -- flag
|
||||
@@ -182,7 +182,7 @@ JDWPReplyPacket = {
|
||||
|
||||
}
|
||||
|
||||
--- Negotiates the initial debugger-debugee handshake.
|
||||
--- Negotiates the initial debugger-debuggee handshake.
|
||||
--
|
||||
--@param host Host to connect to.
|
||||
--@param port Port to connect to.
|
||||
@@ -217,14 +217,14 @@ end
|
||||
--- Helper function to pack regular string into UTF-8 string.
|
||||
--
|
||||
--@param data String to pack into UTF-8.
|
||||
--@return utf8_string UTF-8 packed string. Four bytes lenght followed by the string its self.
|
||||
--@return utf8_string UTF-8 packed string. Four bytes length followed by the string its self.
|
||||
function toUTF8(data)
|
||||
local utf8_string = bin.pack(">i",#data) .. data
|
||||
return utf8_string
|
||||
end
|
||||
|
||||
--- Helper function to read all Reply packed data which might be fragmented
|
||||
-- over multipe packets.
|
||||
-- over multiple packets.
|
||||
--
|
||||
--@param socket Socket to receive from.
|
||||
--@return (status,data) If status is false, error string is returned, else data contains read ReplyPacket bytes.
|
||||
@@ -238,7 +238,7 @@ function receive_all(socket)
|
||||
while expected_length > #data do -- read until we get all the ReplyPacket data
|
||||
status,result = socket:receive()
|
||||
if not status then
|
||||
return true, data -- if somethign is wrong,return partial data
|
||||
return true, data -- if something is wrong, return partial data
|
||||
end
|
||||
data = data .. result
|
||||
end
|
||||
@@ -251,7 +251,7 @@ end
|
||||
--
|
||||
--@param data Data from which to extract the string.
|
||||
--@param pos Offset into data string where to begin.
|
||||
--@return (pos,ascii_string) Returns position where the string extraction ended and actuall ascii string.
|
||||
--@return (pos,ascii_string) Returns position where the string extraction ended and actual ascii string.
|
||||
local function extract_string(data,pos)
|
||||
local string_size
|
||||
if pos > #data then
|
||||
@@ -281,7 +281,7 @@ function executeCommand(socket,command)
|
||||
if not status then
|
||||
return false, reply_packet
|
||||
end
|
||||
if not (reply_packet.error_code == 0) then -- we have a packet with error , error code 0 means no error occured
|
||||
if not (reply_packet.error_code == 0) then -- we have a packet with error , error code 0 means no error occurred
|
||||
return false, ERROR_CODES[reply_packet.error_code]
|
||||
end
|
||||
local data = reply_packet.data
|
||||
@@ -289,7 +289,7 @@ function executeCommand(socket,command)
|
||||
end
|
||||
|
||||
--- VirtualMachine Command Set (1)
|
||||
-- Commands targeted at the debugggee virtual machine.
|
||||
-- Commands targeted at the debuggee virtual machine.
|
||||
-- http://docs.oracle.com/javase/1.5.0/docs/guide/jpda/jdwp/jdwp-protocol.html#JDWP_VirtualMachine
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ end
|
||||
-- Returns the JDWP version implemented by the target VM as a table.
|
||||
--
|
||||
-- Returns a table with following values:
|
||||
-- * 'description' Debugge vm verbose description.
|
||||
-- * 'description' Debugger vm verbose description.
|
||||
-- * 'jdwpMajor' Number representing major JDWP version.
|
||||
-- * 'jdwpMinor' Number representing minor JDWP version.
|
||||
-- * 'vmVersion' String representing version of the debuggee VM.
|
||||
@@ -376,7 +376,7 @@ end
|
||||
--
|
||||
--@param socket Socket to use to send the command.
|
||||
--@param id Packet id.
|
||||
--@return (status, threads) If status is false threads contains an error string, else it conatins a list of all threads in the debuggee VM.
|
||||
--@return (status, threads) If status is false threads contains an error string, else it contains a list of all threads in the debuggee VM.
|
||||
function getAllThreads(socket,id)
|
||||
local command = JDWPCommandPacket:new(id,1,4,nil)
|
||||
local status, data = executeCommand(socket,command)
|
||||
@@ -567,7 +567,7 @@ end
|
||||
--@numberOfArguments Number of method arguments.
|
||||
--@arguments Already packed arguments.
|
||||
--@options Invocation options.
|
||||
--@return (status, data) If status is false data contains an error string, else it contains a reply data and needs to be parsed manualy.
|
||||
--@return (status, data) If status is false data contains an error string, else it contains a reply data and needs to be parsed manually.
|
||||
function invokeStaticMethod(socket,id,classID,methodID,numberOfArguments,arguments,options)
|
||||
local params
|
||||
if numberOfArguments == 0 then
|
||||
@@ -685,7 +685,7 @@ end
|
||||
--@param methodID ID of the method to invoke.
|
||||
--@param numberOfArguments Number of method arguments.
|
||||
--@arguments Already packed arguments.
|
||||
--@return (status, data) If status is false data contains an error string, else it contains a reply data and needs to be parsed manualy.
|
||||
--@return (status, data) If status is false data contains an error string, else it contains a reply data and needs to be parsed manually.
|
||||
function invokeObjectMethod(socket,id,objectID,threadID,classID,methodID,numberOfArguments,arguments)
|
||||
local params
|
||||
|
||||
@@ -922,7 +922,7 @@ end
|
||||
--
|
||||
-- Returns a table containing following fields:
|
||||
-- * 'id' Injected class reference ID.
|
||||
-- * 'instance' Inected calss' instance reference ID.
|
||||
-- * 'instance' Injected calss' instance reference ID.
|
||||
-- * 'thread' Thread in which the class was injected and instantiated.
|
||||
--
|
||||
-- @param socket Socket to use for communication.
|
||||
@@ -944,7 +944,7 @@ function injectClass(socket,class_bytes)
|
||||
end
|
||||
end
|
||||
if byteArrayID == nil then
|
||||
stdnse.print_debug("finding byte arrray id failed")
|
||||
stdnse.print_debug("finding byte array id failed")
|
||||
return false
|
||||
end
|
||||
stdnse.print_debug("Found byte[] id %d",byteArrayID)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
-- Heavily modified 02/22/2010 - v0.3. Rewrote the parser into an OO-form, to not have to handle
|
||||
-- all kinds of state with parameters and return values.
|
||||
-- Modified 02/27/2010 - v0.4 Added unicode handling (written by David Fifield). Renamed toJson
|
||||
-- and fromJson intogenerate() and parse(), implemented more proper numeric parsing and added some more error checking.
|
||||
-- and fromJson into generate() and parse(), implemented more proper numeric parsing and added some more error checking.
|
||||
|
||||
local bit = require "bit"
|
||||
local nmap = require "nmap"
|
||||
@@ -404,7 +404,7 @@ function Json:parseUnicodeEscape()
|
||||
end
|
||||
|
||||
-- Encode a Unicode code point to UTF-8. See RFC 3629.
|
||||
-- Does not check that cp is a real charaacter; that is, doesn't exclude the
|
||||
-- Does not check that cp is a real character; that is, doesn't exclude the
|
||||
-- surrogate range U+D800 - U+DFFF and a handful of others.
|
||||
local function utf8_enc(cp)
|
||||
local bytes = {}
|
||||
|
||||
@@ -29,7 +29,7 @@ _ENV = stdnse.module("ldap", stdnse.seeall)
|
||||
local ldapMessageId = 1
|
||||
|
||||
ERROR_MSG = {}
|
||||
ERROR_MSG[1] = "Intialization of LDAP library failed."
|
||||
ERROR_MSG[1] = "Initialization of LDAP library failed."
|
||||
ERROR_MSG[4] = "Size limit exceeded."
|
||||
ERROR_MSG[13] = "Confidentiality required"
|
||||
ERROR_MSG[32] = "No such object"
|
||||
@@ -367,7 +367,7 @@ function bindRequest( socket, params )
|
||||
response.protocolOp = asn1.intToBER( tmp )
|
||||
|
||||
if response.protocolOp.number ~= APPNO.BindResponse then
|
||||
return false, string.format("Recieved incorrect Op in packet: %d, expected %d", response.protocolOp.number, APPNO.BindResponse)
|
||||
return false, string.format("Received incorrect Op in packet: %d, expected %d", response.protocolOp.number, APPNO.BindResponse)
|
||||
end
|
||||
|
||||
pos, response.resultCode = decode( packet, pos )
|
||||
@@ -378,7 +378,7 @@ function bindRequest( socket, params )
|
||||
pos, response.errorMessage = decode( packet, pos )
|
||||
error_msg = ERROR_MSG[response.resultCode]
|
||||
return false, string.format("\n Error: %s\n Details: %s",
|
||||
error_msg or "Unknown error occured (code: " .. response.resultCode ..
|
||||
error_msg or "Unknown error occurred (code: " .. response.resultCode ..
|
||||
")", response.errorMessage or "" )
|
||||
else
|
||||
return true, "Success"
|
||||
@@ -643,7 +643,7 @@ function searchResultToFile( searchEntries, filename )
|
||||
end
|
||||
end
|
||||
|
||||
-- write the new, fully populuated table out to CSV
|
||||
-- write the new, fully populated table out to CSV
|
||||
|
||||
-- initialize header row
|
||||
local output = "\"name\""
|
||||
@@ -710,7 +710,7 @@ function convertADTimeStamp(timestamp)
|
||||
if (timestamp and timestamp > 0) then
|
||||
|
||||
-- The result value was 3036 seconds off what Microsoft says it should be.
|
||||
-- I have been unable to find an explaination for this, and have resorted to
|
||||
-- I have been unable to find an explanation for this, and have resorted to
|
||||
-- manually adjusting the formula.
|
||||
|
||||
result = ( timestamp / 10000000 ) - 3036
|
||||
@@ -728,7 +728,7 @@ end
|
||||
-- For example 20110904003302.0Z becomes 2001/09/04 00:33:02 UTC
|
||||
--
|
||||
--
|
||||
-- @param timestamp in Zulu format without seperators
|
||||
-- @param timestamp in Zulu format without separators
|
||||
-- @return string containing human readable form
|
||||
function convertZuluTimeStamp(timestamp)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ local pcre = require "pcre"
|
||||
local stdnse = require "stdnse"
|
||||
_ENV = stdnse.module("match", stdnse.seeall)
|
||||
|
||||
--various functions for use with nse's nsock:receive_buf - function
|
||||
--various functions for use with NSE's nsock:receive_buf - function
|
||||
|
||||
-- e.g.
|
||||
-- sock:receive_buf(regex("myregexpattern"), true) - does a match using pcre
|
||||
|
||||
@@ -97,7 +97,7 @@ TAP = {
|
||||
-- Creates a new instance of the request
|
||||
-- @param username string containing the username
|
||||
-- @param password string containing the password
|
||||
-- @param mech string containing the SASL mechanism, currently suppored:
|
||||
-- @param mech string containing the SASL mechanism, currently supported:
|
||||
-- PLAIN - plain-text authentication
|
||||
-- @return o instance of request
|
||||
new = function(self, username, password, mech)
|
||||
@@ -315,7 +315,7 @@ Helper = {
|
||||
-- @param password string containing the password
|
||||
-- @param mech string containing the SASL mechanism to use
|
||||
-- @return status true on success, false on failure
|
||||
-- @return respons string containing "Auth failure" on failure
|
||||
-- @return response string containing "Auth failure" on failure
|
||||
login = function(self, username, password, mech)
|
||||
mech = mech or self.mech or "PLAIN"
|
||||
local status, response = self:exch(TAP.Request.Authenticate:new(username, password, mech))
|
||||
|
||||
@@ -46,7 +46,7 @@ MobileMe = {
|
||||
-- Sends a message to an iOS device
|
||||
-- @param devid string containing the device id to which the message should
|
||||
-- be sent
|
||||
-- @param subject string containing the messsage subject
|
||||
-- @param subject string containing the message subject
|
||||
-- @param message string containing the message body
|
||||
-- @param alarm boolean true if alarm should be sounded, false if not
|
||||
-- @return status true on success, false on failure
|
||||
@@ -116,7 +116,7 @@ MobileMe = {
|
||||
if ( response.status == 401 ) then
|
||||
return false, "Authentication failed"
|
||||
elseif ( response.status ~= 200 and response.status ~= 330 ) then
|
||||
return false, "An unexpected error occured"
|
||||
return false, "An unexpected error occurred"
|
||||
end
|
||||
|
||||
retries = retries - 1
|
||||
@@ -229,7 +229,7 @@ Helper = {
|
||||
--
|
||||
-- @param devid string containing the device id to which the message should
|
||||
-- be sent
|
||||
-- @param subject string containing the messsage subject
|
||||
-- @param subject string containing the message subject
|
||||
-- @param message string containing the message body
|
||||
-- @param alarm boolean true if alarm should be sounded, false if not
|
||||
-- @return status true on success, false on failure
|
||||
|
||||
@@ -325,7 +325,7 @@ Standard message header :
|
||||
struct {
|
||||
int32 messageLength; // total size of the message, including the 4 bytes of length
|
||||
int32 requestID; // client or database-generated identifier for this message
|
||||
int32 responseTo; // requestID from the original request (used in reponses from db)
|
||||
int32 responseTo; // requestID from the original request (used in responses from db)
|
||||
int32 opCode; // request type - see table below
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@ function query(socket, data)
|
||||
data = data .. try( socket:receive() )
|
||||
isComplete, pSize = isPacketComplete(data)
|
||||
end
|
||||
-- All required data shold be read now
|
||||
-- All required data should be read now
|
||||
local packetData = data:sub(1,pSize)
|
||||
local residualData = data:sub(pSize+1)
|
||||
local responseHeader = parseResponseHeader(packetData)
|
||||
@@ -629,8 +629,8 @@ function login(socket, db, username, password)
|
||||
end
|
||||
|
||||
|
||||
--- Converts a quert result as received from MongoDB query into nmap "result" table
|
||||
-- @param resultTable table as returned from a quer
|
||||
--- Converts a query result as received from MongoDB query into nmap "result" table
|
||||
-- @param resultTable table as returned from a query
|
||||
-- @return table suitable for <code>stdnse.format_output</code>
|
||||
function queryResultToTable( resultTable )
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ local LSA_GROUPSIZE = 20
|
||||
-- up. Raising this could find more users, but at the expense of more packets.
|
||||
local LSA_MINEMPTY = 10
|
||||
|
||||
---Mapping between well known MSRPC UUIDs and coresponding exe/service
|
||||
---Mapping between well known MSRPC UUIDs and corresponding exe/service
|
||||
local UUID2EXE = {
|
||||
["1ff70682-0a51-30e8-076d-740be8cee98b"] = "mstask.exe atsvc interface (Scheduler service)",
|
||||
["3faf4738-3a21-4307-b46c-fdda9bb8c0d5"] = "AudioSrv AudioSrv interface (Windows Audio service)",
|
||||
@@ -279,13 +279,13 @@ function bind(smbstate, interface_uuid, interface_version, transfer_syntax)
|
||||
parameters = result['parameters']
|
||||
data = result['data']
|
||||
|
||||
-- Extract the first part from the resposne
|
||||
-- Extract the first part from the response
|
||||
pos, result['version_major'], result['version_minor'], result['packet_type'], result['packet_flags'], result['data_representation'], result['frag_length'], result['auth_length'], result['call_id'] = bin.unpack("<CCCC>I<SSI", data)
|
||||
if(result['call_id'] == nil) then
|
||||
return false, "MSRPC: ERROR: Ran off the end of SMB packet; likely due to server truncation"
|
||||
end
|
||||
|
||||
-- Check if the packet tyep was a fault
|
||||
-- Check if the packet type was a fault
|
||||
if(result['packet_type'] == 0x03) then -- MSRPC_FAULT
|
||||
return false, "Bind() returned a fault (packet type)"
|
||||
end
|
||||
@@ -406,7 +406,7 @@ function call_function(smbstate, opnum, arguments)
|
||||
parameters = result['parameters']
|
||||
data = result['data']
|
||||
|
||||
-- Extract the first part from the resposne
|
||||
-- Extract the first part from the response
|
||||
pos, result['version_major'], result['version_minor'], result['packet_type'], result['packet_flags'], result['data_representation'], result['frag_length'], result['auth_length'], result['call_id'] = bin.unpack("<CCCC>I<SSI", data)
|
||||
if(result['call_id'] == nil) then
|
||||
return false, "MSRPC: ERROR: Ran off the end of SMB packet; likely due to server truncation"
|
||||
@@ -458,7 +458,7 @@ function call_function(smbstate, opnum, arguments)
|
||||
|
||||
result['arguments'] = arguments
|
||||
|
||||
stdnse.print_debug(3, "MSRPC: Function call successful, %d bytes of returned argumenst", #result['arguments'])
|
||||
stdnse.print_debug(3, "MSRPC: Function call successful, %d bytes of returned arguments", #result['arguments'])
|
||||
|
||||
return true, result
|
||||
end
|
||||
@@ -1018,12 +1018,12 @@ function spoolss_open_printer(smbstate,printer)
|
||||
|
||||
local arguments = msrpctypes.marshall_unicode_ptr(printer,true)
|
||||
arguments = arguments .. msrpctypes.marshall_int32(0)
|
||||
--devmod containter
|
||||
--devmod container
|
||||
arguments = arguments .. msrpctypes.marshall_int32(0)
|
||||
arguments = arguments .. msrpctypes.marshall_int32(0)
|
||||
--access we require
|
||||
arguments = arguments .. msrpctypes.marshall_int32(0x02020000)
|
||||
-- spool client containter
|
||||
-- spool client container
|
||||
arguments = arguments .. msrpctypes.marshall_int32(1)
|
||||
arguments = arguments .. msrpctypes.marshall_int32(1)
|
||||
arguments = arguments .. msrpctypes.marshall_int32(12345135)
|
||||
@@ -1145,10 +1145,10 @@ function uuid_to_string(uuid)
|
||||
return string.format("%02x-%02x-%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",i1,s1,s2,c1,c2,c3,c4,c5,c6,c7,c8)
|
||||
end
|
||||
|
||||
--- Helper function that maps known UUIDs to coresponding exe/services.
|
||||
--- Helper function that maps known UUIDs to corresponding exe/services.
|
||||
--
|
||||
--@param uuid
|
||||
--@return Coresponding service and description as a string or nil.
|
||||
--@return Corresponding service and description as a string or nil.
|
||||
function string_uuid_to_exe(uuid)
|
||||
return UUID2EXE[uuid]
|
||||
end
|
||||
@@ -2574,7 +2574,7 @@ end
|
||||
-- under the given handle, at the index of 'index'.
|
||||
--
|
||||
--@param smbstate The SMB state table
|
||||
--@param handle A handle to hive or key. <code>winreg_openhku</code> provides a useable key, for example.
|
||||
--@param handle A handle to hive or key. <code>winreg_openhku</code> provides a usable key, for example.
|
||||
--@param index The index of the key to return. Generally you'll start at 0 and increment until
|
||||
-- an error is returned.
|
||||
--@param name The <code>name</code> buffer. This should be set to the empty string; however, setting to 'nil' can have
|
||||
@@ -2647,7 +2647,7 @@ end
|
||||
--- Calls the function <code>OpenKey</code>, which obtains a handle to a named key.
|
||||
--
|
||||
--@param smbstate The SMB state table
|
||||
--@param handle A handle to hive or key. <code>winreg_openhku</code> provides a useable key, for example.
|
||||
--@param handle A handle to hive or key. <code>winreg_openhku</code> provides a usable key, for example.
|
||||
--@param keyname The name of the key to open.
|
||||
--@return (status, result) If status is false, result is an error message. Otherwise, result is a table of values, the most
|
||||
-- useful one being 'handle', which is a handle to the newly opened key.
|
||||
@@ -4059,7 +4059,7 @@ function get_user_list(host)
|
||||
return true, response, names
|
||||
end
|
||||
|
||||
---Retrieve information about a domain. This is done by three seperate calls to samr_querydomaininfo2() to get all
|
||||
---Retrieve information about a domain. This is done by three separate calls to samr_querydomaininfo2() to get all
|
||||
-- possible information. smbstate has to be in the proper state for this to work.
|
||||
local function get_domain_info(host, domain)
|
||||
local result = {}
|
||||
@@ -4649,7 +4649,7 @@ function get_server_stats(host)
|
||||
stats['bytessent'] = bit.bor(bit.lshift(stats['bytessent_high'], 32), stats['bytessent_low'])
|
||||
stats['bytesrcvd'] = bit.bor(bit.lshift(stats['bytesrcvd_high'], 32), stats['bytesrcvd_low'])
|
||||
|
||||
-- Sidestep divide-by-zero errors (probabyl won't come up, but I'd rather be safe)
|
||||
-- Sidestep divide-by-zero errors (probably won't come up, but I'd rather be safe)
|
||||
if(stats['period'] == 0) then
|
||||
stats['period'] = 1
|
||||
end
|
||||
@@ -4687,7 +4687,7 @@ function enum_shares(host)
|
||||
return false, bind_result
|
||||
end
|
||||
|
||||
-- Call netsharenumall
|
||||
-- Call netshareenumall
|
||||
status, netshareenumall_result = srvsvc_netshareenumall(smbstate, host.ip)
|
||||
if(status == false) then
|
||||
smb.stop(smbstate)
|
||||
|
||||
@@ -344,7 +344,7 @@ end
|
||||
-- // for each instance.
|
||||
-- //
|
||||
-- // If (PERF_DATA_BLOCK.NumInstances < 0) then the counter definition
|
||||
-- // strucutre above will be followed by only a PERF_COUNTER_BLOCK and the
|
||||
-- // structure above will be followed by only a PERF_COUNTER_BLOCK and the
|
||||
-- // counter data for that COUNTER.
|
||||
-- typedef struct _PERF_INSTANCE_DEFINITION {
|
||||
-- DWORD ByteLength; // Length in bytes of this structure,
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
-- Strings are a little bit trickier. A string is preceded by three 32-bit values: the max length, the offset, and
|
||||
-- the length. Additionally, strings may or may not be null terminated, depending on where they're being used. For
|
||||
-- more information on strings, see the comments on <code>marshall_unicode</code>. The functions <code>marshall_unicode</code>
|
||||
-- and <code>unmarshall_unicode</code> can be used to mashall/unmarshall strings.
|
||||
-- and <code>unmarshall_unicode</code> can be used to marshall/unmarshall strings.
|
||||
--
|
||||
-- Pointers also have interesting properties. A pointer is preceeded by a 4-byte value called (at least by Wireshark)
|
||||
-- Pointers also have interesting properties. A pointer is preceded by a 4-byte value called (at least by Wireshark)
|
||||
-- the "referent id". For a valid pointer, this can be anything except 0 (I use 'NMAP' for it). If it's '0', then
|
||||
-- it's a null pointer and the data doesn't actually follow. To help clarify, a pointer to the integer '4' could be
|
||||
-- marshalled as the hex string <code>78 56 34 12 04 00 00 00</code> (the referent_id is 0x12345678 and the integer
|
||||
@@ -33,7 +33,7 @@
|
||||
--
|
||||
-- So far, this is fairly straight forward. Arrays are where everything falls apart.
|
||||
--
|
||||
-- An array of basic types is simply the types themselves, preceeded by the "max length" of the array (which can be
|
||||
-- An array of basic types is simply the types themselves, preceded by the "max length" of the array (which can be
|
||||
-- longer than the actual length). When pointers are used in an array, however, things get hairy. The 'referent_id's
|
||||
-- of the pointers are all put at the start of the array, along with the base types. Then, the data is put at the
|
||||
-- end of the array, for all the referent_ids that aren't null. Let's say you have four strings, "abc", "def", null, and
|
||||
@@ -83,12 +83,12 @@
|
||||
-- function the same way <code>unmarshall_array</code> would. This is a bit of a kludge, but it's the best I could come up
|
||||
-- with.
|
||||
--
|
||||
-- There are different sections in here, which correspond to "families" of types. I modelled these after Samba's <code>.idl</code> files.
|
||||
-- There are different sections in here, which correspond to "families" of types. I modeled these after Samba's <code>.idl</code> files.
|
||||
-- MISC corresponds to <code>misc.idl</code>, LSA to <code>lsa.idl</code>, etc. Each of these sections has possible dependencies; for example, SAMR
|
||||
-- functions use LSA strings, and everything uses SECURITY and MISC. So the order is important -- dependencies have to go
|
||||
-- above the module.
|
||||
--
|
||||
-- The datatypes used here are modelled after the datatypes used by Microsoft's functions. Each function that represents
|
||||
-- The datatypes used here are modeled after the datatypes used by Microsoft's functions. Each function that represents
|
||||
-- a struct will have the struct definition in its comment; and that struct (or the closest representation to it) will be
|
||||
-- returned. Often, this requires scripts to access something like <code>result['names']['names'][0]['name']</code>, which is
|
||||
-- rather unwieldy, but I decided that following Microsoft's definitions was the most usable way for many reasons. I find
|
||||
@@ -148,7 +148,7 @@ function string_to_unicode(string, do_null)
|
||||
result = result .. string.sub(string, i, i) .. string.char(0)
|
||||
end
|
||||
|
||||
-- Add a null, if the caller requestd it
|
||||
-- Add a null, if the caller requested it
|
||||
if(do_null == true) then
|
||||
result = result .. string.char(0) .. string.char(0)
|
||||
end
|
||||
@@ -230,7 +230,7 @@ end
|
||||
-- When marshalling the body, the function <code>func</code> is called, which is passed as
|
||||
-- a parameter, with the arguments <code>args</code>. This function has to return a marshalled
|
||||
-- parameter, but other than that it can be any marshalling function. The 'value' parameter
|
||||
-- simply determined whether or not it's a null pointer, and will probably be a repease of
|
||||
-- simply determined whether or not it's a null pointer, and will probably be a repeat of
|
||||
-- one of the arguments.
|
||||
--
|
||||
-- Note that the function <code>func</code> doesn't have to conform to any special prototype,
|
||||
@@ -572,7 +572,7 @@ function marshall_unicode(str, do_null, max_length)
|
||||
return result
|
||||
end
|
||||
|
||||
--- Marshall a null-teriminated ascii string, with the length/maxlength prepended. Very similar
|
||||
--- Marshall a null-terminated ascii string, with the length/maxlength prepended. Very similar
|
||||
-- to <code>marshall_unicode</code>, except it's ascii and the null terminator is always used.
|
||||
--
|
||||
--@param str The string to marshall.
|
||||
@@ -1154,7 +1154,7 @@ function marshall_NTTIME(time)
|
||||
return result
|
||||
end
|
||||
|
||||
---Unmarshalles an NTTIME. See <code>marshall_NTTIME</code> for more information.
|
||||
---Unmarshalls an NTTIME. See <code>marshall_NTTIME</code> for more information.
|
||||
--
|
||||
--@param data The data packet.
|
||||
--@param pos The position within the data.
|
||||
@@ -1190,7 +1190,7 @@ function marshall_NTTIME_ptr(time)
|
||||
return result
|
||||
end
|
||||
|
||||
---Unmarshalles an <code>NTTIME*</code>.
|
||||
---Unmarshalls an <code>NTTIME*</code>.
|
||||
--
|
||||
--@param data The data packet.
|
||||
--@param pos The position within the data.
|
||||
@@ -1935,7 +1935,7 @@ end
|
||||
--@param sid_type The <code>sid_type</code> value (I don't know what this means)
|
||||
--@param rid The <code>rid</code> (a number representing the user)
|
||||
--@param sid_index The <code>sid_index</code> value (I don't know what this means, either)
|
||||
--@param unknown An unknown value (is normaly 0).
|
||||
--@param unknown An unknown value (is normally 0).
|
||||
--@return A string representing the marshalled data.
|
||||
local function marshall_lsa_TranslatedSid2(location, sid_type, rid, sid_index, unknown)
|
||||
local result = ""
|
||||
@@ -2760,7 +2760,7 @@ function unmarshall_winreg_StringBuf_ptr(data, pos)
|
||||
end
|
||||
|
||||
|
||||
--- A winreg_String has the same makup as a winreg_StringBuf, as far as I can tell, so delegate to that function.
|
||||
--- A winreg_String has the same makeup as a winreg_StringBuf, as far as I can tell, so delegate to that function.
|
||||
--
|
||||
--@param table The table representing the String.
|
||||
--@param max_length [optional] The maximum size of the buffer, in characters. Defaults to the length of the string, including the null.
|
||||
@@ -2775,7 +2775,7 @@ function marshall_winreg_String(table, max_length)
|
||||
return result
|
||||
end
|
||||
|
||||
---Unmarshall a winreg_String. Since ti has the same makup as winreg_StringBuf, delegate to that.
|
||||
---Unmarshall a winreg_String. Since it has the same makeup as winreg_StringBuf, delegate to that.
|
||||
--
|
||||
--@param data The data buffer.
|
||||
--@param pos The position in the data buffer.
|
||||
@@ -4499,19 +4499,19 @@ local atsvc_DaysOfMonth =
|
||||
Fifth = 0x00000010,
|
||||
Sixth = 0x00000020,
|
||||
Seventh = 0x00000040,
|
||||
Eight = 0x00000080,
|
||||
Eighth = 0x00000080,
|
||||
Ninth = 0x00000100,
|
||||
Tenth = 0x00000200,
|
||||
Eleventh = 0x00000400,
|
||||
Twelfth = 0x00000800,
|
||||
Thitteenth = 0x00001000,
|
||||
Thirteenth = 0x00001000,
|
||||
Fourteenth = 0x00002000,
|
||||
Fifteenth = 0x00004000,
|
||||
Sixteenth = 0x00008000,
|
||||
Seventeenth = 0x00010000,
|
||||
Eighteenth = 0x00020000,
|
||||
Ninteenth = 0x00040000,
|
||||
Twentyth = 0x00080000,
|
||||
Twentieth = 0x00080000,
|
||||
Twentyfirst = 0x00100000,
|
||||
Twentysecond = 0x00200000,
|
||||
Twentythird = 0x00400000,
|
||||
|
||||
@@ -50,11 +50,11 @@
|
||||
-- </code>
|
||||
--
|
||||
-- Known limitations:
|
||||
-- * The library does not support SSL. The foremost reason being the akward choice of implementation where the SSL handshake is performed within the TDS data block. By default, servers support connections over non SSL connections though.
|
||||
-- * The library does not support SSL. The foremost reason being the awkward choice of implementation where the SSL handshake is performed within the TDS data block. By default, servers support connections over non SSL connections though.
|
||||
-- * Version 7 and ONLY version 7 of the protocol is supported. This should cover Microsoft SQL Server 7.0 and later.
|
||||
-- * TDS Responses contain one or more response tokens which are parsed based on their type. The supported tokens are listed in the <code>TokenType</code> table and their respective parsers can be found in the <code>Token</code> class. Note that some token parsers are not fully implemented and simply move the offset the right number of bytes to continue processing of the response.
|
||||
-- * The library only supports a limited subsets of datatypes and will abort execution and return an error if it detects an unsupported type. The supported data types are listed in the <code>DataTypes</code> table. In order to add additional data types a parser function has to be added to both the <code>ColumnInfo</code> and <code>ColumnData</code> class.
|
||||
-- * No functionality for languages, localization or characted codepages has been considered or implemented.
|
||||
-- * No functionality for languages, localization or character codepages has been considered or implemented.
|
||||
-- * The library does database authentication only. No OS authentication or use of the integrated security model is supported.
|
||||
-- * Queries using SELECT, INSERT, DELETE and EXEC of procedures have been tested while developing scripts.
|
||||
--
|
||||
@@ -78,7 +78,7 @@
|
||||
-- @args mssql.instance-port The port of the instance to connect to.
|
||||
--
|
||||
-- @args mssql.instance-all Targets all SQL server instances discovered
|
||||
-- throught the browser service.
|
||||
-- through the browser service.
|
||||
--
|
||||
-- @args mssql.domain The domain against which to perform integrated
|
||||
-- authentication. When set, the scripts assume integrated authentication
|
||||
@@ -267,9 +267,9 @@ SqlServerVersionInfo =
|
||||
minor = nil, -- The minor version (e.g. 0)
|
||||
build = nil, -- The build number (e.g. 2047)
|
||||
subBuild = nil, -- The sub-build number (e.g. 0)
|
||||
productName = nil, -- The prodcut name (e.g. "SQL Server 2005")
|
||||
productName = nil, -- The product name (e.g. "SQL Server 2005")
|
||||
brandedVersion = nil, -- The branded version of the product (e.g. "2005")
|
||||
servicePackLevel = nil, -- The service pack leve (e.g. "SP1")
|
||||
servicePackLevel = nil, -- The service pack level (e.g. "SP1")
|
||||
patched = nil, -- Whether patches have been applied since SP installation (true/false/nil)
|
||||
source = nil, -- The source of the version info (e.g. "SSRP", "SSNetLib")
|
||||
|
||||
@@ -513,7 +513,7 @@ SSRP =
|
||||
--- Parses an SSRP string and returns a table containing one or more
|
||||
-- SqlServerInstanceInfo objects created from the parsed string.
|
||||
_ParseSsrpString = function( host, ssrpString )
|
||||
-- It would seem easier to just capture (.-;;) repeateadly, since
|
||||
-- It would seem easier to just capture (.-;;) repeatedly, since
|
||||
-- each instance ends with ";;", but ";;" can also occur within the
|
||||
-- data, signifying an empty field (e.g. "...bv;;@COMPNAME;;tcp;1433;;...").
|
||||
-- So, instead, we'll split up the string ahead of time.
|
||||
@@ -743,7 +743,7 @@ for i, v in pairs(LoginErrorType) do
|
||||
LoginErrorMessage[v] = i
|
||||
end
|
||||
|
||||
-- "static" ColumInfo parser class
|
||||
-- "static" ColumnInfo parser class
|
||||
ColumnInfo =
|
||||
{
|
||||
|
||||
@@ -879,7 +879,7 @@ ColumnInfo =
|
||||
|
||||
}
|
||||
|
||||
-- "static" ColumData parser class
|
||||
-- "static" ColumnData parser class
|
||||
ColumnData =
|
||||
{
|
||||
Parse = {
|
||||
@@ -1326,7 +1326,7 @@ Token =
|
||||
return pos, token
|
||||
end,
|
||||
|
||||
--- Parses a DoneProc token recieved after executing a SP
|
||||
--- Parses a DoneProc token received after executing a SP
|
||||
--
|
||||
-- @param data string containing "raw" data
|
||||
-- @param pos number containing offset into data
|
||||
@@ -1341,7 +1341,7 @@ Token =
|
||||
end,
|
||||
|
||||
|
||||
--- Parses a DoneInProc token recieved after executing a SP
|
||||
--- Parses a DoneInProc token received after executing a SP
|
||||
--
|
||||
-- @param data string containing "raw" data
|
||||
-- @param pos number containing offset into data
|
||||
@@ -1834,7 +1834,7 @@ LoginPacket =
|
||||
|
||||
-- offset to auth info
|
||||
data = data .. bin.pack("<S", offset)
|
||||
-- lenght of nt auth (should be 0 for sql auth)
|
||||
-- length of nt auth (should be 0 for sql auth)
|
||||
data = data .. bin.pack("<S", authLen)
|
||||
-- next position (same as total packet length)
|
||||
data = data .. bin.pack("<S", self.length)
|
||||
@@ -2143,7 +2143,7 @@ TDSStream = {
|
||||
end
|
||||
end,
|
||||
|
||||
--- Recieves responses from SQL Server
|
||||
--- Receives responses from SQL Server
|
||||
-- The function continues to read and assemble a response until the server
|
||||
-- responds with the last response flag set
|
||||
--
|
||||
@@ -3140,7 +3140,7 @@ Util =
|
||||
--- Takes a table as returned by Query and does some fancy formatting
|
||||
-- better suitable for <code>stdnse.output_result</code>
|
||||
--
|
||||
-- @param tbl as recieved by <code>Helper.Query</code>
|
||||
-- @param tbl as received by <code>Helper.Query</code>
|
||||
-- @param with_headers boolean true if output should contain column headers
|
||||
-- @return table suitable for <code>stdnse.output_result</code>
|
||||
FormatOutputTable = function ( tbl, with_headers )
|
||||
|
||||
@@ -19,7 +19,7 @@ _ENV = stdnse.module("mysql", stdnse.seeall)
|
||||
--
|
||||
-- Created 01/15/2010 - v0.1 - created by Patrik Karlsson <patrik@cqure.net>
|
||||
-- Revised 01/23/2010 - v0.2 - added query support, cleanup, documentation
|
||||
-- Revised 08/24/2010 - v0.3 - added error handling for recieveGreeting
|
||||
-- Revised 08/24/2010 - v0.3 - added error handling for receiveGreeting
|
||||
-- fixed a number of incorrect receives and changed
|
||||
-- them to receive_bytes instead.
|
||||
|
||||
@@ -97,7 +97,7 @@ local function decodeHeader( data, pos )
|
||||
return pos, response
|
||||
end
|
||||
|
||||
--- Recieves the server greeting upon intial connection
|
||||
--- Receives the server greeting upon initial connection
|
||||
--
|
||||
-- @param socket already connected to the remote server
|
||||
-- @return status true on success, false on failure
|
||||
@@ -188,7 +188,7 @@ end
|
||||
-- currently only post41 authentication is supported
|
||||
-- @param username string containing the username of the user that is authenticating
|
||||
-- @param password string containing the users password or nil if empty
|
||||
-- @param salt string containing the servers salt as recieved from <code>receiveGreeting</code>
|
||||
-- @param salt string containing the servers salt as received from <code>receiveGreeting</code>
|
||||
-- @return status boolean
|
||||
-- @return response table or error message on failure
|
||||
function loginRequest( socket, params, username, password, salt )
|
||||
@@ -489,7 +489,7 @@ end
|
||||
-- @param socket socket already connected to mysql
|
||||
-- @param query string containing the sql query
|
||||
-- @return status true on success, false on failure
|
||||
-- @return rows table containing row tabels as decoded by <code>decodeDataPackets</code>
|
||||
-- @return rows table containing row tables as decoded by <code>decodeDataPackets</code>
|
||||
function sqlQuery( socket, query )
|
||||
|
||||
local catch = function() socket:close() stdnse.print_debug("sqlQuery(): failed") end
|
||||
@@ -548,7 +548,7 @@ end
|
||||
-- @param rs table as returned from <code>sqlQuery</code>
|
||||
-- @param options table containing additional options, currently:
|
||||
-- - <code>noheaders</code> - does not include column names in result
|
||||
-- @return string containing the formated resultset table
|
||||
-- @return string containing the formatted resultset table
|
||||
function formatResultset(rs, options)
|
||||
options = options or {}
|
||||
if ( not(rs) or not(rs.cols) or not(rs.rows) ) then
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
-- server.
|
||||
--
|
||||
-- * Helper
|
||||
-- - The prefered script interface to the library containing functions
|
||||
-- - The preferred script interface to the library containing functions
|
||||
-- that wrap functions from the NCP class using more descriptive names
|
||||
-- and easier interface.
|
||||
--
|
||||
|
||||
@@ -278,7 +278,7 @@ Comm = {
|
||||
|
||||
-- Creates new Comm instance
|
||||
-- @param host table as received by the action method
|
||||
-- @param port table as receuved by the action method
|
||||
-- @param port table as received by the action method
|
||||
-- @return o new instance of Comm
|
||||
new = function(self, host, port)
|
||||
local o = {
|
||||
|
||||
@@ -713,7 +713,7 @@ function pcap_close()
|
||||
--
|
||||
-- It also has the following member functions:
|
||||
--
|
||||
-- * <code>digest(algorithm)</code> returns the digest of the certificate using the given digest algorithm, which is any of the strings returned by <code>openssl.supported_digests</code>, typicaly something like <code>"md5"</code> or <code>"sha1"</code>.
|
||||
-- * <code>digest(algorithm)</code> returns the digest of the certificate using the given digest algorithm, which is any of the strings returned by <code>openssl.supported_digests</code>, typically something like <code>"md5"</code> or <code>"sha1"</code>.
|
||||
--
|
||||
-- The <code>"subject"</code> and <code>"issuer"</code> fields hold each
|
||||
-- distinguished name. Fields with an unknown OID are represented as an array
|
||||
|
||||
@@ -82,8 +82,8 @@ Helper = {
|
||||
|
||||
--- Creates a new Helper instance
|
||||
--
|
||||
-- @param host table as recieved by the script action method
|
||||
-- @param port table as recieved by the script action method
|
||||
-- @param host table as received by the script action method
|
||||
-- @param port table as received by the script action method
|
||||
new = function(self, host, port)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
|
||||
@@ -85,7 +85,7 @@ function bignum_rand(bits)
|
||||
|
||||
--- Returns a pseudorandom bignum.
|
||||
-- @param bits Size of the returned bignum in bits.
|
||||
-- @return Pseudoandom bignum.
|
||||
-- @return Pseudorandom bignum.
|
||||
function bignum_pseudo_rand(bits)
|
||||
|
||||
--- Returns the bignum which is the result of <code>a</code>^<code>p</code> mod
|
||||
|
||||
@@ -110,7 +110,7 @@ function in_cksum(b)
|
||||
sum = bit.rshift(sum, 16) + bit.band(sum, 0xffff)
|
||||
sum = sum + bit.rshift(sum, 16)
|
||||
sum = bit.bnot(sum)
|
||||
sum = bit.band(sum, 0xffff) -- trunctate to 16 bits
|
||||
sum = bit.band(sum, 0xffff) -- truncate to 16 bits
|
||||
return sum
|
||||
end
|
||||
|
||||
@@ -361,7 +361,7 @@ end
|
||||
-- @param mac_src six-byte string of source MAC address.
|
||||
-- @param mac_dst sis-byte string of destination MAC address.
|
||||
-- @param ip_bin_src 16-byte string of source IPv6 address.
|
||||
-- @param ip_bin_dst 16-byte string of destinatiion IPv6 address.
|
||||
-- @param ip_bin_dst 16-byte string of destination IPv6 address.
|
||||
-- @param id integer that represents Echo ID.
|
||||
-- @param sequence integer that represents Echo sequence.
|
||||
-- @param data string of Echo data.
|
||||
@@ -453,7 +453,7 @@ end
|
||||
-- @param mac_src six-byte string of source MAC address.
|
||||
-- @param mac_dst sis-byte string of destination MAC address.
|
||||
-- @param ip_bin_src 16-byte string of source IPv6 address.
|
||||
-- @param ip_bin_dst 16-byte string of destinatiion IPv6 address.
|
||||
-- @param ip_bin_dst 16-byte string of destination IPv6 address.
|
||||
-- @param id integer that represents Echo ID.
|
||||
-- @param seq integer that represents Echo sequence.
|
||||
-- @param data string of Echo data.
|
||||
@@ -505,7 +505,7 @@ function ip6tobin(str)
|
||||
local dot_count = stdnse.strsplit("%.", str)
|
||||
if #dot_count == 4 then -- It might be IPv4-compatible IPv6 address.
|
||||
local ip64 = stdnse.strsplit(":", str)
|
||||
local ip4_str = ip64[#ip64] -- Get the embeded IPv4 address string.
|
||||
local ip4_str = ip64[#ip64] -- Get the embedded IPv4 address string.
|
||||
ip4_bin = iptobin(ip4_str)
|
||||
if not ip4_bin then
|
||||
return nil
|
||||
@@ -626,7 +626,7 @@ function Packet:u32(index)
|
||||
end
|
||||
--- Return part of the packet contents as a byte string.
|
||||
-- @param index The beginning of the part of the packet to extract. The index
|
||||
-- is 0-based. If omitted the default value is 0 (begining of the string)
|
||||
-- is 0-based. If omitted the default value is 0 (beginning of the string)
|
||||
-- @param length The length of the part of the packet to extract. If omitted
|
||||
-- the remaining contents from index to the end of the string are returned.
|
||||
-- @return A string.
|
||||
|
||||
@@ -22,7 +22,7 @@ _ENV = stdnse.module("pgsql", stdnse.seeall)
|
||||
|
||||
-- Version 0.3
|
||||
-- Created 02/05/2010 - v0.1 - created by Patrik Karlsson <patrik@cqure.net>
|
||||
-- Revised 02/20/2010 - v0.2 - added detectVersion to automaticaly detect and return
|
||||
-- Revised 02/20/2010 - v0.2 - added detectVersion to automatically detect and return
|
||||
-- the correct version class
|
||||
-- Revised 03/04/2010 - v0.3 - added support for trust authentication method
|
||||
|
||||
@@ -68,7 +68,7 @@ v2 =
|
||||
|
||||
--- Decodes an Auth Request packet
|
||||
--
|
||||
-- @param data string containing raw data recieved from socket
|
||||
-- @param data string containing raw data received from socket
|
||||
-- @param len number containing the length as retrieved from the header
|
||||
-- @param pos number containing the offset into the data buffer
|
||||
-- @return pos number containing the offset after decoding, -1 on error
|
||||
@@ -100,7 +100,7 @@ v2 =
|
||||
|
||||
--- Decodes an Error packet
|
||||
--
|
||||
-- @param data string containing raw data recieved from socket
|
||||
-- @param data string containing raw data received from socket
|
||||
-- @param len number containing the length as retrieved from the header
|
||||
-- @param pos number containing the offset into the data buffer
|
||||
-- @return pos number containing the offset after decoding
|
||||
@@ -212,7 +212,7 @@ v2 =
|
||||
-- @param params table containing any additional parameters <code>authtype</code>, <code>version</code>
|
||||
-- @param username string containing the username to use for authentication
|
||||
-- @param password string containing the password to use for authentication
|
||||
-- @param salt string containing the crypthographic salt value
|
||||
-- @param salt string containing the cryptographic salt value
|
||||
-- @return status true on success, false on failure
|
||||
-- @return result table containing parameter status information,
|
||||
-- result string containing an error message if login fails
|
||||
@@ -261,7 +261,7 @@ v3 =
|
||||
|
||||
--- Decodes an Auth Request packet
|
||||
--
|
||||
-- @param data string containing raw data recieved from socket
|
||||
-- @param data string containing raw data received from socket
|
||||
-- @param len number containing the length as retrieved from the header
|
||||
-- @param pos number containing the offset into the data buffer
|
||||
-- @return pos number containing the offset after decoding, -1 on error
|
||||
@@ -292,7 +292,7 @@ v3 =
|
||||
|
||||
--- Decodes an ParameterStatus packet
|
||||
--
|
||||
-- @param data string containing raw data recieved from socket
|
||||
-- @param data string containing raw data received from socket
|
||||
-- @param len number containing the length as retrieved from the header
|
||||
-- @param pos number containing the offset into the data buffer
|
||||
-- @return pos number containing the offset after decoding
|
||||
@@ -308,7 +308,7 @@ v3 =
|
||||
|
||||
--- Decodes an Error packet
|
||||
--
|
||||
-- @param data string containing raw data recieved from socket
|
||||
-- @param data string containing raw data received from socket
|
||||
-- @param len number containing the length as retrieved from the header
|
||||
-- @param pos number containing the offset into the data buffer
|
||||
-- @return pos number containing the offset after decoding
|
||||
@@ -345,7 +345,7 @@ v3 =
|
||||
|
||||
--- Decodes the BackendKeyData packet
|
||||
--
|
||||
-- @param data string containing raw data recieved from socket
|
||||
-- @param data string containing raw data received from socket
|
||||
-- @param len number containing the length as retrieved from the header
|
||||
-- @param pos number containing the offset into the data buffer
|
||||
-- @return pos number containing the offset after decoding, -1 on error
|
||||
@@ -364,7 +364,7 @@ v3 =
|
||||
|
||||
--- Decodes an ReadyForQuery packet
|
||||
--
|
||||
-- @param data string containing raw data recieved from socket
|
||||
-- @param data string containing raw data received from socket
|
||||
-- @param len number containing the length as retrieved from the header
|
||||
-- @param pos number containing the offset into the data buffer
|
||||
-- @return pos number containing the offset after decoding, -1 on error
|
||||
@@ -468,7 +468,7 @@ v3 =
|
||||
-- @param params table containing any additional parameters <code>authtype</code>, <code>version</code>
|
||||
-- @param username string containing the username to use for authentication
|
||||
-- @param password string containing the password to use for authentication
|
||||
-- @param salt string containing the crypthographic salt value
|
||||
-- @param salt string containing the cryptographic salt value
|
||||
-- @return status true on success, false on failure
|
||||
-- @return result table containing parameter status information,
|
||||
-- result string containing an error message if login fails
|
||||
|
||||
@@ -822,7 +822,7 @@ Helper = {
|
||||
retries = retries - 1
|
||||
until( pado.tags or retries == 0 )
|
||||
if ( not(pado.tags) ) then
|
||||
return false, "PADO response containined no tags"
|
||||
return false, "PADO response contained no tags"
|
||||
end
|
||||
|
||||
local pado_host_unique
|
||||
|
||||
@@ -15,7 +15,7 @@ _ENV = stdnse.module("proxy", stdnse.seeall)
|
||||
|
||||
-- Start of local functions
|
||||
|
||||
--- check function, makes checkings for all valid returned status
|
||||
--- check function, checks for all valid returned status
|
||||
--- If any of the HTTP status below is found, the proxy is potentially open
|
||||
--- The script tries to split header from body before checking for status
|
||||
--@param result connection result
|
||||
@@ -225,7 +225,7 @@ function socksHandshake(socket, version, hostname)
|
||||
if(r2 ~= 0x00) then
|
||||
stdnse.print_debug("Socks5: Authentication required")
|
||||
else
|
||||
-- If no Auth is required, try to estabilish connection
|
||||
-- If no Auth is required, try to establish connection
|
||||
stdnse.print_debug("Socks5: No authentication required")
|
||||
-- Socks5 second payload: Version, Command, Null, Address type, Ip-Address, Port number
|
||||
paystring = '05 01 00 01 ' .. sip .. '00 50'
|
||||
@@ -264,7 +264,7 @@ end
|
||||
-- if true, the proxy server might be redirecting the requests
|
||||
-- to a default page
|
||||
--
|
||||
-- Functions slipts body from head before comparing, to avoid session
|
||||
-- Functions splits body from head before comparing, to avoid session
|
||||
-- variables, cookies...
|
||||
--
|
||||
-- @param resp1 A string with the response for the first request
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
--
|
||||
-- If you want to add calls to classes you know of, you can use e.g Jode to decompile the
|
||||
-- stub-class or skeleton class and find out the details that are needed to perform an
|
||||
-- RMI method invokation. Those are
|
||||
-- RMI method invocation. Those are
|
||||
-- Class hashcode
|
||||
-- Method number (each method gets a number)
|
||||
-- Arguments f
|
||||
@@ -78,7 +78,7 @@ end
|
||||
-- local breader= BufferedReader:new(socket)
|
||||
--
|
||||
-- bWriter.pack('>i', integer)
|
||||
-- bWrier.flush() -- sends the data
|
||||
-- bWriter.flush() -- sends the data
|
||||
--
|
||||
-- if bsocket:canRead(4) then -- Waits until four bytes can be read
|
||||
-- local packetLength = bsocket:unpack('i') -- Read the four bytess
|
||||
@@ -142,7 +142,7 @@ BufferedWriter = {
|
||||
-- local breader= BufferedReader:new(socket)
|
||||
--
|
||||
-- bWriter.pack('>i', integer)
|
||||
-- bWrier.flush() -- sends the data
|
||||
-- bWriter.flush() -- sends the data
|
||||
--
|
||||
-- if bsocket:canRead(4) then -- Waits until four bytes can be read
|
||||
-- local packetLength = bsocket:unpack('i') -- Read the four bytess
|
||||
@@ -161,7 +161,7 @@ BufferedReader = {
|
||||
end,
|
||||
---
|
||||
-- This method blocks until the specified number of bytes
|
||||
-- have been read from the socket and are avaiable for
|
||||
-- have been read from the socket and are available for
|
||||
-- the caller to read, e.g via the unpack function
|
||||
canRead= function(self,count)
|
||||
local status, data
|
||||
@@ -257,7 +257,7 @@ local JavaTypes = {
|
||||
---
|
||||
-- The JavaDOS classes
|
||||
-- The JavaDOS class is an approximation of a java DataOutputStream. It provides convenience functions
|
||||
-- for writing java types toan underlying BufferedWriter
|
||||
-- for writing java types to an underlying BufferedWriter
|
||||
--
|
||||
-- When used in conjunction with the BufferedX- classes, they handle the availability-
|
||||
-- checks transparently, i.e the caller does not have to check if enough data is available
|
||||
@@ -335,7 +335,7 @@ JavaDIS = {
|
||||
return o
|
||||
end,
|
||||
|
||||
-- This closure method generates all reader methods (except unstandard ones) on the fly
|
||||
-- This closure method generates all reader methods (except nonstandard ones) on the fly
|
||||
-- according to the definitions in JavaTypes.
|
||||
_generateReaderFunc = function(self, javatype)
|
||||
local functionName = 'read'..javatype.name
|
||||
@@ -349,7 +349,7 @@ JavaDIS = {
|
||||
end
|
||||
self[functionName] = newFunc
|
||||
end,
|
||||
-- This is a bit special, since we do not know beforehand how many bytes must be read. Therfore
|
||||
-- This is a bit special, since we do not know beforehand how many bytes must be read. Therefore
|
||||
-- this cannot be generated on the fly like the others.
|
||||
readUTF = function(self, text)
|
||||
-- First, we need to read the length, 2 bytes
|
||||
@@ -703,7 +703,7 @@ RmiDataStream = {
|
||||
|
||||
----
|
||||
-- Connects to a remote service. The connection process creates a
|
||||
-- socket and does some handshaking. If this is successfull,
|
||||
-- socket and does some handshaking. If this is successful,
|
||||
-- we are definitely talking to an RMI service.
|
||||
function RmiDataStream:connect(host, port)
|
||||
local status, err
|
||||
@@ -752,7 +752,7 @@ function RmiDataStream:connect(host, port)
|
||||
return true
|
||||
end
|
||||
|
||||
-- Reads a DgcAck message, which is sent during conection handshake
|
||||
-- Reads a DgcAck message, which is sent during connection handshake
|
||||
--@param dis - a JavaDIS to read from
|
||||
--@return status
|
||||
--@return error message
|
||||
@@ -1216,7 +1216,7 @@ function readNonProxyDesc(dis)
|
||||
if ( TypeDecoders[fieldType] ) then
|
||||
status, value= TypeDecoders[fieldType](dis)
|
||||
else
|
||||
dbg("ellol reading".. RMIUtils.tcString(fieldType))
|
||||
dbg("error reading".. RMIUtils.tcString(fieldType))
|
||||
return
|
||||
end
|
||||
dbg("Read fieldvalue ".. tostring(value) .. " for field ".. tostring(fields[i]))
|
||||
@@ -1460,7 +1460,7 @@ function Registry:lookup(name)
|
||||
end
|
||||
----
|
||||
-- Arguments class
|
||||
-- This class is meant to handle arguments which is sent to a mehtod invoked
|
||||
-- This class is meant to handle arguments which is sent to a method invoked
|
||||
-- remotely. It is mean to contain functionality to add java primitive datatypes,
|
||||
-- such as pushInt, pushString, pushLong etc. All of these are not implemented
|
||||
-- currently
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
-- The library contains the following classes:
|
||||
-- * <code>Comm </code>
|
||||
-- ** Handles network connections.
|
||||
-- ** Handles low-level packet sending, recieving, decoding and encoding.
|
||||
-- ** Handles low-level packet sending, receiving, decoding and encoding.
|
||||
-- ** Stores rpc programs info: socket, protocol, program name, id and version.
|
||||
-- ** Used by Mount, NFS, RPC and Portmap.
|
||||
-- * <code>Portmap</code>
|
||||
@@ -1668,7 +1668,7 @@ NFS = {
|
||||
pos, lookup.attributes = Util.unmarshall_nfsattr(data, pos, comm.version)
|
||||
|
||||
else
|
||||
stdnse.pritn_debug("NFS.LookUpDecode: NFS unsupported version %d", comm.version)
|
||||
stdnse.print_debug("NFS.LookUpDecode: NFS unsupported version %d", comm.version)
|
||||
return -1, nil
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
-- This library implements the fundamentals needed to communicate with the
|
||||
-- WinPcap Remote Capture Deamon. It currently supports authenticating to
|
||||
-- WinPcap Remote Capture Daemon. It currently supports authenticating to
|
||||
-- the service using either NULL-, or Password-based authentication.
|
||||
-- In addition it has the capabilities to list the interfaces that may be
|
||||
-- used for sniffing.
|
||||
@@ -10,7 +10,7 @@
|
||||
-- handled by the <code>Comm</code> class, and the main interface for script
|
||||
-- writers is kept under the <code>Helper</code> class.
|
||||
--
|
||||
-- The following code snipplet illustrates how to connect to the service and
|
||||
-- The following code snippet illustrates how to connect to the service and
|
||||
-- extract information about network interfaces:
|
||||
-- <code>
|
||||
-- local helper = rpcap.Helper:new(host, port)
|
||||
@@ -388,7 +388,7 @@ Helper = {
|
||||
-- @param username [optional]
|
||||
-- @param password [optional]
|
||||
-- @return status true on success, false on failure
|
||||
-- @return err string containing error mesage on failure
|
||||
-- @return err string containing error message on failure
|
||||
login = function(self, username, password)
|
||||
local auth
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Helper = {
|
||||
|
||||
-- Handles send and receive of control messages
|
||||
-- @param data string containing the command to send
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return data containing the response from the server
|
||||
-- err string, if status is false
|
||||
ctrl_exch = function(self, data)
|
||||
@@ -103,7 +103,7 @@ Helper = {
|
||||
end
|
||||
|
||||
if ( data == "@RSYNCD: OK" ) then
|
||||
return true, "Authentication successfull"
|
||||
return true, "Authentication successful"
|
||||
end
|
||||
return false, "Authentication failed"
|
||||
end,
|
||||
|
||||
@@ -105,7 +105,7 @@ Response = {
|
||||
local tmp = stdnse.strsplit("\r\n", data)
|
||||
if ( not(tmp) ) then return nil end
|
||||
|
||||
-- we should have atleas one entry
|
||||
-- we should have atleast one entry
|
||||
if ( #tmp > 1 ) then
|
||||
o.headers = {}
|
||||
for i=2, #tmp do
|
||||
@@ -207,15 +207,15 @@ Client = {
|
||||
repeat
|
||||
local err
|
||||
status, err = self.socket:send( tostring(req) )
|
||||
-- check if send was successfull, in case it wasn't AND
|
||||
-- check if send was successful, in case it wasn't AND
|
||||
-- this is our last retry, ABORT
|
||||
if ( not(status) and 0 == retries - 1 ) then
|
||||
stdnse.print_debug(2, "Failed to send request to server (%s)", err)
|
||||
return false, ("Failed to send request to server (%s)"):format(err)
|
||||
-- if send was successfull, attempt to receive the response
|
||||
-- if send was successful, attempt to receive the response
|
||||
elseif ( status ) then
|
||||
status, data = self.socket:receive()
|
||||
-- if we got the response allright, break out of retry loop
|
||||
-- if we got the response all right, break out of retry loop
|
||||
if ( status ) then break end
|
||||
end
|
||||
-- if either send or receive fails, re-connect the socket
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
-- The <code>DigestMD5</code> class contains all code necessary to calculate
|
||||
-- a DIGEST-MD5 response based on the servers challenge and the other
|
||||
-- necessary arguments (@see DigestMD5.new).
|
||||
-- It can be called throught the SASL helper or directly like this:
|
||||
-- It can be called through the SASL helper or directly like this:
|
||||
-- <code>
|
||||
-- local dmd5 = DigestMD5:new(chall, user, pass, "AUTHENTICATE", nil, "imap")
|
||||
-- local digest = dmd5:calcDigest()
|
||||
@@ -21,7 +21,7 @@
|
||||
-- local response = ntlm:calcResponse()
|
||||
-- </code>
|
||||
--
|
||||
-- The Helper class contains the high level methodes:
|
||||
-- The Helper class contains the high level methods:
|
||||
-- * <code>new</code>: This is the SASL object constructor.
|
||||
-- * <code>set_mechanism</code>: Sets the authentication mechanism to use.
|
||||
-- * <code>set_callback</code>: Sets the encoding function to use.
|
||||
@@ -37,7 +37,7 @@
|
||||
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
|
||||
|
||||
-- Version 0.2
|
||||
-- Created 07/17/2011 - v0.1 - Created by Djalal Harouini
|
||||
-- Created 07/17/2011 - v0.1 - Created by Djalal Harouni
|
||||
-- Revised 07/18/2011 - v0.2 - Added NTLM, DIGEST-MD5 classes
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ if HAVE_SSL then
|
||||
end,
|
||||
|
||||
-- parses a challenge received from the server
|
||||
-- takes care of both quoted and unqoted identifiers
|
||||
-- takes care of both quoted and unquoted identifiers
|
||||
-- regardless of what RFC says
|
||||
parseChallenge = function(self)
|
||||
local results = {}
|
||||
@@ -190,7 +190,7 @@ if HAVE_SSL then
|
||||
return o
|
||||
end,
|
||||
|
||||
--- Converst str to "unicode" (adds null bytes for every other byte)
|
||||
--- Converts str to "unicode" (adds null bytes for every other byte)
|
||||
-- @param str containing string to convert
|
||||
-- @return unicode string containing the unicoded str
|
||||
to_unicode = function(str)
|
||||
@@ -442,7 +442,7 @@ Helper = {
|
||||
|
||||
--- Resets all the data of the SASL object.
|
||||
--
|
||||
-- This methode will clear the specified SASL mechanism.
|
||||
-- This method will clear the specified SASL mechanism.
|
||||
reset = function(self)
|
||||
self:set_mechanism()
|
||||
end,
|
||||
|
||||
@@ -12,7 +12,7 @@ _ENV = stdnse.module("shortport", stdnse.seeall)
|
||||
|
||||
---
|
||||
-- See if a table contains a value.
|
||||
-- @param t A table repesenting a set.
|
||||
-- @param t A table representing a set.
|
||||
-- @param value The value to check for.
|
||||
-- @return True if <code>t</code> contains <code>value</code>, false otherwise.
|
||||
local function includes(t, value)
|
||||
|
||||
@@ -175,7 +175,7 @@ Session = {
|
||||
end
|
||||
local status, lhost, lport, rhost, rport = self.conn.socket:get_info()
|
||||
if ( not(status) ) then
|
||||
return false, "Failed to retreive socket information"
|
||||
return false, "Failed to retrieve socket information"
|
||||
end
|
||||
self.sessdata:setClient(lhost, lport)
|
||||
self.sessdata:setServer(rhost, rport)
|
||||
@@ -741,7 +741,7 @@ SipAuth = {
|
||||
end,
|
||||
|
||||
--- Calculates the authentication response
|
||||
-- @return reponse string containing the authentication response
|
||||
-- @return response string containing the authentication response
|
||||
calculateResponse = function(self)
|
||||
|
||||
if ( not(self.nonce) or not(self.algorithm) or not(self.realm) ) then
|
||||
|
||||
@@ -874,8 +874,8 @@ function smb_read(smb, read_data)
|
||||
|
||||
local result = netbios_data .. smb_data
|
||||
if(#result ~= length) then
|
||||
stdnse.print_debug(1, "SMB: ERROR: Received wrong number of bytes, there will likely be issues (recieved %d, expected %d)", #result, length)
|
||||
return false, string.format("SMB: ERROR: Didn't receive the expected number of bytes; recieved %d, expected %d. This will almost certainly cause some errors.", #result, length)
|
||||
stdnse.print_debug(1, "SMB: ERROR: Received wrong number of bytes, there will likely be issues (received %d, expected %d)", #result, length)
|
||||
return false, string.format("SMB: ERROR: Didn't receive the expected number of bytes; received %d, expected %d. This will almost certainly cause some errors.", #result, length)
|
||||
end
|
||||
|
||||
-- Check the message signature (ignoring the first four bytes, which are the netbios header)
|
||||
@@ -956,7 +956,7 @@ end
|
||||
function negotiate_protocol(smb, overrides)
|
||||
local header, parameters, data
|
||||
local pos
|
||||
local header1, header2, header3, ehader4, command, status, flags, flags2, pid_high, signature, unused, pid, mid
|
||||
local header1, header2, header3, header4, command, status, flags, flags2, pid_high, signature, unused, pid, mid
|
||||
|
||||
header = smb_encode_header(smb, command_codes['SMB_COM_NEGOTIATE'], overrides)
|
||||
|
||||
@@ -991,7 +991,7 @@ function negotiate_protocol(smb, overrides)
|
||||
end
|
||||
|
||||
-- Parse out the header
|
||||
local uid, tid, header4
|
||||
local uid, tid
|
||||
pos, header1, header2, header3, header4, command, status, flags, flags2, pid_high, signature, unused, tid, pid, uid, mid = bin.unpack("<CCCCCICSSlSSSSS", header)
|
||||
|
||||
-- Get the protocol version
|
||||
@@ -1522,7 +1522,7 @@ end
|
||||
-- * 'uid' The UserID for the session
|
||||
-- * 'is_guest' If set, the username wasn't found so the user was automatically logged in as the guest account
|
||||
-- * 'os' The operating system
|
||||
-- * 'lanmanager' The servers's LAN Manager
|
||||
-- * 'lanmanager' The server's LAN Manager
|
||||
function start_session(smb, overrides, log_errors)
|
||||
-- Use a mutex to avoid some issues (see http://seclists.org/nmap-dev/2011/q1/464)
|
||||
local smb_auth_mutex = nmap.mutex( "SMB Authentication Mutex" )
|
||||
@@ -2482,7 +2482,7 @@ function file_write(host, data, share, remotefile, use_anonymous)
|
||||
overrides = get_overrides_anonymous()
|
||||
end
|
||||
|
||||
-- Create the SMB sessioan
|
||||
-- Create the SMB session
|
||||
status, smbstate = start_ex(host, true, true, share, remotefile, nil, overrides)
|
||||
|
||||
if(status == false) then
|
||||
@@ -2536,7 +2536,7 @@ function file_read(host, share, remotefile, use_anonymous, overrides)
|
||||
overrides = get_overrides_anonymous(overrides)
|
||||
end
|
||||
|
||||
-- Create the SMB sessioan
|
||||
-- Create the SMB session
|
||||
status, smbstate = start_ex(host, true, true, share, remotefile, nil, overrides)
|
||||
|
||||
if(status == false) then
|
||||
@@ -2588,7 +2588,7 @@ function files_exist(host, share, files, overrides)
|
||||
-- We don't wan to be creating the files
|
||||
overrides['file_create_disposition'] = 1
|
||||
|
||||
-- Create the SMB sessioan
|
||||
-- Create the SMB session
|
||||
status, smbstate = start_ex(host, true, true, share, nil, nil, overrides)
|
||||
|
||||
if(status == false) then
|
||||
@@ -2675,7 +2675,7 @@ end
|
||||
-- <code>volid</code> - include volume ids in result
|
||||
-- <code>dir</code> - find directories
|
||||
-- <code>archive</code> - find archived files
|
||||
-- @return iterator function retreiving the next result
|
||||
-- @return iterator function retrieving the next result
|
||||
function find_files(smbstate, fname, options)
|
||||
local TRANS2_FIND_FIRST2, TRANS2_FIND_NEXT2 = 1, 2
|
||||
options = options or {}
|
||||
@@ -3094,7 +3094,7 @@ function share_get_details(host, share)
|
||||
-- Try and get full details about the share
|
||||
status, result = msrpc.get_share_info(host, share)
|
||||
if(status == false) then
|
||||
-- We don't stop for this error (it's pretty common since administive privileges are required here)
|
||||
-- We don't stop for this error (it's pretty common since administrative privileges are required here)
|
||||
stdnse.print_debug(1, "SMB: Failed to get share info for %s: %s", share, result)
|
||||
details['details'] = result
|
||||
else
|
||||
@@ -3423,7 +3423,7 @@ function is_admin(host, username, domain, password, password_hash, hash_type)
|
||||
|
||||
status, err = negotiate_protocol(smbstate, overrides)
|
||||
if(status == false) then
|
||||
stdnse.print_debug("SMB; is_admin: Failed to negotiatie protocol: %s [%s]", err, username)
|
||||
stdnse.print_debug("SMB; is_admin: Failed to negotiate protocol: %s [%s]", err, username)
|
||||
stop(smbstate)
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
--
|
||||
--@args smbusername The SMB username to log in with. The forms "DOMAIN\username" and "username@DOMAIN"
|
||||
-- are not understood. To set a domain, use the <code>smbdomain</code> argument.
|
||||
--@args smbdomain The domain to log in with. If you aren't in a domained environment, then anything
|
||||
--@args smbdomain The domain to log in with. If you aren't in a domain environment, then anything
|
||||
-- will (should?) be accepted by the server.
|
||||
--@args smbpassword The password to connect with. Be cautious with this, since some servers will lock
|
||||
-- accounts if the incorrect password is given. Although it's rare that the
|
||||
@@ -770,7 +770,7 @@ function get_host_info_from_security_blob(security_blob)
|
||||
if ( target_info_length > 0 ) then
|
||||
|
||||
-- Definition of AvId values (IDs for AV_PAIR (attribute-value pair) structures),
|
||||
-- as definied by the NTLM Authentication Protocol specification [MS-NLMP].
|
||||
-- as defined by the NTLM Authentication Protocol specification [MS-NLMP].
|
||||
local NTLM_AV_ID_VALUES = {
|
||||
MsvAvEOL = 0x0,
|
||||
MsvAvNbComputerName = 0x1,
|
||||
@@ -824,7 +824,7 @@ end
|
||||
|
||||
---Create an 8-byte message signature that's sent with all SMB packets.
|
||||
--
|
||||
--@param mac_key The key used for authentication. It's the concatination of the session key and the
|
||||
--@param mac_key The key used for authentication. It's the concatenation of the session key and the
|
||||
-- response hash.
|
||||
--@param data The packet to generate the signature for. This should be the packet that's about to be
|
||||
-- sent, except with the signature slot replaced with the sequence number.
|
||||
|
||||
@@ -362,7 +362,7 @@ end
|
||||
--
|
||||
-- @param socket connected to server
|
||||
-- @param domain to use in the EHLO command.
|
||||
-- @return true on sucess, or false on failures.
|
||||
-- @return true on success, or false on failures.
|
||||
-- @return response returned by the SMTP server on success, or an
|
||||
-- error message on failures.
|
||||
ehlo = function(socket, domain)
|
||||
@@ -640,7 +640,7 @@ login = function(socket, username, password, mech)
|
||||
-- sniffed of the wire, seems to always be the same
|
||||
-- decodes to some NTLMSSP blob greatness
|
||||
status, response = query(socket, "TlRMTVNTUAABAAAAB7IIogYABgA3AAAADwAPACgAAAAFASgKAAAAD0FCVVNFLUFJUi5MT0NBTERPTUFJTg==")
|
||||
if ( not(status) ) then return false, "ERROR: Failed to receieve NTLM challenge" end
|
||||
if ( not(status) ) then return false, "ERROR: Failed to receive NTLM challenge" end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ local tagDecoder = {}
|
||||
-- IP Address
|
||||
|
||||
-- Response-PDU
|
||||
-- TOOD: Figure out how to remove these dependancies
|
||||
-- TOOD: Figure out how to remove these dependencies
|
||||
tagDecoder["A2"] = function( self, encStr, elen, pos )
|
||||
local seq = {}
|
||||
|
||||
@@ -483,7 +483,7 @@ function snmpWalk( socket, base_oid )
|
||||
|
||||
status, response = socket:receive_bytes(1)
|
||||
if ( not( status ) ) then
|
||||
-- Unless we don't have a usefull error message, don't report it
|
||||
-- Unless we have a useful error message, don't report it
|
||||
if ( response ~= "ERROR" ) then
|
||||
stdnse.print_debug("snmp.snmpWalk: Received no answer (%s)", response)
|
||||
return false, response
|
||||
|
||||
@@ -171,7 +171,7 @@ Helper = {
|
||||
-- Create a new instance of the class
|
||||
-- @param host table containing the host table
|
||||
-- @param port table containing the port table
|
||||
-- @param options table containing library options, currenlty:
|
||||
-- @param options table containing library options, currently:
|
||||
-- <code>timeout</code> - socket timeout in ms
|
||||
-- @return o instance of Helper
|
||||
new = function(self, host, port, options)
|
||||
@@ -197,7 +197,7 @@ Helper = {
|
||||
-- Connects to the SOCKS server
|
||||
-- @param auth_method table containing the auth. methods to request
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response table containing the respons or err string on failure
|
||||
-- @return response table containing the response or err string on failure
|
||||
connect = function(self, auth_method)
|
||||
self.socket = nmap.new_socket()
|
||||
self.socket:set_timeout(self.options.timeout or 10000)
|
||||
@@ -267,7 +267,7 @@ Helper = {
|
||||
end
|
||||
|
||||
if ( auth:isSuccess() ) then
|
||||
return true, "Authentication was successfull"
|
||||
return true, "Authentication was successful"
|
||||
else
|
||||
return false, "Authentication failed"
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ Reply = {
|
||||
end,
|
||||
|
||||
--- Attempts to create an instance by reading data off the socket
|
||||
-- @param socket socket conected to the SRVLOC service
|
||||
-- @param socket socket connected to the SRVLOC service
|
||||
-- @return new instance of the Reply.Service class
|
||||
fromSocket = function(socket)
|
||||
local status, data = socket:receive()
|
||||
@@ -143,7 +143,7 @@ Reply = {
|
||||
end,
|
||||
|
||||
--- Attempts to create an instance by reading data off the socket
|
||||
-- @param socket socket conected to the SRVLOC service
|
||||
-- @param socket socket connected to the SRVLOC service
|
||||
-- @return new instance of the Reply.Attribute class
|
||||
fromSocket = function(socket)
|
||||
local status, data = socket:receive()
|
||||
@@ -295,7 +295,7 @@ Request = {
|
||||
}
|
||||
|
||||
|
||||
-- The Helper class serves as primary interface for scripts using the libraryy
|
||||
-- The Helper class serves as primary interface for scripts using the library
|
||||
Helper = {
|
||||
|
||||
new = function(self, host, port)
|
||||
|
||||
@@ -272,7 +272,7 @@ end
|
||||
-- stdnse.tohex(123456, {separator = ":"}) --> "1:e2:40"
|
||||
-- stdnse.tohex(123456, {separator = ":", group = 4}) --> "1:e240"
|
||||
-- @param s String or number to be encoded.
|
||||
-- @param options Table specifiying formatting options.
|
||||
-- @param options Table specifying formatting options.
|
||||
-- @return String in hexadecimal format.
|
||||
function tohex( s, options )
|
||||
options = options or EMPTY
|
||||
@@ -702,7 +702,7 @@ end
|
||||
-- occurs.
|
||||
--@param data The table of output.
|
||||
--@param indent Used for indentation on recursive calls; should generally be set to
|
||||
-- nil when callling from a script.
|
||||
-- nil when calling from a script.
|
||||
-- @return <code>nil</code>, if <code>data</code> is empty, otherwise a
|
||||
-- multiline string.
|
||||
function format_output(status, data, indent)
|
||||
|
||||
@@ -283,7 +283,7 @@ Comm = {
|
||||
Util = {
|
||||
|
||||
-- creates a random string
|
||||
-- @param len number containg the length of the generated random string
|
||||
-- @param len number containing the length of the generated random string
|
||||
-- @return str containing the random string
|
||||
randomString = function(len)
|
||||
local str = ""
|
||||
@@ -325,7 +325,7 @@ Helper = {
|
||||
|
||||
-- Get's the external public IP
|
||||
-- @return status true on success, false on failure
|
||||
-- @return result containing the IP as tring
|
||||
-- @return result containing the IP as string
|
||||
getExternalAddress = function(self)
|
||||
local trans_id
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
-- * <code>Packet</code>
|
||||
-- ** The <code>Packet</code> classes contain one class for each TFTP operation.
|
||||
-- * <code>File</code>
|
||||
-- ** The <code>File</code> class holds a recieved file including the name and contents
|
||||
-- ** The <code>File</code> class holds a received file including the name and contents
|
||||
-- * <code>ConnHandler</code>
|
||||
-- ** The <code>ConnHandler</code> class handles and processes incoming connections.
|
||||
--
|
||||
-- The following code snipplet starts the TFTP server and waits for the file incoming.txt
|
||||
-- The following code snippet starts the TFTP server and waits for the file incoming.txt
|
||||
-- to be uploaded for 10 seconds:
|
||||
-- <code>
|
||||
-- tftp.start()
|
||||
@@ -192,14 +192,14 @@ local function processConnection( host, port, data )
|
||||
while( true ) do
|
||||
local status, pdata = socket:receive()
|
||||
if ( not(status) ) then
|
||||
-- if we're here and havent succesfully read a packet for 5 seconds, abort
|
||||
-- if we're here and haven't successfully read a packet for 5 seconds, abort
|
||||
if ( os.time() - lastread > 5 ) then
|
||||
coroutine.yield(false)
|
||||
else
|
||||
coroutine.yield(true)
|
||||
end
|
||||
else
|
||||
-- record last time we had a succesful read
|
||||
-- record last time we had a successful read
|
||||
lastread = os.time()
|
||||
pos, op = bin.unpack(">S", pdata)
|
||||
if ( OpCode.DATA ~= op ) then
|
||||
@@ -217,7 +217,7 @@ local function processConnection( host, port, data )
|
||||
break
|
||||
end
|
||||
|
||||
-- for every fith block check that we've received the preceeding four
|
||||
-- for every fifth block check that we've received the preceding four
|
||||
if ( ( #blocks % 5 ) == 0 ) then
|
||||
for b = #blocks - 4, #blocks do
|
||||
if ( not(blocks[b]) ) then
|
||||
@@ -251,7 +251,7 @@ local function processConnection( host, port, data )
|
||||
end
|
||||
filecontent = filecontent .. blocks[i]
|
||||
end
|
||||
stdnse.print_debug("Finnished receiving file \"%s\"", filename)
|
||||
stdnse.print_debug("Finished receiving file \"%s\"", filename)
|
||||
|
||||
-- Add anew file to the global infiles table
|
||||
table.insert( infiles, File:new(filename, filecontent, host) )
|
||||
@@ -305,7 +305,7 @@ end
|
||||
local function waitLast()
|
||||
-- The thread that started the server needs to wait here until the rest
|
||||
-- of the scripts finnish running. We know we are done once the state
|
||||
-- shifts to STOPPED and we get a singla from the condvar in the
|
||||
-- shifts to STOPPED and we get a signal from the condvar in the
|
||||
-- dispatcher
|
||||
local s_condvar = nmap.condvar(state)
|
||||
while( srvthread == coroutine.running() and state ~= "STOPPED" ) do
|
||||
@@ -316,7 +316,7 @@ end
|
||||
--- Waits for a file with a specific filename for at least the number of
|
||||
-- seconds specified by the timeout parameter. If this function is called
|
||||
-- from the thread that's running the server it will wait until all the
|
||||
-- other threads have finnished executing before returning.
|
||||
-- other threads have finished executing before returning.
|
||||
--
|
||||
-- @param filename string containing the name of the file to receive
|
||||
-- @param timeout number containing the minimum number of seconds to wait
|
||||
|
||||
@@ -488,7 +488,7 @@ Packet.PreAuth = {
|
||||
--- Parses the PreAuth packet response and extracts data needed to
|
||||
-- perform authentication
|
||||
--
|
||||
-- @param tns Packet.TNS containing the TNS packet recieved from the server
|
||||
-- @param tns Packet.TNS containing the TNS packet received from the server
|
||||
-- @return table containing the keys and values returned by the server
|
||||
parseResponse = function( self, tns )
|
||||
local kvps = {}
|
||||
@@ -576,7 +576,7 @@ Packet.Auth = {
|
||||
|
||||
-- Parses the response of an Auth packet
|
||||
--
|
||||
-- @param tns Packet.TNS containing the TNS packet recieved from the server
|
||||
-- @param tns Packet.TNS containing the TNS packet received from the server
|
||||
-- @return table containing the key pair values from the Auth packet
|
||||
parseResponse = function( self, tns )
|
||||
local kvps = {}
|
||||
@@ -1084,7 +1084,7 @@ Packet.QueryResponseAck = {
|
||||
|
||||
-- The mask is used in order to achieve "compression" and is essentially
|
||||
-- at a bit mask that decides what columns should be fetched from the
|
||||
-- preceeding row. The mask is provided in reverse order and a set bit
|
||||
-- preceding row. The mask is provided in reverse order and a set bit
|
||||
-- indicates that data is provided while an unset bit indicates that the
|
||||
-- column data should be fetched from the previous row.
|
||||
--
|
||||
@@ -1319,10 +1319,10 @@ Comm = {
|
||||
return self.socket:send( tostring(tns) )
|
||||
end,
|
||||
|
||||
--- Handles communication when a MARKER packet is recieved and retrieves
|
||||
--- Handles communication when a MARKER packet is received and retrieves
|
||||
-- the following error message
|
||||
--
|
||||
-- @return false always to indicate that an error occured
|
||||
-- @return false always to indicate that an error occurred
|
||||
-- @return msg containing the error message
|
||||
handleMarker = function( self )
|
||||
local status, tns = self:recvTNSPacket()
|
||||
@@ -1354,10 +1354,10 @@ Comm = {
|
||||
return false, msg
|
||||
end,
|
||||
|
||||
--- Recieves a TNS packet and handles TNS-resends
|
||||
--- Receives a TNS packet and handles TNS-resends
|
||||
--
|
||||
-- @return status true on success, false on failure
|
||||
-- @return tns Packet.TNS containing the recieved packet or err on failure
|
||||
-- @return tns Packet.TNS containing the received packet or err on failure
|
||||
recvTNSPacket = function( self )
|
||||
local tns
|
||||
local retries = 5
|
||||
@@ -1391,9 +1391,9 @@ Comm = {
|
||||
return true, tns
|
||||
end,
|
||||
|
||||
--- Sends a TNS packet and recieves (and handles) the response
|
||||
--- Sends a TNS packet and receives (and handles) the response
|
||||
--
|
||||
-- @param pkt containingt the Packet.* to send to the server
|
||||
-- @param pkt containing the Packet.* to send to the server
|
||||
-- @return status true on success, false on failure
|
||||
-- @return the parsed response as return from the respective parseResponse
|
||||
-- function or error message if status was false
|
||||
@@ -1495,7 +1495,7 @@ Crypt = {
|
||||
-- @param user containing the Oracle user name
|
||||
-- @param pass containing the Oracle user password
|
||||
-- @param srv_sesskey_enc containing the encrypted server session key as
|
||||
-- recieved from the PreAuth packet
|
||||
-- received from the PreAuth packet
|
||||
-- @return cli_sesskey_enc the encrypted client session key
|
||||
-- @return auth_pass the encrypted Oracle password
|
||||
Encrypt10g = function( self, user, pass, srv_sesskey_enc )
|
||||
@@ -1525,8 +1525,8 @@ Crypt = {
|
||||
--
|
||||
-- @param pass containing the Oracle user password
|
||||
-- @param srv_sesskey_enc containing the encrypted server session key as
|
||||
-- recieved from the PreAuth packet
|
||||
-- @param auth_vrfy_data containing the password salt as recieved from the
|
||||
-- received from the PreAuth packet
|
||||
-- @param auth_vrfy_data containing the password salt as received from the
|
||||
-- PreAuth packet
|
||||
-- @return cli_sesskey_enc the encrypted client session key
|
||||
-- @return auth_pass the encrypted Oracle password
|
||||
@@ -1672,10 +1672,10 @@ Helper = {
|
||||
end,
|
||||
|
||||
--- Sends a command to the TNS lsnr
|
||||
-- It currently accepts and tries to send all commands recieved
|
||||
-- It currently accepts and tries to send all commands received
|
||||
--
|
||||
-- @param cmd string containing the command to send to the server
|
||||
-- @return data string containing the result recieved from the server
|
||||
-- @return data string containing the result received from the server
|
||||
lsnrCtl = function( self, cmd )
|
||||
local status, data = self.socket:connect( self.host.ip, self.port.number, "tcp" )
|
||||
local conn, packet, tns, pkt
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
-- * <code>Util</code>
|
||||
-- ** The <code>Util</code> class contains a number of static functions mainly used to convert and sort data.
|
||||
--
|
||||
-- The following code snipplet queries all UPnP services on the network:
|
||||
-- The following code snippet queries all UPnP services on the network:
|
||||
-- <code>
|
||||
-- local helper = upnp.Helper:new()
|
||||
-- helper:setMulticast(true)
|
||||
-- return stdnse.format_output(helper:queryServices())
|
||||
-- </code>
|
||||
--
|
||||
-- This next snipplet queries a specific host for the same information:
|
||||
-- This next snippet queries a specific host for the same information:
|
||||
-- <code>
|
||||
-- local helper = upnp.Helper:new(host, port)
|
||||
-- return stdnse.format_output(helper:queryServices())
|
||||
|
||||
@@ -197,7 +197,7 @@ end
|
||||
---
|
||||
-- Rebuilds a parsed URL from its components.
|
||||
--
|
||||
-- Components are protected if any reserved or unallowed characters are found.
|
||||
-- Components are protected if any reserved or disallowed characters are found.
|
||||
-- @param parsed Parsed URL, as returned by parse.
|
||||
-- @return A string with the corresponding URL.
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
-- The VNC library provides some basic functionality needed in order to
|
||||
-- communicate with VNC servers, and derivates such as Tight- or Ultra-
|
||||
-- communicate with VNC servers, and derivatives such as Tight- or Ultra-
|
||||
-- VNC.
|
||||
--
|
||||
-- Summary
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
-- Each vulnerability must have its own state:
|
||||
-- <code>NOT_VULN</code>: The program was confirmed to be not vulnerable.
|
||||
-- <code>LIKELY_VULN</code>: The program is likely to be vulnerable,
|
||||
-- this can be the case when we do a simple version comparaison. This
|
||||
-- this can be the case when we do a simple version comparison. This
|
||||
-- state should cover possible false positive situations.
|
||||
-- <code>VULN</code>: The program was confirmed to be vulnerable.
|
||||
-- <code>EXPLOIT</code>: The program was confirmed to be vulnerable and
|
||||
@@ -157,7 +157,7 @@
|
||||
-- </code>
|
||||
--
|
||||
-- @args vulns.showall If set, the library will show and report all the
|
||||
-- registred vulnerabilities which includes the
|
||||
-- registered vulnerabilities which includes the
|
||||
-- <code>NOT VULNERABLE</code> ones. By default the library will only
|
||||
-- report the <code>VULNERABLE</code> entries: <code>VULNERABLE</code>,
|
||||
-- <code>LIKELY VULNERABLE</code>, <code>VULNERABLE (DoS)</code>
|
||||
@@ -336,7 +336,7 @@ local VULNS
|
||||
-- },
|
||||
-- },
|
||||
--
|
||||
-- -- Entries whithout the vulnerability ID are stored here.
|
||||
-- -- Entries without the vulnerability ID are stored here.
|
||||
-- 'NMAP_ID' = {
|
||||
-- 'XXXXX' = {
|
||||
-- ...
|
||||
@@ -600,7 +600,7 @@ local default_filter = function(vuln_table) return true end
|
||||
-- This function just inserts the callback filters in the filters_db.
|
||||
--
|
||||
-- @param filters_db The filters database (a table in the registry).
|
||||
-- @param filter_callback The callbackk function.
|
||||
-- @param filter_callback The callback function.
|
||||
-- @return FID The filter ID associated with the callback function.
|
||||
local register_filter = function(filters_db, filter_callback)
|
||||
if filter_callback and type(filter_callback) == "function" then
|
||||
@@ -683,7 +683,7 @@ local l_update_id = function(fid_table, id_type, id, vuln_table)
|
||||
-- Add the ID vulnerability type if it is missing
|
||||
l_add_id_type(fid_table, id_type)
|
||||
|
||||
-- Make sure that we are referecing the correct tables
|
||||
-- Make sure that we are referencing the correct tables
|
||||
fid_table[id_type][id] = fid_table[id_type][id] or {}
|
||||
fid_table[id_type][id]['ENTRIES'] = fid_table[id_type][id]['ENTRIES'] or {}
|
||||
local push_table = fid_table[id_type][id]['ENTRIES']
|
||||
@@ -1015,7 +1015,7 @@ local l_add = function(vulndb, vuln_table)
|
||||
-- Search the Filters IDS for the vulnerability
|
||||
for _, fid in ipairs(FIDS) do
|
||||
for id_type, id in pairs(vuln_table.IDS) do
|
||||
-- Count how many IDs should be refenrecing the vulnerability
|
||||
-- Count how many IDs should be referencing the vulnerability
|
||||
-- entry in all the FILTERS_IDS tables.
|
||||
ids_count = ids_count + 1
|
||||
|
||||
@@ -1564,7 +1564,7 @@ end
|
||||
-- This function can be used to see if there are any references to the
|
||||
-- specified vulnerability in the database, it will return
|
||||
-- <code>True</code> if so which means that one of the scripts has
|
||||
-- attempted to check this vulnerabilty.
|
||||
-- attempted to check this vulnerability.
|
||||
--
|
||||
-- Scripts must call <code>vulns.save_reports()</code> function first to
|
||||
-- setup the vulnerability database.
|
||||
@@ -1712,7 +1712,7 @@ end
|
||||
--
|
||||
-- The <code>selection_filter</code> is an optional table parameter of
|
||||
-- optional fields which can be used to select which vulnerabilities to
|
||||
-- report, if it is not set then all vulnerabilites entries will be
|
||||
-- report, if it is not set then all vulnerabilities entries will be
|
||||
-- returned.
|
||||
--
|
||||
-- @usage
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
--
|
||||
-- o Response - the response class containing all of the response classes. It
|
||||
-- currently contains the Header, PING, FIND_NODE and ERROR
|
||||
-- classs.
|
||||
-- class.
|
||||
--
|
||||
-- o Session - a class containing "session state" such as the transaction- and
|
||||
-- instance ID's.
|
||||
@@ -175,7 +175,7 @@ Response = {
|
||||
end
|
||||
},
|
||||
|
||||
-- The reponse header, present in all packets
|
||||
-- The response header, present in all packets
|
||||
Header = {
|
||||
|
||||
Vendors = {
|
||||
@@ -503,7 +503,7 @@ Helper = {
|
||||
end,
|
||||
|
||||
-- Sends a Vuze PING request to the server and parses the response
|
||||
-- @return status true on succes, false on failure
|
||||
-- @return status true on success, false on failure
|
||||
-- @return response PING response instance on success,
|
||||
-- err string containing the error message on failure
|
||||
ping = function(self)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
-- * <code>Decoders</code>
|
||||
-- ** The Decoders class contains static functions used for decoding probe matches
|
||||
--
|
||||
-- The following code snipplet shows how the library can be used:
|
||||
-- The following code snippet shows how the library can be used:
|
||||
-- <code>
|
||||
-- local helper = wsdd.Helper:new()
|
||||
-- helper:setMulticast(true)
|
||||
|
||||
@@ -286,7 +286,7 @@ Helper = {
|
||||
-- @param host table as received by the action method
|
||||
-- @param port table as received by the action method
|
||||
-- @param options table
|
||||
-- @retun o new instance of Helper
|
||||
-- @return o new instance of Helper
|
||||
new = function(self, host, port, options)
|
||||
local o = {
|
||||
host = host,
|
||||
|
||||
@@ -108,8 +108,8 @@ XMPP = {
|
||||
|
||||
--- Creates a new instance of the XMPP class
|
||||
--
|
||||
-- @param host table as receieved by the action function
|
||||
-- @param port table as receieved by the action function
|
||||
-- @param host table as received by the action function
|
||||
-- @param port table as received by the action function
|
||||
-- @param options table containing options, currently supported
|
||||
-- <code>timeout</code> - sets the socket timeout
|
||||
-- <code>servername</code> - sets the server name to use in
|
||||
@@ -215,7 +215,7 @@ XMPP = {
|
||||
status, err = self:send("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>")
|
||||
if ( not(status) ) then return false, "ERROR: Failed to initiate STARTTLS" end
|
||||
local status, tag = self:receive_tag()
|
||||
if ( not(status) ) then return false, "ERROR: Failed to recevice from server" end
|
||||
if ( not(status) ) then return false, "ERROR: Failed to receive from server" end
|
||||
if ( tag.name == "proceed" ) then
|
||||
status, err = self.socket:reconnect_ssl()
|
||||
self.options.starttls = false
|
||||
@@ -364,8 +364,8 @@ XMPP = {
|
||||
Helper = {
|
||||
|
||||
--- Creates a new Helper instance
|
||||
-- @param host table as receieved by the action function
|
||||
-- @param port table as receieved by the action function
|
||||
-- @param host table as received by the action function
|
||||
-- @param port table as received by the action function
|
||||
-- @param options table containing options, currently supported
|
||||
-- <code>timeout</code> - sets the socket timeout
|
||||
-- <code>servername</code> - sets the server name to use in
|
||||
|
||||
@@ -6,7 +6,7 @@ local string = require "string"
|
||||
local table = require "table"
|
||||
local unpwdb = require "unpwdb"
|
||||
|
||||
-- we dont really need openssl here, but let's attempt to load it as a way
|
||||
-- we don't really need openssl here, but let's attempt to load it as a way
|
||||
-- to simply prevent the script from running, in case we don't have it
|
||||
local openssl = stdnse.silent_require("openssl")
|
||||
|
||||
@@ -44,7 +44,7 @@ categories = {"intrusive", "brute"}
|
||||
-- Version 0.3
|
||||
-- Created 01/15/2010 - v0.1 - created by Patrik Karlsson <patrik@cqure.net>
|
||||
-- Revised 03/09/2010 - v0.2 - changed so that passwords are iterated over users
|
||||
-- - this change makes better sence as guessing is slow
|
||||
-- - this change makes better sense as guessing is slow
|
||||
-- Revised 09/09/2011 - v0.3 - changed account status text to be more consistent with other *-brute scripts
|
||||
|
||||
portrule = shortport.port_or_service(548, "afp")
|
||||
|
||||
@@ -133,11 +133,11 @@ action = function(host, port)
|
||||
if ( status ) then
|
||||
local status, fsize = afpHelper:GetFileSize( vol, item.name)
|
||||
if ( not(status) ) then
|
||||
return ("\n\nERROR: Failed to retreive file size for %/%s"):format(vol, item.name)
|
||||
return ("\n\nERROR: Failed to retrieve file size for %/%s"):format(vol, item.name)
|
||||
end
|
||||
local status, date = afpHelper:GetFileDates( vol, item.name)
|
||||
if ( not(status) ) then
|
||||
return ("\n\nERROR: Failed to retreive file dates for %/%s"):format(vol, item.name)
|
||||
return ("\n\nERROR: Failed to retrieve file dates for %/%s"):format(vol, item.name)
|
||||
end
|
||||
|
||||
tab.addrow(file_tab, result.privs, result.uid, result.gid, fsize, date.create, item.name)
|
||||
@@ -156,7 +156,7 @@ action = function(host, port)
|
||||
status, response = afpHelper:Logout()
|
||||
status, response = afpHelper:CloseSession()
|
||||
|
||||
-- stop after first succesfull attempt
|
||||
-- stop after first successful attempt
|
||||
if ( output and #output > 0 ) then
|
||||
table.insert(output, "")
|
||||
table.insert(output, ("Information retrieved as: %s"):format(username))
|
||||
|
||||
@@ -29,7 +29,7 @@ Shows AFP shares and ACLs.
|
||||
-- Version 0.4
|
||||
-- Created 01/03/2010 - v0.1 - created by Patrik Karlsson
|
||||
-- Revised 01/13/2010 - v0.2 - Fixed a bug where a single share wouldn't show due to formatting issues
|
||||
-- Revised 01/20/2010 - v0.3 - removed superflous functions
|
||||
-- Revised 01/20/2010 - v0.3 - removed superfluous functions
|
||||
-- Revised 05/03/2010 - v0.4 - cleaned up and added dependency to afp-brute and added support for credentials
|
||||
-- by argument or registry
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ end
|
||||
|
||||
---
|
||||
-- Cached results are checked before sending a query for the target and extracting the
|
||||
-- relevent information from the response. Mutual exclusion is used so that results can be
|
||||
-- relevant information from the response. Mutual exclusion is used so that results can be
|
||||
-- cached and so a single thread will be active at any time.
|
||||
-- @param host Host table.
|
||||
-- @return Formatted answers or <code>nil</code> on errors.
|
||||
|
||||
@@ -117,7 +117,7 @@ local backorifice =
|
||||
-- both are encrypted with the same initial seed, this is
|
||||
-- how we verify we are talking to a BackOrifice service.
|
||||
-- The statement is optimized so as not to decrypt unless
|
||||
-- comparison of encrypted magicstrings succeds
|
||||
-- comparison of encrypted magicstrings succeeds
|
||||
if status and response:sub(1,8) == encrypted_ping:sub(1,8)
|
||||
and self:BOcrypt(response,seed):match("!PONG!(1%.20)!.*!") then
|
||||
local BOversion, BOhostname = self:BOcrypt(response,seed):match("!PONG!(1%.20)!(.*)!")
|
||||
|
||||
@@ -164,7 +164,7 @@ action = function()
|
||||
local request_type = dhcp.request_types["DHCPDISCOVER"]
|
||||
local ip_address = bin.pack(">I", ipOps.todword("0.0.0.0"))
|
||||
|
||||
-- we nead to set the flags to broadcast
|
||||
-- we need to set the flags to broadcast
|
||||
local request_options, overrides, lease_time = nil, { flags = 0x8000 }, nil
|
||||
local status, packet = dhcp.dhcp_build(request_type, ip_address, mac, nil, request_options, overrides, lease_time, transaction_id)
|
||||
if (not(status)) then return "\n ERROR: Failed to build packet" end
|
||||
|
||||
@@ -221,7 +221,7 @@ action = function()
|
||||
-- If an interface was provided, get its information
|
||||
interface = nmap.get_interface_info(interface)
|
||||
if not interface then
|
||||
return ("\n ERROR: Failed to retreive %s interface information."):format(interface)
|
||||
return ("\n ERROR: Failed to retrieve %s interface information."):format(interface)
|
||||
end
|
||||
interfaces = {interface}
|
||||
stdnse.print_debug("%s: Will use %s interface.", SCRIPT_NAME, interface.shortname)
|
||||
|
||||
@@ -105,7 +105,7 @@ license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
|
||||
|
||||
categories = {"discovery", "safe", "broadcast"}
|
||||
|
||||
--- Parses a raw igmp packet and return a structred packet.
|
||||
--- Parses a raw igmp packet and return a structured packet.
|
||||
-- @param data string IGMP Raw packet.
|
||||
-- @return response table Structured igmp packet.
|
||||
local igmpParse = function(data)
|
||||
@@ -204,7 +204,7 @@ end
|
||||
|
||||
--- Crafts a raw IGMP packet.
|
||||
-- @param interface Source interface of the packet.
|
||||
-- @param vesion IGMP version. Could be 1, 2 or 3.
|
||||
-- @param version IGMP version. Could be 1, 2 or 3.
|
||||
-- @return string Raw IGMP packet.
|
||||
local igmpRaw = function(interface, version)
|
||||
-- Only 1, 2 and 3 are valid IGMP versions
|
||||
@@ -247,7 +247,7 @@ end
|
||||
local igmpQuery;
|
||||
--- Sends an IGMP Membership query.
|
||||
-- @param interface Network interface to send on.
|
||||
-- @param vesion IGMP version. Could be 1, 2, 3 or all.
|
||||
-- @param version IGMP version. Could be 1, 2, 3 or all.
|
||||
igmpQuery = function(interface, version)
|
||||
local srcip = interface.address
|
||||
local dstip = "224.0.0.1"
|
||||
@@ -278,7 +278,7 @@ igmpQuery = function(interface, version)
|
||||
end
|
||||
end
|
||||
|
||||
-- Function to compare wieght of an IGMP response message.
|
||||
-- Function to compare weight of an IGMP response message.
|
||||
-- Used to sort elements in responses table.
|
||||
local respCompare = function(a,b)
|
||||
return ipOps.todword(a.src) + a.type + (a.ngroups or ipOps.todword(a.group))
|
||||
@@ -338,7 +338,7 @@ action = function(host, port)
|
||||
-- Get the interface information
|
||||
interface = nmap.get_interface_info(interface)
|
||||
if not interface then
|
||||
return ("ERROR: Failed to retreive %s interface information."):format(interface)
|
||||
return ("ERROR: Failed to retrieve %s interface information."):format(interface)
|
||||
end
|
||||
interfaces = {interface}
|
||||
stdnse.print_debug("%s: Will use %s interface.", SCRIPT_NAME, interface.shortname)
|
||||
|
||||
@@ -33,7 +33,7 @@ local TIMEOUT = stdnse.parse_timespec(stdnse.get_script_args("broadcast-pc-duo.t
|
||||
prerule = function() return ( nmap.address_family() == "inet") end
|
||||
|
||||
-- Sends a UDP probe to the server and processes the response
|
||||
-- @param probe table contaning a pc-duo probe
|
||||
-- @param probe table containing a pc-duo probe
|
||||
-- @param responses table containing the responses
|
||||
local function udpProbe(probe, responses)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ The <code>newtarget</code> script-arg can be used so the script adds the
|
||||
discovered IPs as targets.
|
||||
|
||||
The timeout of the ICMP probes can be specified using the <code>timeout</code>
|
||||
script-arg. The default timeout is 3000 ms. A higher number might be necesary
|
||||
script-arg. The default timeout is 3000 ms. A higher number might be necessary
|
||||
when scanning across larger networks.
|
||||
|
||||
The number of sent probes can be specified using the <code>num-probes</code>
|
||||
|
||||
@@ -47,7 +47,7 @@ RIPng = {
|
||||
-- @param prefix string containing the ipv6 route prefix
|
||||
-- @param tag number containing the route tag
|
||||
-- @param prefix_len number containing the length in bits of the
|
||||
-- signifcant part of the prefix
|
||||
-- significant part of the prefix
|
||||
-- @param metric number containing the current metric for the
|
||||
-- destination
|
||||
new = function(self, prefix, tag, prefix_len, metric)
|
||||
|
||||
@@ -111,7 +111,7 @@ local function dnsDiscover()
|
||||
local d = domain
|
||||
-- reduce domain until we only have a single dot left
|
||||
-- there is a security problem in querying for wpad.tld like eg
|
||||
-- wpad.com as this could be a rougue domain. This loop does not
|
||||
-- wpad.com as this could be a rogue domain. This loop does not
|
||||
-- account for domains with tld's containing two parts e.g. co.uk.
|
||||
-- However, as the script just attempts to download and parse the
|
||||
-- proxy values in the WPAD there should be no real harm here.
|
||||
|
||||
@@ -48,7 +48,7 @@ categories = {"broadcast", "safe"}
|
||||
|
||||
prerule = function() return true end
|
||||
|
||||
-- function used for running several discovery threads in parallell
|
||||
-- function used for running several discovery threads in parallel
|
||||
--
|
||||
-- @param funcname string containing the name of the function to run
|
||||
-- the name should be one of the discovery functions in wsdd.Helper
|
||||
|
||||
@@ -54,7 +54,7 @@ function action(host,port)
|
||||
|
||||
local results = {}
|
||||
|
||||
-- uglyness to allow creds.cassandra to work, as the port is not recognized
|
||||
-- ugliness to allow creds.cassandra to work, as the port is not recognized
|
||||
-- as cassandra even when service scan was run, taken from mongodb
|
||||
local ps = port.service
|
||||
port.service = 'cassandra'
|
||||
|
||||
@@ -46,7 +46,7 @@ local DISCARD = {}
|
||||
--- Removes uninteresting data from the table
|
||||
-- uses the DISCARD table above to see what
|
||||
-- keys should be omitted from the results
|
||||
-- @param data a table containg data
|
||||
-- @param data a table containing data
|
||||
--@return another table containing data, with some keys removed
|
||||
local function queryResultToTable(data)
|
||||
local result = {}
|
||||
|
||||
@@ -59,7 +59,7 @@ local DISCARD = {stddev=1,min=1,max=1, mean=1}
|
||||
--- Removes uninteresting data from the table
|
||||
-- uses the DISCARD table above to see what
|
||||
-- keys should be omitted from the results
|
||||
-- @param data a table containg data
|
||||
-- @param data a table containing data
|
||||
--@return another table containing data, with some keys removed
|
||||
local function queryResultToTable(data)
|
||||
local result = {}
|
||||
|
||||
@@ -61,7 +61,7 @@ Driver =
|
||||
return true, brute.Account:new(username, password, creds.State.VALID)
|
||||
end
|
||||
|
||||
-- This error seems to indicate tha the user does not exist
|
||||
-- This error seems to indicate that the user does not exist
|
||||
if ( err:match("E PAM start error%: Critical error %- immediate abort\0$") ) then
|
||||
stdnse.print_debug(2, "%s: The user %s does not exist", SCRIPT_NAME, username)
|
||||
local err = brute.Error:new("Account invalid")
|
||||
|
||||
@@ -139,7 +139,7 @@ function getRevisionNumber( host, port, sessionid )
|
||||
return revision
|
||||
end
|
||||
|
||||
--- Gets the database identitity for the library
|
||||
--- Gets the database identity for the library
|
||||
--
|
||||
-- @param host table containing an ip field.
|
||||
-- @param port table containing number and protocol fields.
|
||||
|
||||
@@ -116,7 +116,7 @@ end
|
||||
--- Does *very* basic parsing of a DB2 packet
|
||||
--
|
||||
-- Due to the limited documentation of the protocol this function is guesswork
|
||||
-- The section called info is essentialy the data part of the db2das data response
|
||||
-- The section called info is essentially the data part of the db2das data response
|
||||
-- The length of this section is found at offset 158 in the db2das.data section
|
||||
--
|
||||
--
|
||||
@@ -156,7 +156,7 @@ end
|
||||
-- The bytes following the header are considered to be the data
|
||||
--
|
||||
-- Offset 38 of the header contains an integer with the length of the data section
|
||||
-- The length of the data section can unfortunately be of either endianess
|
||||
-- The length of the data section can unfortunately be of either endianness
|
||||
-- There's
|
||||
--
|
||||
-- @param socket connected to the server
|
||||
|
||||
@@ -339,7 +339,7 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
local nameserver = (host and host.ip) or argNS
|
||||
-- if we have no nameserver argument and no host, we dont have sufficient
|
||||
-- if we have no nameserver argument and no host, we don't have sufficient
|
||||
-- information to continue, abort
|
||||
if not nameserver then
|
||||
return nil
|
||||
|
||||
@@ -80,7 +80,7 @@ portrule = shortport.port_or_service(53, "domain", {"tcp", "udp"})
|
||||
|
||||
all_results = {}
|
||||
|
||||
-- get time (in miliseconds) when the script should finish
|
||||
-- get time (in milliseconds) when the script should finish
|
||||
local function get_end_time()
|
||||
local t = nmap.timing_level()
|
||||
local limit = stdnse.parse_timespec(stdnse.get_script_args('dns-nsec3-enum.timelimit') or "30m")
|
||||
@@ -230,7 +230,7 @@ local function query_for_hashes(host,subdomain,domain)
|
||||
return ranges
|
||||
end
|
||||
|
||||
-- does the actuall enumeration
|
||||
-- does the actual enumeration
|
||||
local function enum(host, port, domain)
|
||||
|
||||
local seen, seen_subdomain = {}, {}
|
||||
|
||||
@@ -547,7 +547,7 @@ function parse_records_table(number, data, table, offset)
|
||||
return offset
|
||||
end
|
||||
|
||||
-- An iterator that breaks up a concatentation of responses. In DNS over TCP,
|
||||
-- An iterator that breaks up a concatenation of responses. In DNS over TCP,
|
||||
-- each response is prefixed by a two-byte length (RFC 1035 section 4.2.2).
|
||||
-- Responses returned by this iterator include the two-byte length prefix.
|
||||
function responses_iter(data)
|
||||
|
||||
@@ -13,7 +13,7 @@ Performs password guessing against databases supporting the IBM DB2 protocol suc
|
||||
|
||||
---
|
||||
-- @args drda-brute.threads the amount of accounts to attempt to brute
|
||||
-- force in parallell (default 10).
|
||||
-- force in parallel (default 10).
|
||||
-- @args drda-brute.dbname the database name against which to guess
|
||||
-- passwords (default <code>"SAMPLE"</code>).
|
||||
--
|
||||
@@ -33,7 +33,7 @@ categories={"intrusive", "brute"}
|
||||
-- Version 0.5
|
||||
-- Created 05/08/2010 - v0.1 - created by Patrik Karlsson <patrik@cqure.net>
|
||||
-- Revised 05/09/2010 - v0.2 - re-wrote as multi-threaded <patrik@cqure.net>
|
||||
-- Revised 05/10/2010 - v0.3 - revised parallellised design <patrik@cqure.net>
|
||||
-- Revised 05/10/2010 - v0.3 - revised parallelised design <patrik@cqure.net>
|
||||
-- Revised 08/14/2010 - v0.4 - renamed script and library from db2* to drda* <patrik@cqure.net>
|
||||
-- Revised 09/09/2011 - v0.5 - changed account status text to be more consistent with other *-brute scripts
|
||||
|
||||
@@ -60,8 +60,8 @@ end
|
||||
|
||||
--- Iterates over the password list and guesses passwords
|
||||
--
|
||||
-- @param host table with information as recieved by <code>action</code>
|
||||
-- @param port table with information as recieved by <code>action</code>
|
||||
-- @param host table with information as received by <code>action</code>
|
||||
-- @param port table with information as received by <code>action</code>
|
||||
-- @param database string containing the database name
|
||||
-- @param creds an iterator producing username, password pairs
|
||||
-- @param valid_accounts table in which to store found accounts
|
||||
@@ -93,8 +93,8 @@ end
|
||||
|
||||
--- Checks if the supplied database exists
|
||||
--
|
||||
-- @param host table with information as recieved by <code>action</code>
|
||||
-- @param port table with information as recieved by <code>action</code>
|
||||
-- @param host table with information as received by <code>action</code>
|
||||
-- @param port table with information as received by <code>action</code>
|
||||
-- @param database string containing the database name
|
||||
-- @return status true on success, false on failure
|
||||
isValidDb = function( host, port, database )
|
||||
@@ -112,7 +112,7 @@ isValidDb = function( host, port, database )
|
||||
return false
|
||||
end
|
||||
|
||||
--- Returns the amount of currenlty active threads
|
||||
--- Returns the amount of currently active threads
|
||||
--
|
||||
-- @param threads table containing the list of threads
|
||||
-- @return count number containing the number of non-dead threads
|
||||
|
||||
@@ -729,7 +729,7 @@ local function initial_ttl(host)
|
||||
nmap.registry['firewalk']['traceroutefail'] = true
|
||||
|
||||
if nmap.verbosity() > 0 then
|
||||
stdnse.print_debug("%s requires unavailable traceroute informations.", SCRIPT_NAME)
|
||||
stdnse.print_debug("%s requires unavailable traceroute information.", SCRIPT_NAME)
|
||||
end
|
||||
|
||||
return nil
|
||||
@@ -906,7 +906,7 @@ end
|
||||
|
||||
--- send a probe and update it
|
||||
-- @param scanner the scanner handle
|
||||
-- @param probe the probe specifications and related informations
|
||||
-- @param probe the probe specifications and related information
|
||||
local function send_probe(scanner, probe)
|
||||
|
||||
local try = nmap.new_try(function() scanner.sock:ip_close() end)
|
||||
@@ -918,7 +918,7 @@ local function send_probe(scanner, probe)
|
||||
|
||||
try(scanner.sock:ip_send(pkt.buf, scanner.target))
|
||||
|
||||
-- update probe informations
|
||||
-- update probe information
|
||||
probe.retry = probe.retry + 1
|
||||
probe.sent_time = nmap.clock_ms()
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ function table_count(tt, item)
|
||||
return count
|
||||
end
|
||||
|
||||
parse_page = function( host, port, uri, intresting_keys )
|
||||
parse_page = function( host, port, uri, interesting_keys )
|
||||
local result = {}
|
||||
local response = http.get( host, port, uri )
|
||||
stdnse.print_debug(1, "%s: Status %s",
|
||||
@@ -125,7 +125,7 @@ parse_page = function( host, port, uri, intresting_keys )
|
||||
if nmap.verbosity() > 1 then
|
||||
result[#result+1] = ("%s: %s"):format(name,value:gsub("^%s*(.-)%s*$", "%1"))
|
||||
else
|
||||
for i,v in ipairs(intresting_keys) do
|
||||
for i,v in ipairs(interesting_keys) do
|
||||
if name:match(("^%s"):format(v)) then
|
||||
result[#result+1] = ("%s: %s"):format(name,value:gsub("^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ Reference:
|
||||
-- | Description:
|
||||
-- | ProFTPD server (version 1.3.2rc3 through 1.3.3b) is vulnerable to
|
||||
-- | stack-based buffer overflow. By sending a large number of TELNET_IAC
|
||||
-- | escape sequence, a remote attacker will be able to corrup the stack and
|
||||
-- | escape sequence, a remote attacker will be able to corrupt the stack and
|
||||
-- | execute arbitrary code.
|
||||
-- | Disclosure date: 2010-11-02
|
||||
-- | References:
|
||||
@@ -180,7 +180,7 @@ action = function(host, port)
|
||||
description = [[
|
||||
ProFTPD server (version 1.3.2rc3 through 1.3.3b) is vulnerable to
|
||||
stack-based buffer overflow. By sending a large number of TELNET_IAC
|
||||
escape sequence, a remote attacker will be able to corrup the stack and
|
||||
escape sequence, a remote attacker will be able to corrupt the stack and
|
||||
execute arbitrary code.]],
|
||||
references = {
|
||||
'http://bugs.proftpd.org/show_bug.cgi?id=3521',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user