Skip to content

Commit f3a2d66

Browse files
committed
Fix rapid7#4616 and Fix rapid7#3798 - Correctly use OptRegexp
This patch fixes a problem with OptRegexp. The OptRegexp class is always forcing the value to be converted to a string first, which causes the EXCLUDE option in browser_autopwn to kick in and match every found autopwn module, so it ignores all of them and you load nothing (rapid7#4616). It is important to understand that nil actually represents an option not being set, which is a completely different behavior than having an empty value (technically "" is still a value, and if there's a value, it means the option is set). We need to watcher for these scenarios. I am restoring the #default method to avoid forcing a to_s, which should fix the browser autopwn loading problem. And then I changed scraper.rb's default value for datastore option PATTERN to a string, because still fixes rapid7#3798. The way I see it, rapid7#3798 is actually a module-specific issue. Fix rapid7#4616 Fix rapid7#3798
1 parent 01bcd72 commit f3a2d66

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/msf/core/option_container.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def normalize(value)
528528
end
529529

530530
def default
531-
@default.to_s
531+
@default
532532
end
533533

534534
def display_value(value)

modules/auxiliary/scanner/http/scraper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def initialize
2727
register_options(
2828
[
2929
OptString.new('PATH', [ true, "The test path to the page to analize", '/']),
30-
OptRegexp.new('PATTERN', [ true, "The regex to use (default regex is a sample to grab page title)", %r{<title>(.*)</title>}i])
30+
OptRegexp.new('PATTERN', [ true, "The regex to use (default regex is a sample to grab page title)", '<title>(.*)</title>'])
3131

3232
], self.class)
3333

0 commit comments

Comments
 (0)