Skip to content

Commit 3d6f48d

Browse files
committed
Use capture arguments to parse the --param and --concurrency option values.
1 parent 40c71d3 commit 3d6f48d

File tree

1 file changed

+5
-10
lines changed
  • lib/ronin/recon/cli/commands

1 file changed

+5
-10
lines changed

lib/ronin/recon/cli/commands/run.rb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,19 @@ class Run < Command
110110

111111
option :param, short: '-p',
112112
value: {
113-
type: /\A[^\.\=\s]+\.[^=\s]+=.+\z/,
113+
type: /\A([^\.\=\s]+)\.([^=\s]+)=(.+)\z/,
114114
usage: 'WORKER.NAME=VALUE'
115115
},
116-
desc: 'Sets a param for a worker' do |str|
117-
prefix, value = str.split('=',2)
118-
worker, name = prefix.split('.',2)
119-
120-
@worker_params[worker][name.to_sym] = value
116+
desc: 'Sets a param for a worker' do |str,worker,param_name,param_value|
117+
@worker_params[worker][param_name.to_sym] = param_value
121118
end
122119

123120
option :concurrency, short: '-c',
124121
value: {
125-
type: /\A[^\.\=\s]+=\d+\z/,
122+
type: /\A([^\.\=\s]+)=(\d+)\z/,
126123
usage: 'WORKER=NUM'
127124
},
128-
desc: 'Sets the concurrency of a worker' do |str|
129-
worker, concurrency = str.split('=',2)
130-
125+
desc: 'Sets the concurrency of a worker' do |str,worker,concurrency|
131126
@worker_concurrency[worker] = concurrency.to_i
132127
end
133128

0 commit comments

Comments
 (0)