Class: Workers::Recon
- Inherits:
-
Object
- Object
- Workers::Recon
- Includes:
- Sidekiq::Worker
- Defined in:
- workers/recon.rb
Overview
ronin-recon run
worker.
Constant Summary collapse
- Params =
The accepted JSON params which will be passed to #perform.
Dry::Schema::JSON() do required(:scope).array(:string).each(:filled?) optional(:ignore).maybe(:array) optional(:max_depth).maybe(:integer) end
Instance Method Summary collapse
-
#perform(params) ⇒ Object
Processes a
recon
job. -
#validate(params) ⇒ Hash{Symbol => Object}
Validates the given job params.
Instance Method Details
#perform(params) ⇒ Object
Processes a recon
job.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'workers/recon.rb', line 54 def perform(params) kwargs = validate(params) values = kwargs[:scope].map(&Ronin::Recon::Value.method(:parse)) ignore = if (ignore_kwargs = kwargs[:ignore]) ignore_kwargs.map(&Ronin::Recon::Value.method(:parse)) else [] end Ronin::Recon::Engine.run(values, ignore: ignore, max_depth: kwargs[:max_depth]) do |engine| engine.on(:value) do |value,parent| Ronin::Recon::Importer.import_value(value) end end end |
#validate(params) ⇒ Hash{Symbol => Object}
Validates the given job params.
84 85 86 87 88 89 90 91 92 |
# File 'workers/recon.rb', line 84 def validate(params) result = Params.call(params) if result.failure? raise(ArgumentError,"invalid recon params (#{params.inspect}): #{result.errors.inspect}") end return result.to_h end |