Uses the frozen_string_literal magic comment (will be the default in Ruby 3)

This commit is contained in:
erwanlr
2019-03-21 17:41:29 +00:00
parent 898e8d4546
commit 047a188b34
256 changed files with 512 additions and 5 deletions

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# Gems
# Believe it or not, active_support MUST be the first one,
# otherwise encoding issues can happen when using JSON format.

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
# Custom Browser
class Browser < CMSScanner::Browser

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
# Needed to load at least the Core controller
# Otherwise, the following error will be raised:

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
# Override to set the OptParser's summary width to 45 (instead of 40 from the CMSScanner)
class Controllers < CMSScanner::Controllers

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require_relative 'db/wp_item'
require_relative 'db/updater'
require_relative 'db/wp_items'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
module DynamicFinders

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
module DynamicFinders

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
module DynamicFinders

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
module DynamicFinders

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
# Fingerprints class

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
# Plugin DB

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
# WP Plugins

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
# Theme DB

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
# WP Themes

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
# Class used to perform DB updates

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
# WpItem - super DB class for Plugin, Theme and Version

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
# WP Items

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module DB
# WP Version

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Error
include CMSScanner::Error

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Error
# HTTP Error

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Error
# Error raised when there is a missing DB file and --no-update supplied

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Error
# WordPress hosted (*.wordpress.com)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Error
# XML-RPC Not Detected

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'wpscan/finders/finder/wp_version/smart_url_checker'
require 'wpscan/finders/dynamic_finder/finder'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
module DynamicFinder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
module Finders
class Finder

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
def read_json_file(file)
JSON.parse(File.read(file))
rescue StandardError => e

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
# References module (which should be included along with the CMSScanner::References)
# to allow the use of the wpvulndb reference

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'wpscan/target/platform/wordpress'
module WPScan

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
%w[custom_directories].each do |required|
require "wpscan/target/platform/wordpress/#{required}"
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
class Target < CMSScanner::Target
module Platform
@@ -111,9 +113,9 @@ module WPScan
return @uri.to_s unless path
if path =~ %r{wp\-content/plugins}i
path.gsub!('wp-content/plugins', plugins_dir)
path = +path.gsub('wp-content/plugins', plugins_dir)
elsif path =~ /wp\-content/i
path.gsub!('wp-content', content_dir)
path = +path.gsub('wp-content', content_dir)
elsif path[0] != '/' && sub_dir
path = "#{sub_dir}/#{path}"
end

View File

@@ -1,4 +1,6 @@
# frozen_string_literal: true
# Version
module WPScan
VERSION = '3.4.5'.freeze
VERSION = '3.4.5'
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
# Specific implementation
class Vulnerability < CMSScanner::Vulnerability

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WPScan
# Module to include in vulnerable WP item such as WpVersion.
# the vulnerabilities method should be implemented