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

.allowed_classesArray<Symbol>

Returns:

  • (Array<Symbol>)


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

def self.allowed_classes
  @allowed_classes ||= i[Comment Xpath HeaderPattern BodyPattern JavascriptVar QueryParameter ConfigParser]
end

.db_dataHash

Returns:

  • (Hash)


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

def self.db_data
  # true allows aliases to be loaded
  @db_data ||= YAML.safe_load(File.read(db_file), [Regexp], [], true)
end

.db_fileString

Returns:

  • (String)


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

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

.method_missing(sym) ⇒ Object

Parameters:

  • sym (Symbol)


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

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)


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

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