1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-04 21:59:02 +00:00

updated NSEDoc documentation for snmp.lua, pop3.lua, base64.lua

This commit is contained in:
pgpickering
2008-08-01 20:33:56 +00:00
parent 9a9523a93d
commit 178a40f281
3 changed files with 183 additions and 12 deletions

View File

@@ -14,14 +14,22 @@ err = {
informationMissing = 3
}
---
-- Checks POP3 response for
--@param line First line returned from an POP3 request
--@return Found "+OK" string or nil
function stat(line)
return string.match(line, "+OK")
end
---
-- Try to login using USER/PASS commands
--@param socket Socket connected to POP3 server
--@param user User string
--@param pw Password string
--@return Success as boolean and error code as in err table
function login_user(socket, user, pw)
socket:send("USER " .. user .. "\r\n")
status, line = socket:receive_lines(1)
@@ -37,6 +45,12 @@ function login_user(socket, user, pw)
end
---
-- Try to login using AUTH command using SASL/Plain method
--@param socket Socket connected to POP3 server
--@param user User string
--@param pw Password string
--@return Success as boolean and error code as in err table
function login_sasl_plain(socket, user, pw)
local auth64 = base64.enc(user .. "\0" .. user .. "\0" .. pw)
@@ -51,6 +65,12 @@ function login_sasl_plain(socket, user, pw)
end
end
---
-- Try to login using AUTH command using SASL/Login method
--@param user User string
--@param pw Password string
--@param pw String containing password to login
--@return Success as boolean and error code as in err table
function login_sasl_login(socket, user, pw)
local user64 = base64.enc(user)
@@ -83,7 +103,13 @@ function login_sasl_login(socket, user, pw)
end
end
---
-- Try to login using APOP command
--@param socket Socket connected to POP3 server
--@param user User string
--@param pw Password string
--@param challenge String containing challenge from POP3 server greeting
--@return Success as boolean and error code as in err table
function login_apop(socket, user, pw, challenge)
if type(challenge) ~= "string" then return false, err.informationMissing end
@@ -99,6 +125,11 @@ function login_apop(socket, user, pw, challenge)
end
end
---
-- Asks POP3 server for capabilities
--@param host Host to be queried
--@param port Port to connect to
--@return Table containing capabilities
function capabilities(host, port)
local socket = nmap.new_socket()
local capas = {}
@@ -139,7 +170,11 @@ function capabilities(host, port)
return capas
end
---
-- Calculate HMAC-MD5 hash
--@param key Key for hash calculation
--@param msg Message to be hashed
--@return HMAC-MD5 of given message
function hmacMD5(key, msg)
local ipad = {}
local opad = {}
@@ -162,7 +197,12 @@ function hmacMD5(key, msg)
return hash.md5(table.concat(opad) .. hash.md5bin(table.concat(ipad) .. msg))
end
---
-- Try to login using AUTH command using SASL/CRAM-MD5 method
--@param socket Socket connected to POP3 server
--@param user User string
--@param pw Password string
--@return Success as boolean and error code as in err table
function login_sasl_crammd5(socket, user, pw)
socket:send("AUTH CRAM-MD5\r\n")