Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/scanner/afp/afp_server_info.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Auxiliary::Report7include Msf::Auxiliary::Scanner8include Msf::Exploit::Remote::AFP910def initialize(info={})11super(update_info(info,12'Name' => 'Apple Filing Protocol Info Enumerator',13'Description' => %q{14This module fetches AFP server information, including server name,15network address, supported AFP versions, signature, machine type,16and server flags.17},18'References' =>19[20[ 'URL', 'https://web.archive.org/web/20130309051753/https://developer.apple.com/library/mac/#documentation/Networking/Reference/AFP_Reference/Reference/reference.html' ]21],22'Author' => [ 'Gregory Man <man.gregory[at]gmail.com>' ],23'License' => MSF_LICENSE24))25end2627def run_host(ip)28print_status("AFP #{ip} Scanning...")29begin30connect31response = get_info32report(response)33rescue ::Timeout::Error34rescue ::Interrupt35raise $!36rescue ::Rex::ConnectionError, ::IOError, ::Errno::ECONNRESET, ::Errno::ENOPROTOOPT37rescue ::Exception38raise $!39print_error("AFP #{rhost}:#{rport} #{$!.class} #{$!}")40ensure41disconnect42end43end4445def report(response)46report_info = "AFP #{rhost}:#{rport} Server Name: #{response[:server_name]} \n" +47"AFP #{rhost}:#{rport} Server Flags: \n" +48format_flags_report(response[:server_flags]) +49"AFP #{rhost}:#{rport} Machine Type: #{response[:machine_type]} \n" +50"AFP #{rhost}:#{rport} AFP Versions: #{response[:versions].join(', ')} \n" +51"AFP #{rhost}:#{rport} UAMs: #{response[:uams].join(', ')}\n" +52"AFP #{rhost}:#{rport} Server Signature: #{response[:signature]}\n" +53"AFP #{rhost}:#{rport} Server Network Address: \n" +54format_addresses_report(response[:network_addresses]) +55"AFP #{rhost}:#{rport} UTF8 Server Name: #{response[:utf8_server_name]}"565758lines = "AFP #{rhost}:#{rport}:#{rport} AFP:\n#{report_info}"5960lines.split(/\n/).each do |line|61print_status(line)62end6364report_note(:host => datastore['RHOST'],65:proto => 'tcp',66:port => datastore['RPORT'],67:type => 'afp_server_info',68:data => response)6970report_service(71:host => datastore['RHOST'],72:port => datastore['RPORT'],73:proto => 'tcp',74:name => "afp",75:info => "AFP name: #{response[:utf8_server_name]}, Versions: #{response[:versions].join(', ')}"76)7778end7980def format_flags_report(parsed_flags)81report = ''82parsed_flags.each do |flag, val|83report << "AFP #{rhost}:#{rport} * #{flag}: #{val.to_s} \n"84end85return report86end8788def format_addresses_report(parsed_network_addresses)89report = ''90parsed_network_addresses.each do |val|91report << "AFP #{rhost}:#{rport} * #{val.to_s} \n"92end93return report94end95end969798