Class: WPScan::Finders::DynamicFinder::Finder
- Inherits:
-
CMSScanner::Finders::Finder
- Object
- CMSScanner::Finders::Finder
- WPScan::Finders::DynamicFinder::Finder
- Defined in:
- lib/wpscan/finders/dynamic_finder/finder.rb
Overview
To be used as a base when creating a dynamic finder
Direct Known Subclasses
Class Method Summary collapse
- .child_class_constant(*args) ⇒ Object
-
.child_class_constants ⇒ Hash
Needed to have inheritance of the @child_class_constants If inheritance is not needed, then the #child_class_constant can be used in the classe definition, ie child_class_constant :FILES, PATTERN: /aaa/i.
- .create_child_class(mod, klass, config) ⇒ Object
Instance Method Summary collapse
- #aggressive(opts = {}) ⇒ Object
-
#find(_response, _opts = {}) ⇒ Mixed
This method has to be overriden in child classes.
- #passive(opts = {}) ⇒ Object
Class Method Details
.child_class_constant(*args) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/wpscan/finders/dynamic_finder/finder.rb', line 7 def self.child_class_constant(*args) args.each do |arg| if arg.is_a?(Hash) child_class_constants.merge!(arg) else child_class_constants[arg] = nil end end end |
.child_class_constants ⇒ Hash
Needed to have inheritance of the @child_class_constants If inheritance is not needed, then the #child_class_constant can be used in the classe definition, ie
child_class_constant :FILES, PATTERN: /aaa/i
21 22 23 |
# File 'lib/wpscan/finders/dynamic_finder/finder.rb', line 21 def self.child_class_constants @child_class_constants ||= { PATH: nil } end |
.create_child_class(mod, klass, config) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/wpscan/finders/dynamic_finder/finder.rb', line 28 def self.create_child_class(mod, klass, config) # Can't use the #child_class_constants directly in the Class.new(self) do; end below class_constants = child_class_constants mod.const_set( klass, Class.new(self) do class_constants.each do |key, value| const_set(key, config[key.downcase.to_s] || value) end end ) end |
Instance Method Details
#aggressive(opts = {}) ⇒ Object
58 59 60 61 62 |
# File 'lib/wpscan/finders/dynamic_finder/finder.rb', line 58 def aggressive(opts = {}) return unless self.class::PATH find(Browser.get(target.url(self.class::PATH)), opts) end |
#find(_response, _opts = {}) ⇒ Mixed
This method has to be overriden in child classes
46 47 48 |
# File 'lib/wpscan/finders/dynamic_finder/finder.rb', line 46 def find(_response, _opts = {}) raise NoMethodError end |
#passive(opts = {}) ⇒ Object
51 52 53 54 55 |
# File 'lib/wpscan/finders/dynamic_finder/finder.rb', line 51 def passive(opts = {}) return if self.class::PATH find(target.homepage_res, opts) end |