mirror of
https://github.com/nmap/nmap.git
synced 2025-12-23 16:09:02 +00:00
Add gopher-ls.nse by Toni Ruotto.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o [NSE] Added gopher-ls.nse by Toni Ruotto, which lists the root of a
|
||||
Gopher server.
|
||||
|
||||
o [NSE] Added modbus-discover.nse by Alexander Rudakov. This script
|
||||
enumerates Modbus slave ids and then tries to find device
|
||||
information about each of them.
|
||||
|
||||
59
scripts/gopher-ls.nse
Normal file
59
scripts/gopher-ls.nse
Normal file
@@ -0,0 +1,59 @@
|
||||
description = [[
|
||||
Lists files and directories at the root of a gopher service.
|
||||
]]
|
||||
|
||||
---
|
||||
-- @output
|
||||
-- 70/tcp open gopher
|
||||
-- |_gopher-ls: [txt] Gopher, the next big thing?, [dir] Tax Forms
|
||||
|
||||
author = "Toni Ruottu"
|
||||
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
|
||||
categories = {"default", "discovery", "safe"}
|
||||
|
||||
require("nmap")
|
||||
require("stdnse")
|
||||
require("shortport")
|
||||
|
||||
portrule = shortport.port_or_service (70, "gopher", {"tcp"})
|
||||
|
||||
local function typelabel(type)
|
||||
if type == "0" then
|
||||
return "[txt]"
|
||||
end
|
||||
if type == "1" then
|
||||
return "[dir]"
|
||||
end
|
||||
return string.format("[%s]", type)
|
||||
|
||||
end
|
||||
|
||||
action = function( host, port )
|
||||
|
||||
local socket = nmap.new_socket()
|
||||
local status, err = socket:connect(host.ip, port.number)
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
socket:send("\r\n")
|
||||
|
||||
local buffer, _ = stdnse.make_buffer(socket, "\r\n")
|
||||
local line = buffer()
|
||||
local files = {}
|
||||
|
||||
while line ~= nil do
|
||||
local fields = stdnse.strsplit("\t", line)
|
||||
local first = fields[1]
|
||||
if #first > 1 then
|
||||
local type = string.sub(first, 1, 1)
|
||||
if type ~= "i" then
|
||||
local label = string.sub(first, 2)
|
||||
table.insert(files, string.format("%s %s", typelabel(type), label))
|
||||
end
|
||||
end
|
||||
line = buffer()
|
||||
end
|
||||
return stdnse.strjoin(", ", files)
|
||||
end
|
||||
|
||||
@@ -42,6 +42,7 @@ Entry { filename = "ftp-brute.nse", categories = { "auth", "intrusive", } }
|
||||
Entry { filename = "ftp-libopie.nse", categories = { "intrusive", "vuln", } }
|
||||
Entry { filename = "ftp-proftpd-backdoor.nse", categories = { "discovery", "intrusive", } }
|
||||
Entry { filename = "giop-info.nse", categories = { "discovery", "safe", } }
|
||||
Entry { filename = "gopher-ls.nse", categories = { "default", "discovery", "safe", } }
|
||||
Entry { filename = "hddtemp-info.nse", categories = { "default", "discovery", "safe", } }
|
||||
Entry { filename = "hostmap.nse", categories = { "discovery", "external", "intrusive", } }
|
||||
Entry { filename = "http-auth.nse", categories = { "auth", "default", "intrusive", } }
|
||||
|
||||
Reference in New Issue
Block a user