diff --git a/lib/browser.rb b/lib/browser.rb index dd2b8982..9daae9b7 100644 --- a/lib/browser.rb +++ b/lib/browser.rb @@ -18,7 +18,7 @@ class Browser @@instance = nil - @@user_agent_modes = %w{ static semi-static random } + USER_AGENT_MODES = %w{ static semi-static random } ACCESSOR_OPTIONS = [ :user_agent, @@ -69,7 +69,7 @@ class Browser def user_agent_mode=(ua_mode) ua_mode ||= "static" - if @@user_agent_modes.include?(ua_mode) + if USER_AGENT_MODES.include?(ua_mode) @user_agent_mode = ua_mode # For semi-static user agent mode, the user agent has to be nil the first time (it will be set with the getter) @user_agent = nil if ua_mode === "semi-static" diff --git a/spec/lib/browser_spec.rb b/spec/lib/browser_spec.rb index 829ea061..adc7724c 100644 --- a/spec/lib/browser_spec.rb +++ b/spec/lib/browser_spec.rb @@ -42,7 +42,7 @@ describe Browser do describe "#user_agent_mode setter / getter" do # Testing all valid modes - Browser.class_variable_get(:@@user_agent_modes).each do |user_agent_mode| + Browser::USER_AGENT_MODES.each do |user_agent_mode| it "should set / return #{user_agent_mode}" do @browser.user_agent_mode = user_agent_mode @browser.user_agent_mode.should === user_agent_mode diff --git a/spec/lib/wpscan/modules/wp_timthumbs_spec.rb b/spec/lib/wpscan/modules/wp_timthumbs_spec.rb index 9a1cdff1..cbfc47eb 100644 --- a/spec/lib/wpscan/modules/wp_timthumbs_spec.rb +++ b/spec/lib/wpscan/modules/wp_timthumbs_spec.rb @@ -81,6 +81,12 @@ shared_examples_for "WpTimthumbs" do @module.has_timthumbs?(nil, @options).should be_false end + it "should return an array with 7 elements (from passive detection)" do + stub_request(:get, %r{http://example\.localhost/wp-content/themes/my-theme/.*}).to_return(:status => 200) + timthumbs = @module.timthumbs("my-theme", @options) + timthumbs.length.should == 7 + end + it "should return an array with 2 timthumbs url" do expected = [] urls = []