mirror of
https://github.com/nmap/nmap.git
synced 2026-02-08 06:26:33 +00:00
Remove trailing whitespace in lua files
Whitespace is not significant, so this should not be a problem. https://secwiki.org/w/Nmap/Code_Standards
This commit is contained in:
@@ -15,7 +15,7 @@ Performs brute force password auditing against an iPhoto Library.
|
||||
--
|
||||
-- @output
|
||||
-- 8770/tcp open apple-iphoto syn-ack
|
||||
-- | dpap-brute:
|
||||
-- | dpap-brute:
|
||||
-- | Accounts
|
||||
-- | secret => Login correct
|
||||
-- | Statistics
|
||||
@@ -34,7 +34,7 @@ categories = {"intrusive", "brute"}
|
||||
portrule = shortport.port_or_service(8770, "apple-iphoto")
|
||||
|
||||
Driver = {
|
||||
|
||||
|
||||
new = function(self, host, port)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
@@ -43,13 +43,13 @@ Driver = {
|
||||
o.port = port
|
||||
return o
|
||||
end,
|
||||
|
||||
|
||||
connect = function( self )
|
||||
self.socket = nmap.new_socket()
|
||||
self.socket:set_timeout(5000)
|
||||
return self.socket:connect(self.host, self.port, "tcp")
|
||||
end,
|
||||
|
||||
|
||||
login = function( self, username, password )
|
||||
local data = "GET dpap://%s:%d/login HTTP/1.1\r\n" ..
|
||||
"User-Agent: iPhoto/9.1.1 (Macintosh; N; PPC)\r\n" ..
|
||||
@@ -57,31 +57,31 @@ Driver = {
|
||||
"Authorization: Basic %s\r\n" ..
|
||||
"Client-DPAP-Version: 1.1\r\n" ..
|
||||
"\r\n\r\n"
|
||||
|
||||
|
||||
local c = base64.enc("nmap:" .. password)
|
||||
data = data:format( self.host.ip, self.port.number, self.host.ip, c )
|
||||
|
||||
|
||||
local status = self.socket:send( data )
|
||||
if ( not(status) ) then
|
||||
local err = brute.Error:new( "Failed to send data to DPAP server" )
|
||||
err:setRetry( true )
|
||||
return false, err
|
||||
end
|
||||
|
||||
|
||||
status, data = self.socket:receive()
|
||||
if ( not(status) ) then
|
||||
local err = brute.Error:new( "Failed to receive data from DPAP server" )
|
||||
err:setRetry( true )
|
||||
return false, err
|
||||
end
|
||||
|
||||
|
||||
if ( data:match("^HTTP/1.1 200 OK") ) 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,
|
||||
@@ -91,11 +91,11 @@ Driver = {
|
||||
local function checkEmptyPassword(host, port)
|
||||
local d = Driver:new(host, port)
|
||||
local status = d:connect()
|
||||
|
||||
|
||||
if ( not(status) ) then
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
status = d:login("", "")
|
||||
d:disconnect()
|
||||
|
||||
@@ -109,13 +109,13 @@ action = function(host, port)
|
||||
return "Library has no password"
|
||||
end
|
||||
|
||||
local status, result
|
||||
local status, result
|
||||
local engine = brute.Engine:new(Driver, host, port )
|
||||
|
||||
|
||||
engine.options.firstonly = true
|
||||
engine.options:setOption( "passonly", true )
|
||||
engine.options.script_name = SCRIPT_NAME
|
||||
|
||||
|
||||
status, result = engine:start()
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user