Fix #77 facebook.com detected as a custom wp-content directory
This commit is contained in:
@@ -97,7 +97,8 @@ class WpTarget
|
||||
if index_body[/\/wp-content\/(?:themes|plugins)\//i]
|
||||
@wp_content_dir = "wp-content"
|
||||
else
|
||||
@wp_content_dir = index_body[/(?:href|src)\s*=\s*(?:"|').+#{Regexp.escape(uri_path)}([^"']+)\/(?:themes|plugins)\/.*(?:"|')/i, 1]
|
||||
domains_excluded = "(?:www\.)?(facebook|twitter)\.com"
|
||||
@wp_content_dir = index_body[/(?:href|src)\s*=\s*(?:"|').+#{Regexp.escape(uri_path)}((?!#{domains_excluded})[^"']+)\/(?:themes|plugins)\/.*(?:"|')/i, 1]
|
||||
end
|
||||
end
|
||||
@wp_content_dir
|
||||
|
||||
11
spec/fixtures/wpscan/wp_target/wp_content_dir/facebook-detection.htm
vendored
Executable file
11
spec/fixtures/wpscan/wp_target/wp_content_dir/facebook-detection.htm
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head profile="http://gmpg.org/xfn/11">
|
||||
<link rel="stylesheet" href="/template/css/prey.base.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript" src="/template/js/prey.public.js"></script>
|
||||
</head>
|
||||
<body id="home">
|
||||
<iframe src="//www.facebook.com/plugins/like.php?href=lamp.localhost&send=false&layout=box_count&width=100&show_faces=false&action=recommend&colorscheme=light&font&height=90" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:62px;" allowTransparency="true"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
@@ -107,6 +107,7 @@ describe WpTarget do
|
||||
@expected = "hello-world"
|
||||
end
|
||||
|
||||
|
||||
it "should return 'wp-content'" do
|
||||
@target_url = "http://lamp/wordpress-3.4.1"
|
||||
@fixture = fixtures_dir + "/wordpress-3.4.1.htm"
|
||||
@@ -155,6 +156,11 @@ describe WpTarget do
|
||||
@expected = "wp-content"
|
||||
end
|
||||
|
||||
it "should not detect facebook.com as a custom wp-content directory" do
|
||||
@target_url = "http://lamp.localhost/"
|
||||
@fixture = fixtures_dir + "/facebook-detection.htm"
|
||||
@expected = nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "#wp_plugins_dir" do
|
||||
|
||||
Reference in New Issue
Block a user