Skip to content

Commit

Permalink
Added --output-dir to ronin-recon run (closes #180).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Sep 6, 2024
1 parent 716d238 commit a6ba9ee
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/ronin/recon/cli/commands/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module Commands
# -I, --ignore VALUE The values to ignore in result
# -F txt|list|csv|json|ndjson|dot|svg|png|pdf,
# --output-format The output format
# --output-dir DIR Writes data to an output directory
# --import Imports each newly discovered value into the Ronin database
# -h, --help Print help information
#
Expand Down Expand Up @@ -153,6 +154,14 @@ class Run < Command
},
desc: 'The output format'

option :output_dir, value: {
type: String,
usage: 'DIR'
},
desc: 'Writes data to an output directory' do |path|
@outputs << [path, OutputFormats::Dir]
end

option :import, desc: 'Imports each newly discovered value into the Ronin database'

option :ignore, short: '-I',
Expand Down
3 changes: 3 additions & 0 deletions man/ronin-recon-run.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ Runs the recon engine with one or more initial values.
: The output format. If not specified, the output format will be inferred from
the `--output` *FILE* extension.

`--output-dir` *DIR*
: Writes the output to a directory of separate files for each value type.

`--import`
: Imports each newly discovered value into the Ronin database.

Expand Down
11 changes: 11 additions & 0 deletions spec/cli/commands/run_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@
end
end

context "when the '--output-dir' option is given" do
let(:path) { 'path/to/dir' }
let(:argv) { ['--output-dir', path] }

it "must add the output directory path to #outputs" do
expect(subject.outputs).to eq([
[path, Ronin::Recon::OutputFormats::Dir]
])
end
end

context "when the '--ignore' option is given" do
let(:value1) { Ronin::Recon::Values::Host.new('staging.example.com') }
let(:value2) { Ronin::Recon::Values::Host.new('dev.example.com') }
Expand Down

0 comments on commit a6ba9ee

Please sign in to comment.