Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XDG Support for wpscan db #1815

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/wpscan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ module WPScan
include CMSScanner

APP_DIR = Pathname.new(__FILE__).dirname.join('..', 'app').expand_path
DB_DIR = Pathname.new(Dir.home).join('.wpscan', 'db')

# XDG support for DB_DIR
# If the legacy path exists, it will be used
# Otherwise, we'll use XDG_CACHE_HOME/wpscan/db or ~/.cache/wpscan/db if XDG_CACHE_HOME is not set
legacy_path = Pathname.new(Dir.home).join('.wpscan', 'db')
xdg_path = Pathname.new(ENV['XDG_CACHE_HOME'] || Pathname.new(Dir.home).join('.cache')).join('wpscan', 'db')
DB_DIR = if legacy_path.exist?
legacy_path
else
xdg_path
end

Typhoeus.on_complete do |response|
next if response.cached? || !response.from_vuln_api?
Expand Down