1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-14 19:59:02 +00:00
Files
nmap/scripts/ripeQuery.nse
david 06c7264e2e Put the following scripts in the new "external" category:
ASN.nse
dns-safe-recursion-port.nse
dns-safe-recursion-txid.nse
ripeQuery.nse
whois.nse
2008-09-09 05:13:24 +00:00

39 lines
863 B
Lua

require "comm"
require "ipOps"
id = "RIPE query"
description = [[
Connects to the RIPE database, extracts and prints the role: entry for the IP.
\n
This script uses an external database. Your IP address and the IP address of
the target will be sent to whois.ripe.net.
]]
author = "Diman Todorov <diman.todorov@gmail.com>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery", "external"}
hostrule = function(host, port)
return not ipOps.isPrivate(host.ip)
end
action = function(host, port)
local status, result = comm.exchange("whois.ripe.net", 43, host.ip .. "\n")
if not status then
return
end
local value = string.match(result, "role:(.-)\n")
if (value == "see http://www.iana.org.") then
value = nil
end
if (value == nil) then
return
end
return "IP belongs to: " .. value:gsub("^%s*", "")
end