metasploit-framework/modules/auxiliary/scanner/ftp/ftp_version.rb

49 lines
1021 B
Ruby
Raw Normal View History

##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
2013-08-30 21:28:54 +00:00
include Msf::Exploit::Remote::Ftp
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report
2013-08-30 21:28:54 +00:00
def initialize
super(
'Name' => 'FTP Version Scanner',
'Description' => 'Detect FTP Version.',
'Author' => 'hdm',
'License' => MSF_LICENSE
)
2013-08-30 21:28:54 +00:00
register_options(
[
Opt::RPORT(21),
], self.class)
end
2013-08-30 21:28:54 +00:00
def run_host(target_host)
2013-08-30 21:28:54 +00:00
begin
2013-08-30 21:28:54 +00:00
res = connect(true, false)
2013-08-30 21:28:54 +00:00
if(banner)
banner_sanitized = Rex::Text.to_hex_ascii(self.banner.to_s)
print_status("#{rhost}:#{rport} FTP Banner: '#{banner_sanitized}'")
report_service(:host => rhost, :port => rport, :name => "ftp", :info => banner_sanitized)
end
2013-08-30 21:28:54 +00:00
disconnect
2013-08-30 21:28:54 +00:00
rescue ::Interrupt
raise $!
rescue ::Rex::ConnectionError, ::IOError
end
2013-08-30 21:28:54 +00:00
end
end