Skip to content

Commit 9373ab6

Browse files
author
RageLtMan
committed
HTTP Crawler: don't expect page object for msg
The `crawler_process_page` method in HttpCrawler assumes that the `page` object passed into the method is not nil when formatting the `msg` string for printing to console. Address the assumption with a ternary check leaving the `|| "ERR"` handling for `page.code` itself being nil inside the assignment when page is not nil. Testing: `Error accessing page undefined method '[]' for nil:NilClass` is no longer being thrown when scanning an odd HTTP service.
1 parent 47fcf54 commit 9373ab6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/msf/core/auxiliary/http_crawler.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def crawl_target(t)
243243
# Specific module implementations should redefine this method
244244
# with whatever is meaningful to them.
245245
def crawler_process_page(t, page, cnt)
246-
msg = "[#{"%.5d" % cnt}/#{"%.5d" % max_page_count}] #{page.code || "ERR"} - #{@current_site.vhost} - #{page.url}"
246+
msg = "[#{"%.5d" % cnt}/#{"%.5d" % max_page_count}] #{page ? page.code || "ERR" : "ERR"} - #{@current_site.vhost} - #{page.url}"
247247
case page.code
248248
when 301,302
249249
if page.headers and page.headers["location"]

0 commit comments

Comments
 (0)