Cleanup AFP module output

unstable
HD Moore 2012-07-16 21:01:52 -05:00
parent 926fd0c6e8
commit bc2edeace2
2 changed files with 26 additions and 20 deletions

View File

@ -84,7 +84,7 @@ module Exploit::Remote::AFP
start = Time.now
response = sock.timed_read(1024, datastore['LoginTimeOut'])
rescue Timeout::Error
vprint_error("Login timeout (AFP server delay response for 20 - 22 seconds after 7 incorrect logins)")
vprint_error("AFP #{rhost}:#{rport} Login timeout (AFP server delay response for 20 - 22 seconds after 7 incorrect logins)")
return :connection_error
end
@ -95,7 +95,7 @@ module Exploit::Remote::AFP
return parse_login_response_add_send_login_count(response, {:p => p, :g => g, :ra => ra, :ma => ma,
:password => pass, :user => user})
when -5023 #kFPUserNotAuth (User dosen't exists)
print_status("User #{user} dosen't exists")
print_status("AFP #{rhost}:#{rport} User #{user} dosen't exists")
return :skip_user
else
return :connection_error
@ -132,7 +132,7 @@ module Exploit::Remote::AFP
begin
response = sock.timed_read(1024, datastore['LoginTimeOut'])
rescue Timeout::Error
vprint_error("Login timeout (AFP server delay response for 20 - 22 seconds after 7 incorrect logins)")
vprint_error("AFP #{rhost}:#{rport} Login timeout (AFP server delay response for 20 - 22 seconds after 7 incorrect logins)")
return :connection_error
end
@ -190,7 +190,7 @@ module Exploit::Remote::AFP
begin
response = sock.timed_read(1024, datastore['LoginTimeOut'])
rescue Timeout::Error
vprint_error("Login timeout (AFP server delay response for 20 - 22 seconds after 7 incorrect logins)")
vprint_error("AFP #{rhost}:#{rport} Login timeout (AFP server delay response for 20 - 22 seconds after 7 incorrect logins)")
return :connection_error
end
@ -211,7 +211,7 @@ module Exploit::Remote::AFP
parsed_data = {}
flags, command, request_id, error_code, length, reserved = parse_header(response)
raise "Server response with error" if error_code != 0
raise "AFP #{rhost}:#{rport} Server response with error" if error_code != 0
body = get_body(response, length)
machine_type_offset, afp_versions_offset, uam_count_offset, icon_offset, server_flags =
body.unpack('nnnnn')
@ -253,7 +253,7 @@ module Exploit::Remote::AFP
def get_body(packet, body_length)
body = packet[16..body_length + 15]
raise "Invalid body length" if body.length != body_length
raise "AFP #{rhost}:#{rport} Invalid body length" if body.length != body_length
return body
end
@ -301,7 +301,7 @@ module Exploit::Remote::AFP
when 7 # IPv6 address (16 bytes) followed by a two-byte port number
parsed_addreses << "[#{IPAddr.ntop(address[1..16])}]:#{address[17..18].unpack("n").first}"
else # Something wrong?
raise "Error pasing network addresses"
raise "Error parsing network addresses"
end
end
return parsed_addreses

View File

@ -33,7 +33,7 @@ class Metasploit3 < Msf::Auxiliary
end
def run_host(ip)
print_status("Scanning IP: #{ip.to_s}")
print_status("AFP #{ip} Scanning...")
begin
connect
response = get_info
@ -44,24 +44,30 @@ class Metasploit3 < Msf::Auxiliary
rescue ::Rex::ConnectionError, ::IOError, ::Errno::ECONNRESET, ::Errno::ENOPROTOOPT
rescue ::Exception
raise $!
print_error("#{rhost}:#{rport} #{$!.class} #{$!}")
print_error("AFP #{rhost}:#{rport} #{$!.class} #{$!}")
ensure
disconnect
end
end
def report(response)
report_info = "Server Name: #{response[:server_name]} \n" +
" Server Flags: \n" +
report_info = "AFP #{rhost}:#{rport} Server Name: #{response[:server_name]} \n" +
"AFP #{rhost}:#{rport} 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" +
" Server Network Address: \n" +
"AFP #{rhost}:#{rport} Machine Type: #{response[:machine_type]} \n" +
"AFP #{rhost}:#{rport} AFP Versions: #{response[:versions].join(', ')} \n" +
"AFP #{rhost}:#{rport} UAMs: #{response[:uams].join(', ')}\n" +
"AFP #{rhost}:#{rport} Server Signature: #{response[:signature]}\n" +
"AFP #{rhost}:#{rport} Server Network Address: \n" +
format_addresses_report(response[:network_addresses]) +
" UTF8 Server Name: #{response[:utf8_server_name]}"
print_status("#{rhost}:#{rport} APF:\n #{report_info}")
"AFP #{rhost}:#{rport} UTF8 Server Name: #{response[:utf8_server_name]}"
lines = "AFP #{rhost}:#{rport}:#{rport} AFP:\n#{report_info}"
lines.split(/\n/).each do |line|
print_status(line)
end
report_note(:host => datastore['RHOST'],
:proto => 'tcp',
@ -82,7 +88,7 @@ class Metasploit3 < Msf::Auxiliary
def format_flags_report(parsed_flags)
report = ''
parsed_flags.each do |flag, val|
report << " * #{flag}: #{val.to_s} \n"
report << "AFP #{rhost}:#{rport} * #{flag}: #{val.to_s} \n"
end
return report
end
@ -90,7 +96,7 @@ class Metasploit3 < Msf::Auxiliary
def format_addresses_report(parsed_network_addresses)
report = ''
parsed_network_addresses.each do |val|
report << " * #{val.to_s} \n"
report << "AFP #{rhost}:#{rport} * #{val.to_s} \n"
end
return report
end