Nmap Development mailing list archives
Adding non-blocking connect(), pre_loop and post_loop to NSE?
From: Jacek Wielemborek <d33tah () gmail com>
Date: Mon, 25 Aug 2014 19:11:11 +0200
Hi,
Today I felt like hacking my nmap-nseportscan branch to see how hard
would it be implement connect scan using NSE scanning. I wanted the code
layout to mimick the one I worked out while developing nmap-nsock-scan,
but then I realized that in order to connect()-scan multiple ports at
once, instead of doing this like this:
do_connect = function(host, port)
local sock = nmap.new_socket()
local constatus, conerr = sock:connect(host, port)
sock:close()
--interpret the resuls etc.
end
action = function(host)
local ports = getports(host)
for _, port in ipairs(ports) do
connect(host, port)
end
end
I would prefer to do it like this:
connected = function(event, userdata)
--interpret the resuls etc.
end
pre_loop = function(host)
startTimeoutClock(host)
local ports = getports(host)
for _, port in ipairs(ports) do
schedule_connect(host, port, connected, nil)
end
end
post_loop = function(host)
finishTimeoutClock(host)
end
The pre_loop here would just schedule the connections and return
immediately, leaving the execution of "connected" callback function to NSE.
I took a look at the code and realized that it would probably be wiser
to ask people that know the NSE subsystem better how such a modification
should look instead of modifying it blindly. I am especially lost on
running the post_loop part. Could someone take a look at
nmap-nseportscan branch and see how to fit my concept there?
Cheers,
Jacek
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Adding non-blocking connect(), pre_loop and post_loop to NSE? Jacek Wielemborek (Aug 25)
- Re: Adding non-blocking connect(), pre_loop and post_loop to NSE? Patrick Donnelly (Aug 25)
