|
4 | 4 | ##
|
5 | 5 |
|
6 | 6 | # ideas:
|
7 |
| -# - add a loading page option so the user can specify arbitrary html to |
8 |
| -# insert all of the evil js and iframes into |
9 |
| -# - caching is busted when different browsers come from the same IP |
| 7 | +# - add a loading page option so the user can specify arbitrary html to |
| 8 | +# insert all of the evil js and iframes into |
| 9 | +# - caching is busted when different browsers come from the same IP |
10 | 10 |
|
11 | 11 | require 'msf/core'
|
12 | 12 | require 'rex/exploitation/js/detect'
|
@@ -69,10 +69,10 @@ def initialize(info = {})
|
69 | 69 | register_advanced_options([
|
70 | 70 | OptString.new('AutoRunScript', [false, "A script to automatically on session creation.", '']),
|
71 | 71 | OptBool.new('AutoSystemInfo', [true, "Automatically capture system information on initialization.", true]),
|
72 |
| - OptString.new('MATCH', [false, |
| 72 | + OptRegexp.new('MATCH', [false, |
73 | 73 | 'Only attempt to use exploits whose name matches this regex'
|
74 | 74 | ]),
|
75 |
| - OptString.new('EXCLUDE', [false, |
| 75 | + OptRegexp.new('EXCLUDE', [false, |
76 | 76 | 'Only attempt to use exploits whose name DOES NOT match this regex'
|
77 | 77 | ]),
|
78 | 78 | OptBool.new('DEBUG', [false,
|
@@ -825,10 +825,12 @@ def build_script_response(cli, request)
|
825 | 825 | # Yields each module that exports autopwn_info, filtering on MATCH and EXCLUDE options
|
826 | 826 | #
|
827 | 827 | def each_autopwn_module(&block)
|
828 |
| - m_regex = datastore["MATCH"] ? %r{#{datastore["MATCH"]}} : %r{} |
829 |
| - e_regex = datastore["EXCLUDE"] ? %r{#{datastore["EXCLUDE"]}} : %r{^$} |
| 828 | + m_regex = datastore["MATCH"] |
| 829 | + e_regex = datastore["EXCLUDE"] |
830 | 830 | framework.exploits.each_module do |name, mod|
|
831 |
| - if (mod.respond_to?("autopwn_opts") and name =~ m_regex and name !~ e_regex) |
| 831 | + if mod.respond_to?("autopwn_opts") and |
| 832 | + (m_regex.blank? or name =~ m_regex) and |
| 833 | + (e_regex.blank? or name !~ e_regex) |
832 | 834 | yield name, mod
|
833 | 835 | end
|
834 | 836 | end
|
|
0 commit comments