1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 17:59:04 +00:00
Files
nmap/scripts/xamppDefaultPass.nse
david 8bd71aaf43 Normalize NSEDoc documentation of scripts.
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.
2008-10-14 20:52:50 +00:00

63 lines
1.3 KiB
Lua

id = "XAMPP default pwd"
description = [[
Check if an XAMP or XAMPP FTP server uses a default username and password.
\n\n
XAMP is an Apache distribution designed for easy installation and
administration. The default username/password combination the script checks for
is nobody/xampp.
]]
---
-- @output
-- 21/tcp open ftp\n
-- |_ Login success with u/p: foo/bar\n
author = "Diman Todorov <diman.todorov@gmail.com>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"auth", "vuln"}
require "shortport"
portrule = shortport.port_or_service(21, "ftp")
login = function(socket, user, pass)
local status, err
local res = ""
status, err = socket:send("USER " .. user .. "\n")
status, err = socket:send("PASS " .. pass .. "\n")
-- consume the banner and stuff
while true do
status, res = socket:receive_lines(1)
if
not string.match(res, "^220")
and not string.match(res, "^331 ")
then
break
end
end
-- are we logged in?
if string.match(res, "^230") then
return "Login success with u/p: " .. user .. "/" .. pass
end
end
action = function(host, port)
local res
local socket = nmap.new_socket()
socket:connect(host.ip, port.number)
res = login(socket, "nobody", "e0e0e0e0")
socket:close()
socket:connect(host.ip, port.number)
res = login(socket, "nobody", "xampp")
socket:close()
return res
end