mirror of
https://github.com/nmap/nmap.git
synced 2026-10-21 03:11:48 +00:00
o Added a new NSE Comm library for common network discovery tasks such
as banner-grabbing (get_banner()) and making a quick exchange of data (exchange()). 16 scripts were updated to use this library. [Kris] I have *not* been able to test all of these scripts; however, I have reviewed them and they should all work properly. I would really like some more testing, though :) This commit includes scripting.xml documentation.
This commit is contained in:
parent
cede9ab542
commit
2f9321360f
19 changed files with 297 additions and 268 deletions
|
|
@ -1,3 +1,4 @@
|
|||
require "comm"
|
||||
require "ipOps"
|
||||
|
||||
id = "RIPE query"
|
||||
|
|
@ -12,24 +13,11 @@ hostrule = function(host, port)
|
|||
end
|
||||
|
||||
action = function(host, port)
|
||||
local socket = nmap.new_socket()
|
||||
local status, line
|
||||
local result = ""
|
||||
local status, result = comm.exchange("whois.ripe.net", 43, host.ip .. "\n")
|
||||
|
||||
socket:connect("whois.ripe.net", 43)
|
||||
-- socket:connect("193.0.0.135", 43)
|
||||
socket:send(host.ip .. "\n")
|
||||
|
||||
while true do
|
||||
local status, lines = socket:receive_lines(1)
|
||||
|
||||
if not status then
|
||||
break
|
||||
else
|
||||
result = result .. lines
|
||||
end
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
socket:close()
|
||||
|
||||
local value = string.match(result, "role:(.-)\n")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue