Skip to content

Commit 40c71d3

Browse files
committed
Added the ronin-recon config command (closes #178).
1 parent 33a5d69 commit 40c71d3

25 files changed

+1571
-1
lines changed

Diff for: README.md

+19
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Arguments:
7474
7575
Commands:
7676
completion
77+
config
7778
help
7879
irb
7980
new
@@ -215,6 +216,24 @@ Save the recon results to a PDF image:
215216
$ ronin-recon run -o output.pdf example.com
216217
```
217218

219+
Enable an optional worker by default:
220+
221+
```shell
222+
$ ronin-recon config enable api/hunter_io
223+
```
224+
225+
Set the default concurrency for a worker:
226+
227+
```shell
228+
$ ronin-recon config set --concurrency web/spider=4
229+
```
230+
231+
Set the API key for a worker:
232+
233+
```shell
234+
$ ronin-recon config set --param api/hunter_io.api_key=...
235+
```
236+
218237
Generate a boilerplate recon worker file, with some custom information:
219238

220239
```shell

Diff for: gemspec.yml

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ generated_files:
2727
- data/completions/ronin-recon
2828
- man/ronin-recon.1
2929
- man/ronin-recon-completion.1
30+
- man/ronin-recon-config.1
31+
- man/ronin-recon-config-disable.1
32+
- man/ronin-recon-config-enable.1
33+
- man/ronin-recon-config-get.1
34+
- man/ronin-recon-config-list.1
35+
- man/ronin-recon-config-set.1
36+
- man/ronin-recon-config-unset.1
3037
- man/ronin-recon-irb.1
3138
- man/ronin-recon-new.1
3239
- man/ronin-recon-workers.1

Diff for: lib/ronin/recon/cli/commands/config.rb

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# frozen_string_literal: true
2+
#
3+
# ronin-recon - A micro-framework and tool for performing reconnaissance.
4+
#
5+
# Copyright (c) 2023-2024 Hal Brodigan ([email protected])
6+
#
7+
# ronin-recon is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU Lesser General Public License as published
9+
# by the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# ronin-recon is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU Lesser General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser General Public License
18+
# along with ronin-recon. If not, see <https://www.gnu.org/licenses/>.
19+
#
20+
21+
require_relative '../command'
22+
23+
require 'command_kit/commands/auto_load'
24+
25+
module Ronin
26+
module Recon
27+
class CLI
28+
module Commands
29+
#
30+
# Get and set ronin-recon configuration.
31+
#
32+
# ## Usage
33+
#
34+
# ronin-recon config [options] [COMMAND [ARGS...]]
35+
#
36+
# ## Options
37+
#
38+
# -h, --help Print help information
39+
#
40+
# ## Arguments
41+
#
42+
# [COMMAND] The command name to run
43+
# [ARGS ...] Additional arguments for the command
44+
#
45+
# ## Commands
46+
#
47+
# disable
48+
# enable
49+
# get
50+
# help
51+
# list
52+
# set
53+
# unset
54+
#
55+
# ## Examples
56+
#
57+
# ronin-recon config list
58+
# ronin-recon config enable api/hunter_io
59+
# ronin-recon config disable api/hunter_io
60+
# ronin-recon config set --param api/hunter_io.api_key=...
61+
# ronin-recon config set --concurrency web/spider=10
62+
# ronin-recon config unset --param web/spider.proxy
63+
# ronin-recon config unset --concurrency web/spider
64+
#
65+
# @since 0.2.0
66+
#
67+
class Config < Command
68+
69+
include CommandKit::Commands::AutoLoad.new(
70+
dir: "#{__dir__}/config",
71+
namespace: "#{self}"
72+
)
73+
74+
examples [
75+
'list',
76+
'enable api/hunter_io',
77+
'disable api/hunter_io',
78+
'set --param api/hunter_io.api_key=...',
79+
'set --concurrency web/spider=10',
80+
'unset --param web/spider.proxy',
81+
'unset --concurrency web/spider'
82+
]
83+
84+
description 'Get and set ronin-recon configuration'
85+
86+
man_page 'ronin-recon-config.1'
87+
88+
end
89+
end
90+
end
91+
end
92+
end

Diff for: lib/ronin/recon/cli/commands/config/disable.rb

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# frozen_string_literal: true
2+
#
3+
# ronin-recon - A micro-framework and tool for performing reconnaissance.
4+
#
5+
# Copyright (c) 2023-2024 Hal Brodigan ([email protected])
6+
#
7+
# ronin-recon is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU Lesser General Public License as published
9+
# by the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# ronin-recon is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU Lesser General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser General Public License
18+
# along with ronin-recon. If not, see <https://www.gnu.org/licenses/>.
19+
#
20+
21+
require_relative '../../config_command'
22+
23+
module Ronin
24+
module Recon
25+
class CLI
26+
module Commands
27+
class Config < Command
28+
#
29+
# Disables a worker in the configuration file.
30+
#
31+
# ## Usage
32+
#
33+
# ronin-recon config disable [options] WORKER
34+
#
35+
# ## Options
36+
#
37+
# -C, --config-file FILE Loads the configuration file
38+
# -h, --help Print help information
39+
#
40+
# ## Arguments
41+
#
42+
# WORKER The worker ID to disable
43+
#
44+
# @since 0.2.0
45+
#
46+
class Disable < ConfigCommand
47+
48+
argument :worker, required: true,
49+
desc: 'The worker ID to disable'
50+
51+
description "Disables a worker in the configuration file"
52+
53+
man_page 'ronin-recon-config-disable.1'
54+
55+
#
56+
# Runs the `ronin-recon config disable` command.
57+
#
58+
# @param [String] worker
59+
# The worker ID to disable.
60+
#
61+
def run(worker)
62+
load_config
63+
64+
@config.workers.delete(worker)
65+
66+
save_config
67+
end
68+
69+
end
70+
end
71+
end
72+
end
73+
end
74+
end

Diff for: lib/ronin/recon/cli/commands/config/enable.rb

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# frozen_string_literal: true
2+
#
3+
# ronin-recon - A micro-framework and tool for performing reconnaissance.
4+
#
5+
# Copyright (c) 2023-2024 Hal Brodigan ([email protected])
6+
#
7+
# ronin-recon is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU Lesser General Public License as published
9+
# by the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# ronin-recon is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU Lesser General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser General Public License
18+
# along with ronin-recon. If not, see <https://www.gnu.org/licenses/>.
19+
#
20+
21+
require_relative '../../config_command'
22+
23+
module Ronin
24+
module Recon
25+
class CLI
26+
module Commands
27+
class Config < Command
28+
#
29+
# Enables a worker in the configuration file.
30+
#
31+
# ## Usage
32+
#
33+
# ronin-recon config enable [options] WORKER
34+
#
35+
# ## Options
36+
#
37+
# -C, --config-file FILE Loads the configuration file
38+
# -h, --help Print help information
39+
#
40+
# ## Arguments
41+
#
42+
# WORKER The worker ID to enable
43+
#
44+
# @since 0.2.0
45+
#
46+
class Enable < ConfigCommand
47+
48+
argument :worker, required: true,
49+
desc: 'The worker ID to enable'
50+
51+
description "Enables a worker in the configuration file"
52+
53+
man_page 'ronin-recon-config-enable.1'
54+
55+
#
56+
# Runs the `ronin-recon config enable` command.
57+
#
58+
# @param [String] worker
59+
#
60+
def run(worker)
61+
load_config
62+
63+
@config.workers.add(worker)
64+
65+
save_config
66+
end
67+
68+
end
69+
end
70+
end
71+
end
72+
end
73+
end

0 commit comments

Comments
 (0)