Skip to content

Commit

Permalink
XDG Support for wpscan db
Browse files Browse the repository at this point in the history
  • Loading branch information
alichtman committed Nov 12, 2023
1 parent 96b6b81 commit baa7987
Showing 1 changed file with 11 additions and 1 deletion.
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

0 comments on commit baa7987

Please sign in to comment.