Update sip note format, small tweaks to output, service.info

This commit is contained in:
HD Moore 2014-08-26 16:42:00 -05:00
parent ba1f7c3bf6
commit 2d2606aeaf
1 changed files with 37 additions and 23 deletions

View File

@ -16,38 +16,52 @@ module Msf
return false
end
# We know it is SIP, so report
report_service(
host: rhost,
port: rport,
proto: proto.downcase,
name: 'sip'
)
# Do header extraction as necessary
extracted_headers = {}
unless desired_headers.nil? || desired_headers.empty?
desired_headers.each do |desired_header|
next unless (found_header = options_response.header(desired_header))
extracted_headers[desired_header] ||= []
extracted_headers[desired_header] |= found_header
end
# report on any extracted headers
extracted_headers.each do |k, v|
report_note(
host: rhost,
port: rport,
proto: proto.downcase,
type: "sip_header.#{k.gsub(/-/, '_').downcase}",
data: v.join(',')
)
extracted_headers[desired_header] |= found_header
end
end
status = "#{endpoint} #{options_response.status_line}"
status += ": #{extracted_headers}" unless extracted_headers.empty?
print_status(status)
# Create a SIP OPTIONS fingerprint hash
fprint = {
'code' => options_response.code,
'message' => options_response.message
}
extracted_headers.each_pair do |k,v|
fprint['header_' + k.gsub('-', '_').downcase] = v.join(',')
end
# Create a summary of the response
status = options_response.status_line.dup
unless extracted_headers.keys.length == 0
status << ": #{extracted_headers}"
end
# Report the service with the status information
report_service(
host: rhost,
port: rport,
proto: proto.downcase,
name: 'sip',
info: status
)
# Report the fingerprint information
report_note(
host: rhost,
port: rport,
proto: proto.downcase,
type: "sip.options.fingerprint",
data: fprint
)
# Display the actual result to the user
print_status(endpoint + " " + status)
true
end