mirror of
https://github.com/nmap/nmap.git
synced 2025-12-14 19:59:02 +00:00
I made every script follow a standard form: it starts with the id, followed by the description. The description is contained in [[ ]] delimiters. The description is in the global description variable, not in a LuaDoc comment. Other LuaDoc information such as @args and @usage follows the description in a comment. The first paragraph of each description is a a short summary of what the script does. More detailed information, if any, is given in following paragraphs. I also improved some wording and formatting in a few cases.
40 lines
874 B
Lua
40 lines
874 B
Lua
id = "RIPE query"
|
|
description = [[
|
|
Connects to the RIPE database and displays the role: entry for the target's IP
|
|
address.
|
|
\n\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"}
|
|
|
|
require "comm"
|
|
require "ipOps"
|
|
|
|
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
|