diff --git a/data/wp_versions.xml b/data/wp_versions.xml index 7d9f1993..b58eb9a1 100644 --- a/data/wp_versions.xml +++ b/data/wp_versions.xml @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . ryandewhurst at gmail - +--> + + + + + + 1 + 3.2.1 + + + + 1 + 3.2 + + + diff --git a/spec/lib/wpscan/wp_version_spec.rb b/spec/lib/wpscan/wp_version_spec.rb index 1d987c16..df872d93 100644 --- a/spec/lib/wpscan/wp_version_spec.rb +++ b/spec/lib/wpscan/wp_version_spec.rb @@ -138,4 +138,42 @@ describe WpVersion do end end + describe "#find_from_advanced_fingerprinting" do + let(:fixtures_dir) { SPEC_FIXTURES_WPSCAN_WP_VERSION_DIR + '/advanced' } + + it "should return 3.2.1" do + stub_request_to_fixture(:url => @target_uri.merge("wp-admin/js/wp-fullscreen.js").to_s, + :status => 200, + :fixture => "#{fixtures_dir}/3.2.1.js") + version = WpVersion.find_from_advanced_fingerprinting(:url => @target_uri, + :wp_content_dir => "wp-content", + :version_xml => "#{fixtures_dir}/wp_versions.xml") + version.should == "3.2.1" + end + end + + describe "#initialize" do + it "should initialize a WpVersion object" do + v = WpVersion.new(1, { :discovery_method => "method", :vulns_xml => "asdf.xml" }) + v.number.should == 1 + v.discovery_method.should == "method" + end + end + + describe "#find" do + let(:fixtures_dir) { SPEC_FIXTURES_WPSCAN_WP_VERSION_DIR + '/advanced' } + + it "should find all versions" do + # All requests get a HTTP 404 + stub_request(:any, /.*/).to_return(:status => 404) + # Wordpress Version 3.2.1 + stub_request_to_fixture(:url => @target_uri.merge("wp-admin/js/wp-fullscreen.js").to_s, + :status => 200, + :fixture => "#{fixtures_dir}/3.2.1.js") + version = WpVersion.find(@target_uri, "wp-content") + version.number.should == "3.2.1" + version.discovery_method.should == "advanced fingerprinting" + end + end + end