Skip to content

Commit 99133de

Browse files
committed
Reran tests, sorted out strip problem
1 parent c25a5d3 commit 99133de

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

modules/auxiliary/scanner/http/title.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,18 @@ def run_host(target_host)
5151

5252
if !res.body.nil?
5353
# Very basic, just match the first title tag we come to.
54-
rx = %r{<title>[\n\t\s]*(?<title>.+?)[\s\n\t]*</title>}im.match(res.body.to_s.strip)
55-
if rx && rx[:title] != ''
56-
rx_title = CGI.unescapeHTML(rx[:title])
57-
print_status("[#{target_host}:#{rport}] [C:#{res.code}] [R:#{location_header}] [S:#{server_header}] #{rx_title}") if datastore['SHOW_TITLES'] == true
58-
if datastore['STORE_NOTES'] == true
59-
notedata = { code: res.code, port: rport, server: server_header, title: rx_title, redirect: location_header }
60-
report_note(host: target_host, type: "http.title", data: notedata)
54+
rx = %r{<title>[\n\t\s]*(?<title>.+?)[\s\n\t]*</title>}im.match(res.body.to_s)
55+
if rx
56+
rx[:title].strip!
57+
if rx[:title] != ''
58+
rx_title = CGI.unescapeHTML(rx[:title])
59+
print_status("[#{target_host}:#{rport}] [C:#{res.code}] [R:#{location_header}] [S:#{server_header}] #{rx_title}") if datastore['SHOW_TITLES'] == true
60+
if datastore['STORE_NOTES'] == true
61+
notedata = { code: res.code, port: rport, server: server_header, title: rx_title, redirect: location_header }
62+
report_note(host: target_host, type: "http.title", data: notedata)
63+
end
64+
else
65+
print_error("No webpage title from #{target_host}:#{rport}") if datastore['SHOW_ERRORS'] == true
6166
end
6267
else
6368
print_error("No webpage title from #{target_host}:#{rport}") if datastore['SHOW_ERRORS'] == true

0 commit comments

Comments
 (0)