Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/scanner/ftp/ftp_version.rb
19500 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Auxiliary
7
include Msf::Exploit::Remote::Ftp
8
include Msf::Auxiliary::Scanner
9
include Msf::Auxiliary::Report
10
11
def initialize
12
super(
13
'Name' => 'FTP Version Scanner',
14
'Description' => 'Detect FTP Version.',
15
'Author' => 'hdm',
16
'License' => MSF_LICENSE
17
)
18
19
register_options(
20
[
21
Opt::RPORT(21),
22
]
23
)
24
end
25
26
def run_host(target_host)
27
begin
28
res = connect(true, false)
29
30
if (banner)
31
banner_sanitized = Rex::Text.to_hex_ascii(self.banner.to_s)
32
print_good("FTP Banner: '#{banner_sanitized}'")
33
report_service(:host => rhost, :port => rport, :name => "ftp", :info => banner_sanitized)
34
end
35
36
disconnect
37
rescue ::Interrupt
38
raise $!
39
rescue ::Rex::ConnectionError, ::IOError
40
end
41
end
42
end
43
44