mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Fix globals, whitespace
This commit is contained in:
@@ -111,6 +111,7 @@
|
||||
|
||||
local bin = require "bin"
|
||||
local bit = require "bit"
|
||||
local bits = require "bits"
|
||||
local math = require "math"
|
||||
local match = require "match"
|
||||
local nmap = require "nmap"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local http = require "http"
|
||||
local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local ipOps = require "ipOps"
|
||||
@@ -52,7 +53,7 @@ local function generateHttpV1_0Req(host, port, path)
|
||||
-- Check if the redirect location contains an IP address
|
||||
redirectIP = locTarget:match("[%d%.]+")
|
||||
if redirectIP then
|
||||
privateIP, _ = ipOps.isPrivate(redirectIP)
|
||||
privateIP = ipOps.isPrivate(redirectIP)
|
||||
end
|
||||
|
||||
stdnse.debug1("Location: %s", locTarget )
|
||||
|
||||
@@ -137,7 +137,7 @@ function action(host,port)
|
||||
|
||||
if not status then
|
||||
socket:close()
|
||||
return stdnse.format_output(false, searchResEntries)
|
||||
return stdnse.format_output(false, searchResEntries)
|
||||
end
|
||||
|
||||
-- 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
|
||||
result = ldap.searchResultToTable( searchResEntries )
|
||||
|
||||
|
||||
-- if taken a way and ldap returns a single result, it ain't shown....
|
||||
result.name = "LDAP Results"
|
||||
local scriptResult = stdnse.format_output(true, result )
|
||||
|
||||
local scriptResult = stdnse.format_output(true, result )
|
||||
|
||||
-- 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
|
||||
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
|
||||
|
||||
|
||||
-- Check to see if this is Active Directory vs some other product or ADAM
|
||||
-- https://msdn.microsoft.com/en-us/library/cc223359.aspx
|
||||
if string.match(scriptResult,"1.2.840.113556.1.4.800") then
|
||||
port.version.product = 'Microsoft Windows Active Directory LDAP'
|
||||
port.version.name_confidence = 10
|
||||
|
||||
|
||||
-- Determine Windows version
|
||||
if not port.version.ostype or port.version.ostype == 'Windows' then
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
-- Set port information
|
||||
|
||||
-- Set port information
|
||||
port.version.name = "ldap"
|
||||
nmap.set_port_version(host, port, "hardmatched")
|
||||
nmap.set_port_state(host, port, "open")
|
||||
|
||||
|
||||
return scriptResult
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
local nmap = require "nmap"
|
||||
local smb = require "smb"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
|
||||
Reference in New Issue
Block a user