1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 07:29:01 +00:00
Files
nmap/scripts/ftp-anon.nse
david 6fbc8868a9 Rename scripts (almost all of them) to make their names more consistent and
make them look better in output. The full list of changes is
  anonFTP => ftp-anon
  ASN => asn-query
  brutePOP3 => pop3-brute
  bruteTelnet => telnet-brute
  daytimeTest => daytime
  dns-safe-recursion-port => dns-random-srcport
  dns-safe-recursion-txid => dns-random-txid
  dns-test-open-recursion => dns-recursion
  ftpbounce => ftp-bounce
  HTTPAuth => http-auth
  HTTP_open_proxy => http-open-proxy
  HTTPpasswd => http-passwd
  HTTPtrace => http-trace
  iax2Detect => iax2-version
  ircServerInfo => irc-info
  ircZombieTest => irc-zombie
  MSSQLm => ms-sql-info
  MySQLinfo => mysql-info
  popcapa => pop3-capabilities
  PPTPversion => pptp-version
  promiscuous => sniffer-detect
  RealVNC_auth_bypass => realvnc-auth-bypass
  robots => robots.txt
  showHTMLTitle => html-title
  showOwner => identd-owners
  skype_v2-version => skypev2-version
  smb-enumdomains => smb-enum-domains
  smb-enumsessions => smb-enum-sessions
  smb-enumshares => smb-enum-shares
  smb-enumusers => smb-enum-users
  smb-serverstats => smb-server-stats
  smb-systeminfo => smb-system-info
  SMTPcommands => smtp-commands
  SMTP_openrelay_test => smtp-open-relay
  SNMPcommunitybrute => snmp-brute
  SNMPsysdescr => snmp-sysdescr
  SQLInject => sql-injection
  SSH-hostkey => ssh-hostkey
  SSHv1-support => sshv1
  SSLv2-support => sslv2
  strangeSMTPport => smtp-strangeport
  UPnP-info => upnp-info
  xamppDefaultPass => xampp-default-auth
  zoneTrans => zone-transfer
2008-11-06 02:52:59 +00:00

49 lines
1.0 KiB
Lua

description = [[
Checks if an FTP server allows anonymous logins.
]]
---
-- @output
-- |_ ftp-anon: Anonymous login allowed
author = "Eddie Bell <ejlbell@gmail.com>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"default", "auth", "intrusive"}
require "shortport"
portrule = shortport.port_or_service(21, "ftp")
--- Connects to the FTP server and checks if the server allows anonymous logins.
action = function(host, port)
local socket = nmap.new_socket()
local result
local status = true
local isAnon = false
local err_catch = function()
socket:close()
end
local try = nmap.new_try(err_catch)
socket:set_timeout(5000)
try(socket:connect(host.ip, port.number, port.protocol))
try(socket:send("USER anonymous\r\n"))
try(socket:send("PASS IEUser@\r\n"))
while status do
status, result = socket:receive_lines(1);
if string.match(result, "^230") then
isAnon = true
break
end
end
socket:close()
if(isAnon) then
return "FTP: Anonymous login allowed"
end
end