1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-03 13:19:04 +00:00

Re-indent some scripts. Whitespace-only commit

https://secwiki.org/w/Nmap/Code_Standards
This commit is contained in:
dmiller
2014-01-31 13:02:29 +00:00
parent 64fb5b3482
commit d36c08dcf5
137 changed files with 3977 additions and 3977 deletions

View File

@@ -30,72 +30,72 @@ portrule = shortport.port_or_service({1080, 9050}, {"socks", "socks5", "tor-sock
Driver = {
new = function (self, host, port)
local o = { host = host, port = port }
setmetatable (o,self)
self.__index = self
return o
end,
new = function (self, host, port)
local o = { host = host, port = port }
setmetatable (o,self)
self.__index = self
return o
end,
connect = function ( self )
self.helper = socks.Helper:new(self.host, self.port, { timeout = 10000 })
return self.helper:connect()
end,
connect = function ( self )
self.helper = socks.Helper:new(self.host, self.port, { timeout = 10000 })
return self.helper:connect()
end,
login = function( self, username, password )
local status, err = self.helper:authenticate({username=username, password=password})
login = function( self, username, password )
local status, err = self.helper:authenticate({username=username, password=password})
if (not(status)) then
-- the login failed
if ( "Authentication failed" == err ) then
return false, brute.Error:new( "Login failed" )
end
if (not(status)) then
-- the login failed
if ( "Authentication failed" == err ) then
return false, brute.Error:new( "Login failed" )
end
-- something else happend, let's retry
local err = brute.Error:new( err )
err:setRetry( true )
return false, err
end
-- something else happend, let's retry
local err = brute.Error:new( err )
err:setRetry( true )
return false, err
end
return true, brute.Account:new(username, password, creds.State.VALID)
end,
return true, brute.Account:new(username, password, creds.State.VALID)
end,
disconnect = function( self )
return self.helper:close()
end,
disconnect = function( self )
return self.helper:close()
end,
}
local function checkAuth(host, port)
local helper = socks.Helper:new(host, port)
local status, response = helper:connect()
if ( not(status) ) then
return false, response
end
local helper = socks.Helper:new(host, port)
local status, response = helper:connect()
if ( not(status) ) then
return false, response
end
if ( response.method == socks.AuthMethod.NONE ) then
return false, "\n No authentication required"
end
if ( response.method == socks.AuthMethod.NONE ) then
return false, "\n No authentication required"
end
local status, err = helper:authenticate({username="nmap", password="nmapbruteprobe"})
if ( err ~= "Authentication failed" ) then
return false, ("\n ERROR: %s"):format(err)
end
local status, err = helper:authenticate({username="nmap", password="nmapbruteprobe"})
if ( err ~= "Authentication failed" ) then
return false, ("\n ERROR: %s"):format(err)
end
helper:close()
return true
helper:close()
return true
end
action = function(host, port)
local status, response = checkAuth(host, port)
if ( not(status) ) then
return response
end
local status, response = checkAuth(host, port)
if ( not(status) ) then
return response
end
local engine = brute.Engine:new(Driver, host, port)
engine.options.script_name = SCRIPT_NAME
local result
status, result = engine:start()
return result
local engine = brute.Engine:new(Driver, host, port)
engine.options.script_name = SCRIPT_NAME
local result
status, result = engine:start()
return result
end