mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Fix globals, whitespace
This commit is contained in:
@@ -111,6 +111,7 @@
|
|||||||
|
|
||||||
local bin = require "bin"
|
local bin = require "bin"
|
||||||
local bit = require "bit"
|
local bit = require "bit"
|
||||||
|
local bits = require "bits"
|
||||||
local math = require "math"
|
local math = require "math"
|
||||||
local match = require "match"
|
local match = require "match"
|
||||||
local nmap = require "nmap"
|
local nmap = require "nmap"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
local http = require "http"
|
local http = require "http"
|
||||||
|
local nmap = require "nmap"
|
||||||
local shortport = require "shortport"
|
local shortport = require "shortport"
|
||||||
local stdnse = require "stdnse"
|
local stdnse = require "stdnse"
|
||||||
local ipOps = require "ipOps"
|
local ipOps = require "ipOps"
|
||||||
@@ -52,7 +53,7 @@ local function generateHttpV1_0Req(host, port, path)
|
|||||||
-- Check if the redirect location contains an IP address
|
-- Check if the redirect location contains an IP address
|
||||||
redirectIP = locTarget:match("[%d%.]+")
|
redirectIP = locTarget:match("[%d%.]+")
|
||||||
if redirectIP then
|
if redirectIP then
|
||||||
privateIP, _ = ipOps.isPrivate(redirectIP)
|
privateIP = ipOps.isPrivate(redirectIP)
|
||||||
end
|
end
|
||||||
|
|
||||||
stdnse.debug1("Location: %s", locTarget )
|
stdnse.debug1("Location: %s", locTarget )
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ function action(host,port)
|
|||||||
|
|
||||||
if not status then
|
if not status then
|
||||||
socket:close()
|
socket:close()
|
||||||
return stdnse.format_output(false, searchResEntries)
|
return stdnse.format_output(false, searchResEntries)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if we were served all the results or not?
|
-- Check if we were served all the results or not?
|
||||||
@@ -166,22 +166,22 @@ function action(host,port)
|
|||||||
|
|
||||||
if not status or not searchResEntries then return stdnse.format_output(false, searchResEntries) end
|
if not status or not searchResEntries then return stdnse.format_output(false, searchResEntries) end
|
||||||
result = ldap.searchResultToTable( searchResEntries )
|
result = ldap.searchResultToTable( searchResEntries )
|
||||||
|
|
||||||
-- if taken a way and ldap returns a single result, it ain't shown....
|
-- if taken a way and ldap returns a single result, it ain't shown....
|
||||||
result.name = "LDAP Results"
|
result.name = "LDAP Results"
|
||||||
local scriptResult = stdnse.format_output(true, result )
|
local scriptResult = stdnse.format_output(true, result )
|
||||||
|
|
||||||
-- Start extracting target information
|
-- Start extracting target information
|
||||||
-- The following works on Windows AD LDAP as well as VMware's LDAP, VMware uses lower case cn vs AD ucase CN
|
-- The following works on Windows AD LDAP as well as VMware's LDAP, VMware uses lower case cn vs AD ucase CN
|
||||||
local serverName = string.match(scriptResult,"serverName: [cC][nN]=([^,]+),[cC][nN]=Servers,[cC][nN]=")
|
local serverName = scriptResult:match("serverName: [cC][nN]=([^,]+),[cC][nN]=Servers,[cC][nN]=")
|
||||||
if serverName then port.version.hostname = serverName end
|
if serverName then port.version.hostname = serverName end
|
||||||
|
|
||||||
-- Check to see if this is Active Directory vs some other product or ADAM
|
-- Check to see if this is Active Directory vs some other product or ADAM
|
||||||
-- https://msdn.microsoft.com/en-us/library/cc223359.aspx
|
-- https://msdn.microsoft.com/en-us/library/cc223359.aspx
|
||||||
if string.match(scriptResult,"1.2.840.113556.1.4.800") then
|
if string.match(scriptResult,"1.2.840.113556.1.4.800") then
|
||||||
port.version.product = 'Microsoft Windows Active Directory LDAP'
|
port.version.product = 'Microsoft Windows Active Directory LDAP'
|
||||||
port.version.name_confidence = 10
|
port.version.name_confidence = 10
|
||||||
|
|
||||||
-- Determine Windows version
|
-- Determine Windows version
|
||||||
if not port.version.ostype or port.version.ostype == 'Windows' then
|
if not port.version.ostype or port.version.ostype == 'Windows' then
|
||||||
local DC_Func = string.match(scriptResult,"domainControllerFunctionality: (%d)")
|
local DC_Func = string.match(scriptResult,"domainControllerFunctionality: (%d)")
|
||||||
@@ -201,11 +201,11 @@ function action(host,port)
|
|||||||
port.version.extrainfo = string.format("Domain: %s, Site: %s", domainName, siteName)
|
port.version.extrainfo = string.format("Domain: %s, Site: %s", domainName, siteName)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set port information
|
-- Set port information
|
||||||
port.version.name = "ldap"
|
port.version.name = "ldap"
|
||||||
nmap.set_port_version(host, port, "hardmatched")
|
nmap.set_port_version(host, port, "hardmatched")
|
||||||
nmap.set_port_state(host, port, "open")
|
nmap.set_port_state(host, port, "open")
|
||||||
|
|
||||||
return scriptResult
|
return scriptResult
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
local nmap = require "nmap"
|
||||||
local smb = require "smb"
|
local smb = require "smb"
|
||||||
local stdnse = require "stdnse"
|
local stdnse = require "stdnse"
|
||||||
local string = require "string"
|
local string = require "string"
|
||||||
|
|||||||
Reference in New Issue
Block a user