Class: Pentest::Runner
- Inherits:
-
Object
- Object
- Pentest::Runner
- Defined in:
- lib/pentest/runner.rb
Instance Method Summary collapse
-
#initialize(app_path, hooks) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(app_path, hooks) ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 9 10 11 |
# File 'lib/pentest/runner.rb', line 5 def initialize(app_path, hooks) @app_path = app_path @hooks = hooks @routes = ::Rails.application.routes.routes @ingredients = Set.new end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/pentest/runner.rb', line 13 def run @endpoints = @routes.map do |route| endpoint = Endpoint.new(route, @app_path, @hooks) end.select(&:valid?) Logger.debug "Fetched #{@endpoints.size} endpoints" Logger.print_seperator @hooks[:setups].each do |setup_proc| self.instance_eval &setup_proc end # TODO: Add ingredients when not enough Logger.debug "Registered Ingredients: #{@ingredients.to_a.inspect}" payloads = [] @endpoints.each do |endpoint| payloads += endpoint.scan!(@ingredients.to_a) Logger.print_seperator end if payloads.empty? Logger.info 'No vulnerabilities found' return nil end Logger.error "#{payloads.size} vulnerabilities found!!" payloads.each_with_index do |payload, index| puts '' puts '' puts payload.to_s(index) end puts '' :error end |