Class: Metasploit::Framework::LoginScanner::FTP

Inherits:
Object
  • Object
show all
Includes:
Ftp::Client, Base, RexSocket
Defined in:
lib/metasploit/framework/login_scanner/ftp.rb

Overview

This is the LoginScanner class for dealing with FTP. It is responsible for taking a single target, and a list of credentials and attempting them. It then saves the results.

Constant Summary collapse

DEFAULT_PORT =
21
LIKELY_PORTS =
[ DEFAULT_PORT, 2121 ]
LIKELY_SERVICE_NAMES =
[ 'ftp' ]
PRIVATE_TYPES =
[ :password ]
REALM_KEY =
nil

Instance Attribute Summary collapse

Attributes included from Ftp::Client

#banner, #datasocket

Attributes included from Tcp::Client

#max_send_size, #send_delay, #sock

Instance Method Summary collapse

Methods included from Ftp::Client

#connect, #connect_login, #data_connect, #data_disconnect, #raw_send, #raw_send_recv, #recv_ftp_resp, #send_cmd, #send_cmd_data, #send_pass, #send_quit, #send_user

Methods included from Tcp::Client

#chost, #connect, #cport, #disconnect, #proxies, #rhost, #rport, #set_tcp_evasions, #ssl, #ssl_version

Instance Attribute Details

#ftp_timeoutInteger

Returns The timeout in seconds to wait for a response to an FTP command.

Returns:

  • (Integer)

    The timeout in seconds to wait for a response to an FTP command


25
26
27
# File 'lib/metasploit/framework/login_scanner/ftp.rb', line 25

def ftp_timeout
  @ftp_timeout
end

Instance Method Details

#attempt_login(credential) ⇒ Object


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/metasploit/framework/login_scanner/ftp.rb', line 37

def (credential)
  result_options = {
      credential: credential
  }

  begin
    success = (credential.public, credential.private)
  rescue ::EOFError, Errno::ECONNRESET, Rex::ConnectionError, Rex::ConnectionTimeout, ::Timeout::Error
    result_options[:status] = Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
    success = false
  end


  if success
    result_options[:status] = Metasploit::Model::Login::Status::SUCCESSFUL
  elsif !(result_options.has_key? :status)
    result_options[:status] = Metasploit::Model::Login::Status::INCORRECT
  end

  result = ::Metasploit::Framework::LoginScanner::Result.new(result_options)
  result.host         = host
  result.port         = port
  result.protocol     = 'tcp'
  result.service_name = 'ftp'
  result
end