From a981c2b17b420323d4318360ff3393ec3fb7eadb Mon Sep 17 00:00:00 2001 From: g0tmi1k Date: Tue, 22 May 2018 10:06:57 +0100 Subject: [PATCH] @FireFart's suggestions --- .dockerignore | 17 ++++++++++++++++- lib/common/common_helper.rb | 11 ++++------- lib/wpscan/web_site/sitemap.rb | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.dockerignore b/.dockerignore index f561920d..9db627ea 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,19 @@ bin/ dev/ spec/ *.md -Dockerfile \ No newline at end of file +Dockerfile + +## TEMP +.idea/ +.yardoc/ +bundle/ +cache/ +coverage/ +git/ +**/*.md +**/*.orig +*.orig +CREDITS +data.zip +DISCLAIMER.txt +example.conf.json diff --git a/lib/common/common_helper.rb b/lib/common/common_helper.rb index 30f48a64..5431ef2a 100644 --- a/lib/common/common_helper.rb +++ b/lib/common/common_helper.rb @@ -19,15 +19,12 @@ DATA_FILE = File.join(ROOT_DIR, 'data.zip') # wpscan/data.zip # WPScan Data files (data.zip) LAST_UPDATE_FILE = File.join(DATA_DIR, '.last_update') # ~/.wpscan/data/.last_update -LOCAL_FILES_FILE = File.join(DATA_DIR, 'local_vulnerable_files.xml') # ~/.wpscan/data/local_vulnerable_files.xml - Not ref ATM -LOCAL_FILES_XSD = File.join(DATA_DIR, 'local_vulnerable_files.xsd') # ~/.wpscan/data/local_vulnerable_files.xsd - Not ref ATM PLUGINS_FILE = File.join(DATA_DIR, 'plugins.json') # ~/.wpscan/data/plugins.json THEMES_FILE = File.join(DATA_DIR, 'themes.json') # ~/.wpscan/data/themes.json TIMTHUMBS_FILE = File.join(DATA_DIR, 'timthumbs.txt') # ~/.wpscan/data/timthumbs.txt USER_AGENTS_FILE = File.join(DATA_DIR, 'user-agents.txt') # ~/.wpscan/data/user-agents.txt WORDPRESSES_FILE = File.join(DATA_DIR, 'wordpresses.json') # ~/.wpscan/data/wordpresses.json WP_VERSIONS_FILE = File.join(DATA_DIR, 'wp_versions.xml') # ~/.wpscan/data/wp_versions.xml -WP_VERSIONS_XSD = File.join(DATA_DIR, 'wp_versions.xsd') # ~/.wpscan/data/wp_versions.xsd - Not ref ATM MIN_RUBY_VERSION = '2.1.9' @@ -89,20 +86,20 @@ end # Find data.zip? def has_db_zip? - return File.exist?(DATA_FILE)? true : false + return File.exist?(DATA_FILE) end # Extract data.zip def extract_db_zip + # Create data folder + FileUtils.mkdir_p(DATA_DIR) + Zip::File.open(DATA_FILE) do |zip_file| zip_file.each do |f| # Feedback to the user #puts "[+] Extracting: #{File.basename(f.name)}" f_path = File.join(DATA_DIR, File.basename(f.name)) - # Create folder - FileUtils.mkdir_p(File.dirname(f_path)) - # Delete if already there #puts "[+] Deleting: #{File.basename(f.name)}" if File.exist?(f_path) FileUtils.rm(f_path) if File.exist?(f_path) diff --git a/lib/wpscan/web_site/sitemap.rb b/lib/wpscan/web_site/sitemap.rb index bc3a3736..46140a03 100644 --- a/lib/wpscan/web_site/sitemap.rb +++ b/lib/wpscan/web_site/sitemap.rb @@ -18,7 +18,7 @@ class WebSite return false end - # Gets a robots.txt URL + # Get the robots.txt URL # @return [ String ] def sitemap_url @uri.clone.merge('robots.txt').to_s