mirror of
https://github.com/nmap/nmap.git
synced 2025-12-31 11:59:03 +00:00
Adjusts indentation for better readability
This commit is contained in:
@@ -134,19 +134,19 @@ local Connection = { methods = {} }
|
||||
Connection.new = function (host, port, proto)
|
||||
local soc = nmap.new_socket(proto)
|
||||
if not soc then return nil end
|
||||
return setmetatable( {
|
||||
socket = soc,
|
||||
isopen = false,
|
||||
buffer = nil,
|
||||
error = nil,
|
||||
host = host,
|
||||
port = port,
|
||||
proto = proto
|
||||
},
|
||||
{
|
||||
__index = Connection.methods,
|
||||
__gc = Connection.methods.close
|
||||
} )
|
||||
return setmetatable({
|
||||
socket = soc,
|
||||
isopen = false,
|
||||
buffer = nil,
|
||||
error = nil,
|
||||
host = host,
|
||||
port = port,
|
||||
proto = proto
|
||||
},
|
||||
{
|
||||
__index = Connection.methods,
|
||||
__gc = Connection.methods.close
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
@@ -239,8 +239,8 @@ Connection.methods.fill_buffer = function (self, data)
|
||||
end
|
||||
|
||||
optbuf = optbuf .. string.char(255)
|
||||
.. string.char(opttype)
|
||||
.. string.char(opt)
|
||||
.. string.char(opttype)
|
||||
.. string.char(opt)
|
||||
oldpos = newpos + 3
|
||||
end
|
||||
|
||||
@@ -307,12 +307,12 @@ Target.new = function (host, port)
|
||||
if not soc then return nil end
|
||||
soc:close()
|
||||
return setmetatable({
|
||||
host = host,
|
||||
port = port,
|
||||
proto = proto,
|
||||
workers = setmetatable({}, { __mode = "k" })
|
||||
},
|
||||
{ __index = Target.methods } )
|
||||
host = host,
|
||||
port = port,
|
||||
proto = proto,
|
||||
workers = setmetatable({}, { __mode = "k" })
|
||||
},
|
||||
{ __index = Target.methods })
|
||||
end
|
||||
|
||||
|
||||
@@ -336,7 +336,7 @@ end
|
||||
Target.methods.attach = function (self)
|
||||
local worker = self.workers[coroutine.running()]
|
||||
local conn = worker.conn
|
||||
or Connection.new(self.host, self.port, self.proto)
|
||||
or Connection.new(self.host, self.port, self.proto)
|
||||
if not conn then return false, "Unable to allocate connection" end
|
||||
worker.conn = conn
|
||||
|
||||
@@ -406,13 +406,13 @@ Driver.new = function (self, host, port, target)
|
||||
assert(host == target.host and port == target.port, "Target mismatch")
|
||||
target:worker()
|
||||
return setmetatable({
|
||||
target = target,
|
||||
connect = telnet_autosize
|
||||
and Driver.methods.connect_autosize
|
||||
or Driver.methods.connect_simple,
|
||||
thread_exit = nmap.condvar(target)
|
||||
},
|
||||
{ __index = Driver.methods } )
|
||||
target = target,
|
||||
connect = telnet_autosize
|
||||
and Driver.methods.connect_autosize
|
||||
or Driver.methods.connect_simple,
|
||||
thread_exit = nmap.condvar(target)
|
||||
},
|
||||
{ __index = Driver.methods })
|
||||
end
|
||||
|
||||
|
||||
@@ -492,9 +492,9 @@ Driver.methods.prompt = function (self)
|
||||
repeat
|
||||
line = conn:get_line()
|
||||
until not line
|
||||
or is_username_prompt(line)
|
||||
or is_password_prompt(line)
|
||||
or not conn:discard_line()
|
||||
or is_username_prompt(line)
|
||||
or is_password_prompt(line)
|
||||
or not conn:discard_line()
|
||||
return line
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user