Class: WPScan::DB::DynamicFinders::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/wpscan/db/dynamic_finders/base.rb

Direct Known Subclasses

Plugin, Wordpress

Class Method Summary collapse

Class Method Details

.all_df_dataHash

Returns:

  • (Hash)


13
14
15
# File 'lib/wpscan/db/dynamic_finders/base.rb', line 13

def self.all_df_data
  @all_df_data ||= YAML.safe_load(File.read(df_file), [Regexp])
end

.allowed_classesArray<Symbol>

Returns:

  • (Array<Symbol>)


18
19
20
21
22
# File 'lib/wpscan/db/dynamic_finders/base.rb', line 18

def self.allowed_classes
  # The Readme is not put in there as it's not a Real DF, but rather using the DF system
  # to get the list of potential filenames for a given slug
  @allowed_classes ||= %i[Comment Xpath HeaderPattern BodyPattern JavascriptVar QueryParameter ConfigParser]
end

.df_fileString

Returns:

  • (String)


8
9
10
# File 'lib/wpscan/db/dynamic_finders/base.rb', line 8

def self.df_file
  @df_file ||= DB_DIR.join('dynamic_finders.yml').to_s
end

.method_missing(sym) ⇒ Object

Parameters:

  • sym (Symbol)


25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/wpscan/db/dynamic_finders/base.rb', line 25

def self.method_missing(sym)
  super unless sym =~ /\A(passive|aggressive)_(.*)_finder_configs\z/i

  finder_class = Regexp.last_match[2].camelize.to_sym

  raise "#{finder_class} is not allowed as a Dynamic Finder" unless allowed_classes.include?(finder_class)

  finder_configs(
    finder_class,
    Regexp.last_match[1] == 'aggressive'
  )
end

.respond_to_missing?(sym, *_args) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/wpscan/db/dynamic_finders/base.rb', line 38

def self.respond_to_missing?(sym, *_args)
  sym =~ /\A(passive|aggressive)_(.*)_finder_configs\z/i
end