1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-03 21:29:01 +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

@@ -36,51 +36,51 @@ portrule = shortport.port_or_service(512, "exec", "tcp")
Driver = {
-- creates a new Driver instance
-- @param host table as received by the action function
-- @param port table as received by the action function
-- @return o instance of Driver
new = function(self, host, port, options)
local o = { host = host, port = port, timeout = options.timeout }
setmetatable(o, self)
self.__index = self
return o
end,
-- creates a new Driver instance
-- @param host table as received by the action function
-- @param port table as received by the action function
-- @return o instance of Driver
new = function(self, host, port, options)
local o = { host = host, port = port, timeout = options.timeout }
setmetatable(o, self)
self.__index = self
return o
end,
connect = function(self)
self.socket = nmap.new_socket()
self.socket:set_timeout(self.timeout)
local status, err = self.socket:connect(self.host, self.port)
if ( not(status) ) then
local err = brute.Error:new("Connection failed")
err:setRetry( true )
return false, err
end
return true
end,
connect = function(self)
self.socket = nmap.new_socket()
self.socket:set_timeout(self.timeout)
local status, err = self.socket:connect(self.host, self.port)
if ( not(status) ) then
local err = brute.Error:new("Connection failed")
err:setRetry( true )
return false, err
end
return true
end,
login = function(self, username, password)
local cmd = "id"
local data = ("\0%s\0%s\0%s\0"):format(username, password, cmd)
login = function(self, username, password)
local cmd = "id"
local data = ("\0%s\0%s\0%s\0"):format(username, password, cmd)
local status, err = self.socket:send(data)
if ( not(status) ) then
local err = brute.Error:new("Send failed")
err:setRetry( true )
return false, err
end
local status, err = self.socket:send(data)
if ( not(status) ) then
local err = brute.Error:new("Send failed")
err:setRetry( true )
return false, err
end
local response
status, response = self.socket:receive()
if ( status ) then
return true, brute.Account:new(username, password, creds.State.VALID)
end
return false, brute.Error:new( "Incorrect password" )
end,
local response
status, response = self.socket:receive()
if ( status ) then
return true, brute.Account:new(username, password, creds.State.VALID)
end
return false, brute.Error:new( "Incorrect password" )
end,
disconnect = function(self)
self.socket:close()
end,
disconnect = function(self)
self.socket:close()
end,
}
@@ -89,12 +89,12 @@ local arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME ..
arg_timeout = (arg_timeout or 10) * 1000
action = function(host, port)
local options = {
timeout = arg_timeout
}
local options = {
timeout = arg_timeout
}
local engine = brute.Engine:new(Driver, host, port, options)
engine.options.script_name = SCRIPT_NAME
local status, result = engine:start()
return result
local engine = brute.Engine:new(Driver, host, port, options)
engine.options.script_name = SCRIPT_NAME
local status, result = engine:start()
return result
end