1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00
Files
nmap/scripts/sshv1.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

63 lines
1.2 KiB
Lua

description = [[
Checks if an SSH server supports SSH Protocol Version 1.
]]
author = "Brandon Enright <bmenrigh@ucsd.edu>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"default", "safe"}
require "shortport"
portrule = shortport.port_or_service(22, "ssh")
action = function(host, port)
local socket = nmap.new_socket()
local result;
local status = true;
socket:connect(host.ip, port.number, port.protocol)
status, result = socket:receive_lines(1);
if (not status) then
socket:close()
return
end
if (result == "TIMEOUT") then
socket:close()
return
end
if not string.match(result, "^SSH%-.+\n$") then
socket:close()
return
end
socket:send("SSH-1.5-NmapNSE_1.0\n")
-- should be able to consume at least 13 bytes
-- key length is a 4 byte integer
-- padding is between 1 and 8 bytes
-- type is one byte
-- key is at least several bytes
status, result = socket:receive_bytes(13);
if (not status) then
socket:close()
return
end
if (result == "TIMEOUT") then
socket:close()
return
end
if not string.match(result, "^....[%z]+\002") then
socket:close()
return
end
socket:close();
return "Server supports SSHv1"
end