Skip to content

Commit 2d2606a

Browse files
author
HD Moore
committed
Update sip note format, small tweaks to output, service.info
1 parent ba1f7c3 commit 2d2606a

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed

lib/msf/core/exploit/sip.rb

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,52 @@ def report_response(response, rhost, proto, desired_headers = %w(User-Agent Serv
1616
return false
1717
end
1818

19-
# We know it is SIP, so report
20-
report_service(
21-
host: rhost,
22-
port: rport,
23-
proto: proto.downcase,
24-
name: 'sip'
25-
)
26-
2719
# Do header extraction as necessary
2820
extracted_headers = {}
2921
unless desired_headers.nil? || desired_headers.empty?
3022
desired_headers.each do |desired_header|
3123
next unless (found_header = options_response.header(desired_header))
3224
extracted_headers[desired_header] ||= []
33-
extracted_headers[desired_header] |= found_header
25+
extracted_headers[desired_header] |= found_header
3426
end
27+
end
3528

36-
# report on any extracted headers
37-
extracted_headers.each do |k, v|
38-
report_note(
39-
host: rhost,
40-
port: rport,
41-
proto: proto.downcase,
42-
type: "sip_header.#{k.gsub(/-/, '_').downcase}",
43-
data: v.join(',')
44-
)
45-
end
29+
# Create a SIP OPTIONS fingerprint hash
30+
fprint = {
31+
'code' => options_response.code,
32+
'message' => options_response.message
33+
}
34+
35+
extracted_headers.each_pair do |k,v|
36+
fprint['header_' + k.gsub('-', '_').downcase] = v.join(',')
37+
end
38+
39+
# Create a summary of the response
40+
status = options_response.status_line.dup
41+
unless extracted_headers.keys.length == 0
42+
status << ": #{extracted_headers}"
4643
end
4744

48-
status = "#{endpoint} #{options_response.status_line}"
49-
status += ": #{extracted_headers}" unless extracted_headers.empty?
50-
print_status(status)
45+
# Report the service with the status information
46+
report_service(
47+
host: rhost,
48+
port: rport,
49+
proto: proto.downcase,
50+
name: 'sip',
51+
info: status
52+
)
53+
54+
# Report the fingerprint information
55+
report_note(
56+
host: rhost,
57+
port: rport,
58+
proto: proto.downcase,
59+
type: "sip.options.fingerprint",
60+
data: fprint
61+
)
62+
63+
# Display the actual result to the user
64+
print_status(endpoint + " " + status)
5165
true
5266
end
5367

0 commit comments

Comments
 (0)