From c0c14faad12557e7252a438e0ff4dc935509e358 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Sun, 23 Sep 2012 22:55:19 +0200 Subject: [PATCH] check if plugin directory exists and warn the user --- lib/wpscan/wp_target.rb | 4 ++++ wpscan.rb | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/wpscan/wp_target.rb b/lib/wpscan/wp_target.rb index 8e7ab549..934f588e 100644 --- a/lib/wpscan/wp_target.rb +++ b/lib/wpscan/wp_target.rb @@ -109,6 +109,10 @@ class WpTarget @wp_plugins_dir end + def wp_plugins_dir_exists? + Browser.instance.get(@uri.merge(wp_plugins_dir)).code != 404 + end + def has_debug_log? # We only get the first 700 bytes of the file to avoid loading huge file (like 2Go) response_body = Browser.instance.get(debug_log_url(), :headers => {"range" => "bytes=0-700"}).body diff --git a/wpscan.rb b/wpscan.rb index 6ebebfcb..4d7c6897 100755 --- a/wpscan.rb +++ b/wpscan.rb @@ -83,6 +83,15 @@ begin raise "The wp_content_dir has not been found, please supply it with --wp-content-dir" end + unless wp_target.wp_plugins_dir_exists? + puts "The plugins directory '#{wp_target.wp_plugins_dir}' does not exist." + puts "You can specify one per command line option (don't forget to include the wp-content directory if needed)" + puts "Continue? [y/n]" + unless Readline.readline =~ /^y/i + exit + end + end + # Output runtime data start_time = Time.now puts "| URL: #{wp_target.url}"