Fix #4616 and Fix #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 (#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 #3798. The way I see it, #3798 is actually a module-specific issue.

Fix #4616
Fix #3798
bug/bundler_fix
sinn3r 2015-01-23 02:38:26 -06:00
parent 01bcd72e1c
commit f3a2d6663f
2 changed files with 2 additions and 2 deletions

View File

@ -528,7 +528,7 @@ class OptRegexp < OptBase
end end
def default def default
@default.to_s @default
end end
def display_value(value) def display_value(value)

View File

@ -27,7 +27,7 @@ class Metasploit3 < Msf::Auxiliary
register_options( register_options(
[ [
OptString.new('PATH', [ true, "The test path to the page to analize", '/']), OptString.new('PATH', [ true, "The test path to the page to analize", '/']),
OptRegexp.new('PATTERN', [ true, "The regex to use (default regex is a sample to grab page title)", %r{<title>(.*)</title>}i]) OptRegexp.new('PATTERN', [ true, "The regex to use (default regex is a sample to grab page title)", '<title>(.*)</title>'])
], self.class) ], self.class)