mirror of
https://github.com/nmap/nmap.git
synced 2025-12-23 07:59:03 +00:00
Don't override port.protocol in comm.lua; socket.connect already defaults to tcp
This commit is contained in:
@@ -56,19 +56,6 @@ local function get_timeouts(host, opts)
|
|||||||
return connect_timeout, request_timeout
|
return connect_timeout, request_timeout
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Makes sure that opts exists and the default proto is there
|
|
||||||
local initopts = function(opts)
|
|
||||||
if not opts then
|
|
||||||
opts = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
if not opts.proto then
|
|
||||||
opts.proto = "tcp"
|
|
||||||
end
|
|
||||||
|
|
||||||
return opts
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Sets up the socket and connects to host:port
|
-- Sets up the socket and connects to host:port
|
||||||
local setup_connect = function(host, port, opts)
|
local setup_connect = function(host, port, opts)
|
||||||
local sock = nmap.new_socket()
|
local sock = nmap.new_socket()
|
||||||
@@ -117,7 +104,7 @@ end
|
|||||||
-- @return Status (true or false).
|
-- @return Status (true or false).
|
||||||
-- @return Data (if status is true) or error string (if status is false).
|
-- @return Data (if status is true) or error string (if status is false).
|
||||||
get_banner = function(host, port, opts)
|
get_banner = function(host, port, opts)
|
||||||
opts = initopts(opts)
|
opts = opts or {}
|
||||||
opts.recv_before = true
|
opts.recv_before = true
|
||||||
local socket, nothing, correct, banner = tryssl(host, port, "", opts)
|
local socket, nothing, correct, banner = tryssl(host, port, "", opts)
|
||||||
if socket then
|
if socket then
|
||||||
@@ -140,7 +127,7 @@ end
|
|||||||
-- @return Status (true or false).
|
-- @return Status (true or false).
|
||||||
-- @return Data (if status is true) or error string (if status is false).
|
-- @return Data (if status is true) or error string (if status is false).
|
||||||
exchange = function(host, port, data, opts)
|
exchange = function(host, port, data, opts)
|
||||||
opts = initopts(opts)
|
opts = opts or {}
|
||||||
|
|
||||||
local status, sock = setup_connect(host, port, opts)
|
local status, sock = setup_connect(host, port, opts)
|
||||||
local ret
|
local ret
|
||||||
|
|||||||
Reference in New Issue
Block a user