2012-03-02 19:58:40 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
2012-03-06 16:22:38 +00:00
|
|
|
include Msf::Exploit::Remote::AFP
|
2012-03-02 19:58:40 +00:00
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super(update_info(info,
|
2012-03-05 12:57:59 +00:00
|
|
|
'Name' => 'Apple Filing Protocol Info Enumerator',
|
2012-03-02 19:58:40 +00:00
|
|
|
'Description' => %q{
|
2012-03-07 15:17:22 +00:00
|
|
|
This module fetches AFP server information, including server name,
|
|
|
|
network address, supported AFP versions, signature, machine type,
|
|
|
|
and server flags.
|
2012-03-02 19:58:40 +00:00
|
|
|
},
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'URL', 'https://developer.apple.com/library/mac/#documentation/Networking/Reference/AFP_Reference/Reference/reference.html' ]
|
|
|
|
],
|
|
|
|
'Author' => [ 'Gregory Man <man.gregory[at]gmail.com>' ],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
))
|
|
|
|
|
|
|
|
deregister_options('RHOST')
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
print_status("Scanning IP: #{ip.to_s}")
|
|
|
|
begin
|
|
|
|
connect
|
2012-03-06 16:22:38 +00:00
|
|
|
response = get_info
|
|
|
|
report(response)
|
2012-03-02 19:58:40 +00:00
|
|
|
rescue ::Timeout::Error
|
|
|
|
rescue ::Interrupt
|
|
|
|
raise $!
|
|
|
|
rescue ::Rex::ConnectionError, ::IOError, ::Errno::ECONNRESET, ::Errno::ENOPROTOOPT
|
|
|
|
rescue ::Exception
|
2012-03-06 16:22:38 +00:00
|
|
|
raise $!
|
2012-03-05 12:57:59 +00:00
|
|
|
print_error("#{rhost}:#{rport} #{$!.class} #{$!}")
|
2012-03-02 19:58:40 +00:00
|
|
|
ensure
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-03-06 16:22:38 +00:00
|
|
|
def report(response)
|
|
|
|
report_info = "Server Name: #{response[:server_name]} \n" +
|
|
|
|
" Server Flags: \n" +
|
|
|
|
format_flags_report(response[:server_flags]) +
|
|
|
|
" Machine Type: #{response[:machine_type]} \n" +
|
|
|
|
" AFP Versions: #{response[:versions].join(', ')} \n" +
|
|
|
|
" UAMs: #{response[:uams].join(', ')}\n" +
|
|
|
|
" Server Signature: #{response[:signature]}\n" +
|
2012-03-02 19:58:40 +00:00
|
|
|
" Server Network Address: \n" +
|
2012-03-06 16:22:38 +00:00
|
|
|
format_addresses_report(response[:network_addresses]) +
|
|
|
|
" UTF8 Server Name: #{response[:utf8_server_name]}"
|
2012-03-02 19:58:40 +00:00
|
|
|
print_status("#{rhost}:#{rport} APF:\n #{report_info}")
|
2012-03-06 16:22:38 +00:00
|
|
|
|
2012-03-02 19:58:40 +00:00
|
|
|
report_note(:host => datastore['RHOST'],
|
2012-03-13 07:52:30 +00:00
|
|
|
:proto => 'tcp',
|
2012-03-02 19:58:40 +00:00
|
|
|
:port => datastore['RPORT'],
|
|
|
|
:type => 'afp_server_info',
|
2012-03-06 16:22:38 +00:00
|
|
|
:data => response)
|
2012-03-13 07:52:30 +00:00
|
|
|
|
|
|
|
report_service(
|
|
|
|
:host => datastore['RHOST'],
|
|
|
|
:port => datastore['RPORT'],
|
|
|
|
:proto => 'tcp',
|
|
|
|
:name => "afp",
|
|
|
|
:info => "AFP name: #{response[:utf8_server_name]}, Versions: #{response[:versions].join(', ')}"
|
|
|
|
)
|
|
|
|
|
2012-03-02 19:58:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def format_flags_report(parsed_flags)
|
|
|
|
report = ''
|
|
|
|
parsed_flags.each do |flag, val|
|
|
|
|
report << " * #{flag}: #{val.to_s} \n"
|
|
|
|
end
|
|
|
|
return report
|
|
|
|
end
|
|
|
|
|
|
|
|
def format_addresses_report(parsed_network_addresses)
|
|
|
|
report = ''
|
|
|
|
parsed_network_addresses.each do |val|
|
|
|
|
report << " * #{val.to_s} \n"
|
|
|
|
end
|
|
|
|
return report
|
|
|
|
end
|
|
|
|
end
|