ronin 2.0.0.beta5 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +14 -0
- data/.rubocop.yml +21 -0
- data/ChangeLog.md +18 -2
- data/Gemfile +6 -2
- data/Rakefile +9 -2
- data/bin/ronin +6 -7
- data/data/new/project/Gemfile.erb +9 -9
- data/gemspec.yml +12 -12
- data/lib/ronin/cli/char_set_options.rb +1 -1
- data/lib/ronin/cli/cipher_command.rb +3 -1
- data/lib/ronin/cli/command.rb +3 -0
- data/lib/ronin/cli/commands/asn.rb +1 -1
- data/lib/ronin/cli/commands/banner_grab.rb +5 -3
- data/lib/ronin/cli/commands/cert_dump.rb +4 -7
- data/lib/ronin/cli/commands/cert_gen.rb +4 -4
- data/lib/ronin/cli/commands/cert_grab.rb +5 -6
- data/lib/ronin/cli/commands/decode.rb +14 -14
- data/lib/ronin/cli/commands/encode.rb +14 -14
- data/lib/ronin/cli/commands/extract.rb +1 -1
- data/lib/ronin/cli/commands/grep.rb +7 -5
- data/lib/ronin/cli/commands/hexdump.rb +53 -22
- data/lib/ronin/cli/commands/hmac.rb +1 -1
- data/lib/ronin/cli/commands/host.rb +2 -2
- data/lib/ronin/cli/commands/http.rb +48 -26
- data/lib/ronin/cli/commands/ip.rb +2 -2
- data/lib/ronin/cli/commands/iprange.rb +2 -2
- data/lib/ronin/cli/commands/netcat.rb +32 -38
- data/lib/ronin/cli/commands/new/project.rb +19 -19
- data/lib/ronin/cli/commands/new/script.rb +12 -12
- data/lib/ronin/cli/commands/proxy.rb +10 -10
- data/lib/ronin/cli/commands/rot.rb +11 -10
- data/lib/ronin/cli/commands/strings.rb +1 -1
- data/lib/ronin/cli/commands/unhexdump.rb +1 -1
- data/lib/ronin/cli/dns.rb +3 -0
- data/lib/ronin/cli/file_processor_command.rb +3 -0
- data/lib/ronin/cli/host_and_port.rb +58 -0
- data/lib/ronin/cli/http_shell.rb +19 -16
- data/lib/ronin/cli/key_options.rb +3 -5
- data/lib/ronin/cli/method_options.rb +0 -2
- data/lib/ronin/cli/pattern_options.rb +5 -6
- data/lib/ronin/cli/printing/syntax_highlighting.rb +3 -0
- data/lib/ronin/cli/typo_options.rb +1 -1
- data/lib/ronin/cli/value_processor_command.rb +1 -1
- data/lib/ronin/config.rb +3 -3
- data/lib/ronin/version.rb +2 -2
- data/man/ronin-asn.1 +11 -1
- data/man/ronin-asn.1.md +9 -1
- data/man/ronin-banner-grab.1 +1 -1
- data/man/ronin-banner-grab.1.md +1 -1
- data/man/ronin-bitflip.1 +1 -1
- data/man/ronin-bitflip.1.md +1 -1
- data/man/ronin-cert-dump.1 +1 -1
- data/man/ronin-cert-dump.1.md +1 -1
- data/man/ronin-cert-gen.1 +1 -1
- data/man/ronin-cert-gen.1.md +1 -1
- data/man/ronin-cert-grab.1 +1 -1
- data/man/ronin-cert-grab.1.md +1 -1
- data/man/ronin-decode.1 +1 -1
- data/man/ronin-decode.1.md +1 -1
- data/man/ronin-decrypt.1 +1 -1
- data/man/ronin-decrypt.1.md +1 -1
- data/man/ronin-dns.1 +1 -1
- data/man/ronin-dns.1.md +1 -1
- data/man/ronin-email-addr.1 +1 -1
- data/man/ronin-email-addr.1.md +1 -1
- data/man/ronin-encode.1 +1 -1
- data/man/ronin-encode.1.md +1 -1
- data/man/ronin-encrypt.1 +1 -1
- data/man/ronin-encrypt.1.md +1 -1
- data/man/ronin-entropy.1 +1 -1
- data/man/ronin-entropy.1.md +1 -1
- data/man/ronin-escape.1 +1 -1
- data/man/ronin-escape.1.md +1 -1
- data/man/ronin-extract.1 +1 -1
- data/man/ronin-extract.1.md +1 -1
- data/man/ronin-grep.1 +1 -1
- data/man/ronin-grep.1.md +1 -1
- data/man/ronin-help.1 +1 -1
- data/man/ronin-help.1.md +1 -1
- data/man/ronin-hexdump.1 +2 -2
- data/man/ronin-hexdump.1.md +2 -2
- data/man/ronin-highlight.1 +1 -1
- data/man/ronin-highlight.1.md +1 -1
- data/man/ronin-hmac.1 +1 -1
- data/man/ronin-hmac.1.md +1 -1
- data/man/ronin-homoglyph.1 +1 -1
- data/man/ronin-homoglyph.1.md +1 -1
- data/man/ronin-host.1 +2 -2
- data/man/ronin-host.1.md +2 -2
- data/man/ronin-http.1 +1 -1
- data/man/ronin-http.1.md +1 -1
- data/man/ronin-ip.1 +1 -1
- data/man/ronin-ip.1.md +1 -1
- data/man/ronin-iprange.1 +1 -1
- data/man/ronin-iprange.1.md +1 -1
- data/man/ronin-irb.1 +1 -1
- data/man/ronin-irb.1.md +1 -1
- data/man/ronin-md5.1 +1 -1
- data/man/ronin-md5.1.md +1 -1
- data/man/ronin-netcat.1 +1 -1
- data/man/ronin-netcat.1.md +1 -1
- data/man/ronin-new-project.1 +1 -1
- data/man/ronin-new-project.1.md +1 -1
- data/man/ronin-new-script.1 +1 -1
- data/man/ronin-new-script.1.md +1 -1
- data/man/ronin-new.1 +1 -1
- data/man/ronin-new.1.md +1 -1
- data/man/ronin-proxy.1 +1 -1
- data/man/ronin-proxy.1.md +1 -1
- data/man/ronin-public-suffix-list.1 +11 -1
- data/man/ronin-public-suffix-list.1.md +9 -1
- data/man/ronin-quote.1 +1 -1
- data/man/ronin-quote.1.md +1 -1
- data/man/ronin-rot.1 +4 -3
- data/man/ronin-rot.1.md +4 -3
- data/man/ronin-sha1.1 +1 -1
- data/man/ronin-sha1.1.md +1 -1
- data/man/ronin-sha256.1 +1 -1
- data/man/ronin-sha256.1.md +1 -1
- data/man/ronin-sha512.1 +1 -1
- data/man/ronin-sha512.1.md +1 -1
- data/man/ronin-strings.1 +1 -1
- data/man/ronin-strings.1.md +1 -1
- data/man/ronin-tips.1 +1 -1
- data/man/ronin-tips.1.md +1 -1
- data/man/ronin-tld-list.1 +11 -1
- data/man/ronin-tld-list.1.md +9 -1
- data/man/ronin-typo.1 +1 -1
- data/man/ronin-typo.1.md +1 -1
- data/man/ronin-typosquat.1 +1 -1
- data/man/ronin-typosquat.1.md +1 -1
- data/man/ronin-unescape.1 +1 -1
- data/man/ronin-unescape.1.md +1 -1
- data/man/ronin-unhexdump.1 +1 -1
- data/man/ronin-unhexdump.1.md +1 -1
- data/man/ronin-unquote.1 +1 -1
- data/man/ronin-unquote.1.md +1 -1
- data/man/ronin-url.1 +1 -1
- data/man/ronin-url.1.md +1 -1
- data/man/ronin-xor.1 +1 -1
- data/man/ronin-xor.1.md +1 -1
- data/man/ronin.1 +1 -1
- data/man/ronin.1.md +1 -1
- data/ronin.gemspec +4 -3
- metadata +62 -24
@@ -60,7 +60,7 @@ module Ronin
|
|
60
60
|
# ## Arguments
|
61
61
|
#
|
62
62
|
# [FILE] Optional file to hexdump
|
63
|
-
#
|
63
|
+
#
|
64
64
|
class Hexdump < FileProcessorCommand
|
65
65
|
|
66
66
|
# Supported types for the `-t,--type` option.
|
@@ -149,7 +149,7 @@ module Ronin
|
|
149
149
|
option :length, short: '-L',
|
150
150
|
value: {
|
151
151
|
type: Integer,
|
152
|
-
usage: 'LEN'
|
152
|
+
usage: 'LEN'
|
153
153
|
},
|
154
154
|
desc: 'Length of data to hexdump'
|
155
155
|
|
@@ -399,7 +399,7 @@ module Ronin
|
|
399
399
|
end
|
400
400
|
|
401
401
|
regexp = Regexp.new(value[1...index])
|
402
|
-
style = parse_style(value[index+2..])
|
402
|
+
style = parse_style(value[(index + 2)..])
|
403
403
|
|
404
404
|
return [regexp, style]
|
405
405
|
else
|
@@ -408,7 +408,7 @@ module Ronin
|
|
408
408
|
end
|
409
409
|
|
410
410
|
pattern = value[0...index]
|
411
|
-
style = parse_style(value[index+1..])
|
411
|
+
style = parse_style(value[(index + 1)..])
|
412
412
|
|
413
413
|
return [pattern, style]
|
414
414
|
end
|
@@ -445,34 +445,65 @@ module Ronin
|
|
445
445
|
kwargs[key] = options[key] if options.has_key?(key)
|
446
446
|
end
|
447
447
|
|
448
|
-
if (
|
449
|
-
(
|
450
|
-
(
|
451
|
-
kwargs[:style] =
|
452
|
-
kwargs[:style][:index] = index_style if index_style
|
453
|
-
kwargs[:style][:numeric] = numeric_style if numeric_style
|
454
|
-
kwargs[:style][:chars] = chars_style if chars_style
|
448
|
+
if options.has_key?(:style_index) ||
|
449
|
+
options.has_key?(:style_numeric) ||
|
450
|
+
options.has_key?(:style_chars)
|
451
|
+
kwargs[:style] = hexdump_style_kwargs
|
455
452
|
end
|
456
453
|
|
457
454
|
if !@highlight_index.empty? ||
|
458
455
|
!@highlight_numeric.empty? ||
|
459
456
|
!@highlight_chars.empty?
|
460
|
-
kwargs[:highlights] =
|
457
|
+
kwargs[:highlights] = hexdump_highlights_kwargs
|
458
|
+
end
|
461
459
|
|
462
|
-
|
463
|
-
|
464
|
-
end
|
460
|
+
return kwargs
|
461
|
+
end
|
465
462
|
|
466
|
-
|
467
|
-
|
468
|
-
|
463
|
+
#
|
464
|
+
# The hexdump `style:` keyword arguments.
|
465
|
+
#
|
466
|
+
# @return [Hash{Symbol => Object}]
|
467
|
+
#
|
468
|
+
def hexdump_style_kwargs
|
469
|
+
style = {}
|
469
470
|
|
470
|
-
|
471
|
-
|
472
|
-
end
|
471
|
+
if (index_style = options[:style_index])
|
472
|
+
style[:index] = index_style
|
473
473
|
end
|
474
474
|
|
475
|
-
|
475
|
+
if (numeric_style = options[:style_numeric])
|
476
|
+
style[:numeric] = numeric_style
|
477
|
+
end
|
478
|
+
|
479
|
+
if (chars_style = options[:style_chars])
|
480
|
+
style[:chars] = chars_style
|
481
|
+
end
|
482
|
+
|
483
|
+
return style
|
484
|
+
end
|
485
|
+
|
486
|
+
#
|
487
|
+
# The hexdump `highlights:` keyword arguments.
|
488
|
+
#
|
489
|
+
# @return [Hash{Symbol => Object}]
|
490
|
+
#
|
491
|
+
def hexdump_highlights_kwargs
|
492
|
+
highlights = {}
|
493
|
+
|
494
|
+
unless @highlight_index.empty?
|
495
|
+
highlights[:index] = @highlight_index
|
496
|
+
end
|
497
|
+
|
498
|
+
unless @highlight_numeric.empty?
|
499
|
+
highlights[:numeric] = @highlight_numeric
|
500
|
+
end
|
501
|
+
|
502
|
+
unless @highlight_chars.empty?
|
503
|
+
highlights[:chars] = @highlight_chars
|
504
|
+
end
|
505
|
+
|
506
|
+
return highlights
|
476
507
|
end
|
477
508
|
|
478
509
|
end
|
@@ -37,10 +37,10 @@ module Ronin
|
|
37
37
|
# -f, --file FILE Optional file to read values from
|
38
38
|
# --subdomain SUBNAME Converts the hostname to a sub-domain
|
39
39
|
# -d, --domain Converts the hostname to a domain
|
40
|
-
# -T, --tld Converts the hostname to it's TLD
|
40
|
+
# -T, --tld Converts the hostname to it's TLD
|
41
41
|
# -s, --suffix Converts the hostname to it's suffix
|
42
42
|
# -S, --change-suffix SUFFIX Changes the suffix of each hostname
|
43
|
-
# --enum-tlds Enumerates over every TLD
|
43
|
+
# --enum-tlds Enumerates over every TLD
|
44
44
|
# --enum-suffixes[={icann|private}]
|
45
45
|
# Enumerates over every domain suffix
|
46
46
|
# --enum-subdomains FILE Enumerates over every subdomain in the wordlist
|
@@ -22,6 +22,7 @@ require 'ronin/cli/http_shell'
|
|
22
22
|
require 'ronin/support/network/http'
|
23
23
|
|
24
24
|
require 'command_kit/options/verbose'
|
25
|
+
require 'addressable/uri'
|
25
26
|
|
26
27
|
module Ronin
|
27
28
|
class CLI
|
@@ -74,6 +75,9 @@ module Ronin
|
|
74
75
|
include CommandKit::Options::Verbose
|
75
76
|
include Printing::HTTP
|
76
77
|
|
78
|
+
# `http://` and `https://` URL validation regex.
|
79
|
+
URL_REGEX = URI::DEFAULT_PARSER.make_regexp(%w[http https])
|
80
|
+
|
77
81
|
usage '[options] {URL [...] | --shell URL}'
|
78
82
|
|
79
83
|
option :method, value: {
|
@@ -147,10 +151,14 @@ module Ronin
|
|
147
151
|
end
|
148
152
|
|
149
153
|
option :shell, value: {
|
150
|
-
type:
|
154
|
+
type: URL_REGEX,
|
151
155
|
usage: 'URL'
|
152
156
|
},
|
153
|
-
desc: 'Open an interactive HTTP shell'
|
157
|
+
desc: 'Open an interactive HTTP shell' do |url|
|
158
|
+
options[:shell] = Addressable::URI.parse(url)
|
159
|
+
rescue Addressable::URI::InvalidURIError => error
|
160
|
+
raise(OptionParser::InvalidArgument,"invalid URL: #{error.message}")
|
161
|
+
end
|
154
162
|
|
155
163
|
option :proxy, short: '-P',
|
156
164
|
value: {
|
@@ -172,11 +180,9 @@ module Ronin
|
|
172
180
|
|
173
181
|
option :user_agent, short: '-u',
|
174
182
|
value: {
|
175
|
-
type:
|
176
|
-
|
177
|
-
|
178
|
-
}
|
179
|
-
]
|
183
|
+
type: Support::Network::HTTP::UserAgents::ALIASES.transform_keys { |key|
|
184
|
+
key.to_s.tr('_','-')
|
185
|
+
}
|
180
186
|
},
|
181
187
|
desc: 'The User-Agent to use' do |name|
|
182
188
|
@user_agent = name
|
@@ -266,6 +272,11 @@ module Ronin
|
|
266
272
|
# @return [Hash{String => String}]
|
267
273
|
attr_reader :query_params
|
268
274
|
|
275
|
+
# The body to send with the request.
|
276
|
+
#
|
277
|
+
# @return [String, nil]
|
278
|
+
attr_reader :body
|
279
|
+
|
269
280
|
# Form data.
|
270
281
|
#
|
271
282
|
# @return [Hash{String => String}]
|
@@ -321,25 +332,36 @@ module Ronin
|
|
321
332
|
# The URL to request.
|
322
333
|
#
|
323
334
|
def process_value(url)
|
324
|
-
url
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
335
|
+
unless url =~ URL_REGEX
|
336
|
+
print_error "invalid URL: #{url.inspect}"
|
337
|
+
return
|
338
|
+
end
|
339
|
+
|
340
|
+
uri = begin
|
341
|
+
Addressable::URI.parse(url)
|
342
|
+
rescue Addressable::URI::InvalidURIError => error
|
343
|
+
print_error "invalid URL: #{error.message}"
|
344
|
+
return
|
345
|
+
end
|
346
|
+
|
347
|
+
begin
|
348
|
+
Support::Network::HTTP.request(
|
349
|
+
@http_method, uri, proxy: @proxy,
|
350
|
+
user_agent: @user_agent,
|
351
|
+
query_params: @query_params,
|
352
|
+
headers: @headers,
|
353
|
+
body: @body,
|
354
|
+
form_data: @form_data
|
355
|
+
) do |response|
|
356
|
+
# NOTE: we must call HTTP.request with a block to avoid causing
|
357
|
+
# #read_body to be called twice.
|
358
|
+
print_response(response)
|
359
|
+
end
|
360
|
+
rescue StandardError => error
|
361
|
+
if verbose? then print_exception(error)
|
362
|
+
else print_error(error.message)
|
363
|
+
end
|
364
|
+
end
|
343
365
|
end
|
344
366
|
|
345
367
|
#
|
@@ -135,12 +135,12 @@ module Ronin
|
|
135
135
|
desc: 'The query string for the URI'
|
136
136
|
|
137
137
|
option :http, desc: 'Converts the IP address into a http:// URI' do
|
138
|
-
options[:uri]
|
138
|
+
options[:uri] = true
|
139
139
|
options[:uri_scheme] = 'http'
|
140
140
|
end
|
141
141
|
|
142
142
|
option :https, desc: 'Converts the IP address into a https:// URI' do
|
143
|
-
options[:uri]
|
143
|
+
options[:uri] = true
|
144
144
|
options[:uri_scheme] = 'https'
|
145
145
|
end
|
146
146
|
|
@@ -47,7 +47,7 @@ module Ronin
|
|
47
47
|
# ronin iprange 1.1.2-4.10-50
|
48
48
|
# ronin iprange --start 1.1.1.10 --stop 1.1.4.100
|
49
49
|
# ronin iprange --file list.txt
|
50
|
-
#
|
50
|
+
#
|
51
51
|
class Iprange < ValueProcessorCommand
|
52
52
|
|
53
53
|
usage '[options] [IP_RANGE ... | --start IP --stop IP]'
|
@@ -104,7 +104,7 @@ module Ronin
|
|
104
104
|
if !@start.empty? && !@stop.empty?
|
105
105
|
unless @start.length == @stop.length
|
106
106
|
print_error "must specify an equal number of --start and --stop options"
|
107
|
-
exit
|
107
|
+
exit(-1)
|
108
108
|
end
|
109
109
|
|
110
110
|
@start.zip(@stop).each do |(start,stop)|
|
@@ -132,16 +132,14 @@ module Ronin
|
|
132
132
|
|
133
133
|
option :ssl_key, value: {
|
134
134
|
type: String,
|
135
|
-
usage: 'FILE'
|
135
|
+
usage: 'FILE'
|
136
136
|
},
|
137
137
|
desc: 'Specifies the SSL key file'
|
138
138
|
|
139
139
|
option :ssl_verify, value: {
|
140
|
-
type:
|
141
|
-
|
142
|
-
|
143
|
-
}
|
144
|
-
]
|
140
|
+
type: Support::Network::SSL::VERIFY.transform_keys { |key|
|
141
|
+
key.to_s.tr('_','-')
|
142
|
+
}
|
145
143
|
},
|
146
144
|
desc: 'SSL verification mode'
|
147
145
|
|
@@ -301,16 +299,15 @@ module Ronin
|
|
301
299
|
# The client event loop.
|
302
300
|
#
|
303
301
|
def client_loop
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
302
|
+
finished = Async::Notification.new
|
303
|
+
endpoint = async_endpoint
|
304
|
+
stdin = async_stdin
|
308
305
|
buffer_size = options[:buffer_size]
|
309
306
|
|
310
307
|
Async do |task|
|
311
308
|
socket = begin
|
312
309
|
endpoint.connect
|
313
|
-
rescue => error
|
310
|
+
rescue StandardError => error
|
314
311
|
print_error(error.message)
|
315
312
|
exit(1)
|
316
313
|
end
|
@@ -319,25 +316,23 @@ module Ronin
|
|
319
316
|
|
320
317
|
begin
|
321
318
|
client = task.async do
|
322
|
-
|
323
|
-
|
324
|
-
print_data(data)
|
325
|
-
end
|
326
|
-
rescue EOFError
|
327
|
-
ensure
|
328
|
-
finished.signal
|
319
|
+
while (data = stream.read_partial(buffer_size))
|
320
|
+
print_data(data)
|
329
321
|
end
|
322
|
+
rescue EOFError
|
323
|
+
# ignore EOFError
|
324
|
+
ensure
|
325
|
+
finished.signal
|
330
326
|
end
|
331
327
|
|
332
328
|
user = task.async do
|
333
|
-
|
334
|
-
|
335
|
-
socket.write(data)
|
336
|
-
end
|
337
|
-
rescue EOFError
|
338
|
-
ensure
|
339
|
-
finished.signal
|
329
|
+
while (data = stdin.read_partial(buffer_size))
|
330
|
+
socket.write(data)
|
340
331
|
end
|
332
|
+
rescue EOFError
|
333
|
+
# ignore EOFError
|
334
|
+
ensure
|
335
|
+
finished.signal
|
341
336
|
end
|
342
337
|
|
343
338
|
finished.wait
|
@@ -353,12 +348,11 @@ module Ronin
|
|
353
348
|
# The server event loop.
|
354
349
|
#
|
355
350
|
def server_loop
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
351
|
+
finished = Async::Notification.new
|
352
|
+
endpoint = async_endpoint
|
353
|
+
stdin = async_stdin
|
354
|
+
clients = []
|
360
355
|
buffer_size = options[:buffer_size]
|
361
|
-
clients = []
|
362
356
|
|
363
357
|
Async do |task|
|
364
358
|
endpoint.accept do |socket|
|
@@ -374,6 +368,7 @@ module Ronin
|
|
374
368
|
print_data(data)
|
375
369
|
end
|
376
370
|
rescue EOFError
|
371
|
+
# ignore EOFError
|
377
372
|
end
|
378
373
|
|
379
374
|
clients.delete(socket)
|
@@ -384,18 +379,17 @@ module Ronin
|
|
384
379
|
end
|
385
380
|
|
386
381
|
task.async do
|
387
|
-
|
388
|
-
|
389
|
-
clients.each { |client| client.write(data) }
|
390
|
-
end
|
391
|
-
rescue EOFError
|
392
|
-
ensure
|
393
|
-
finished.signal
|
382
|
+
while (data = stdin.read_partial(buffer_size))
|
383
|
+
clients.each { |client| client.write(data) }
|
394
384
|
end
|
385
|
+
rescue EOFError
|
386
|
+
# ignore EOFError
|
387
|
+
ensure
|
388
|
+
finished.signal
|
395
389
|
end
|
396
390
|
|
397
391
|
finished.wait
|
398
|
-
rescue => error
|
392
|
+
rescue StandardError => error
|
399
393
|
print_error(error.message)
|
400
394
|
exit(1)
|
401
395
|
ensure
|
@@ -23,26 +23,26 @@ require 'ronin/root'
|
|
23
23
|
module Ronin
|
24
24
|
class CLI
|
25
25
|
module Commands
|
26
|
-
#
|
27
|
-
# Creates new Ruby project directory.
|
28
|
-
#
|
29
|
-
# ## Usage
|
30
|
-
#
|
31
|
-
# ronin new project [options] DIR
|
32
|
-
#
|
33
|
-
# ## Options
|
34
|
-
#
|
35
|
-
# --git Initializes a git repo
|
36
|
-
# --ruby-version VERSION The desired ruby version for the project
|
37
|
-
# --rakefile Creates a Rakefile
|
38
|
-
# -D, --dockerfile Adds a Dockerfile to the new project
|
39
|
-
# -h, --help Print help information
|
40
|
-
#
|
41
|
-
# ## Arguments
|
42
|
-
#
|
43
|
-
# PATH The directory to create
|
44
|
-
#
|
45
26
|
class New < Command
|
27
|
+
#
|
28
|
+
# Creates new Ruby project directory.
|
29
|
+
#
|
30
|
+
# ## Usage
|
31
|
+
#
|
32
|
+
# ronin new project [options] DIR
|
33
|
+
#
|
34
|
+
# ## Options
|
35
|
+
#
|
36
|
+
# --git Initializes a git repo
|
37
|
+
# --ruby-version VERSION The desired ruby version for the project
|
38
|
+
# --rakefile Creates a Rakefile
|
39
|
+
# -D, --dockerfile Adds a Dockerfile to the new project
|
40
|
+
# -h, --help Print help information
|
41
|
+
#
|
42
|
+
# ## Arguments
|
43
|
+
#
|
44
|
+
# PATH The directory to create
|
45
|
+
#
|
46
46
|
class Project < Command
|
47
47
|
|
48
48
|
include Core::CLI::Generator
|
@@ -23,25 +23,25 @@ require 'ronin/root'
|
|
23
23
|
module Ronin
|
24
24
|
class CLI
|
25
25
|
module Commands
|
26
|
-
#
|
27
|
-
# Creates a new standalone Ruby script.
|
28
|
-
#
|
29
|
-
# ## Usage
|
30
|
-
#
|
31
|
-
# ronin new script PATH
|
32
|
-
#
|
33
|
-
# ## Arguments
|
34
|
-
#
|
35
|
-
# PATH The script file to create
|
36
|
-
#
|
37
26
|
class New < Command
|
27
|
+
#
|
28
|
+
# Creates a new standalone Ruby script.
|
29
|
+
#
|
30
|
+
# ## Usage
|
31
|
+
#
|
32
|
+
# ronin new script PATH
|
33
|
+
#
|
34
|
+
# ## Arguments
|
35
|
+
#
|
36
|
+
# PATH The script file to create
|
37
|
+
#
|
38
38
|
class Script < Command
|
39
39
|
|
40
40
|
include Core::CLI::Generator
|
41
41
|
|
42
42
|
template_dir File.join(ROOT,'data','new')
|
43
43
|
|
44
|
-
usage'
|
44
|
+
usage 'PATH'
|
45
45
|
|
46
46
|
argument :path, required: true,
|
47
47
|
desc: 'The script file to create'
|
@@ -17,6 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'ronin/cli/command'
|
20
|
+
require 'ronin/cli/host_and_port'
|
20
21
|
require 'ronin/core/cli/logging'
|
21
22
|
|
22
23
|
require 'ronin/support/network/tcp/proxy'
|
@@ -76,6 +77,7 @@ module Ronin
|
|
76
77
|
#
|
77
78
|
class Proxy < Command
|
78
79
|
|
80
|
+
include HostAndPort
|
79
81
|
include Core::CLI::Logging
|
80
82
|
|
81
83
|
usage '[PROXY_HOST:]PROXY_PORT UPSTREAM_HOST:UPSTREAM_PORT'
|
@@ -115,7 +117,7 @@ module Ronin
|
|
115
117
|
|
116
118
|
option :rewrite_client, value: {
|
117
119
|
type: String,
|
118
|
-
usage: '/REGEXP/:STRING'
|
120
|
+
usage: '/REGEXP/:STRING'
|
119
121
|
},
|
120
122
|
desc: 'Client rewrite rules' do |value|
|
121
123
|
@rewrite_client << parse_rewrite_rule(value)
|
@@ -123,14 +125,14 @@ module Ronin
|
|
123
125
|
|
124
126
|
option :rewrite_server, value: {
|
125
127
|
type: String,
|
126
|
-
usage: '/REGEXP/:STRING'
|
128
|
+
usage: '/REGEXP/:STRING'
|
127
129
|
},
|
128
130
|
desc: 'Server rewrite rules' do |value|
|
129
131
|
@rewrite_server << parse_rewrite_rule(value)
|
130
132
|
end
|
131
133
|
|
132
134
|
option :ignore, short: '-i',
|
133
|
-
value: {type:
|
135
|
+
value: {type: Regexp},
|
134
136
|
desc: 'Ignore rules' do |regexp|
|
135
137
|
@ignore << regexp
|
136
138
|
end
|
@@ -146,7 +148,7 @@ module Ronin
|
|
146
148
|
end
|
147
149
|
|
148
150
|
option :close, short: '-C',
|
149
|
-
value: {type:
|
151
|
+
value: {type: Regexp},
|
150
152
|
desc: 'Close rules' do |regexp|
|
151
153
|
@close << regexp
|
152
154
|
end
|
@@ -294,14 +296,12 @@ module Ronin
|
|
294
296
|
local, upstream = *args
|
295
297
|
|
296
298
|
if local.include?(':')
|
297
|
-
proxy_host, proxy_port = local
|
298
|
-
proxy_port = proxy_port.to_i
|
299
|
+
proxy_host, proxy_port = host_and_port(local)
|
299
300
|
else
|
300
301
|
proxy_port = local.to_i
|
301
302
|
end
|
302
303
|
|
303
|
-
upstream_host, upstream_port = upstream
|
304
|
-
upstream_port = upstream_port.to_i
|
304
|
+
upstream_host, upstream_port = host_and_port(upstream)
|
305
305
|
|
306
306
|
if options[:hexdump]
|
307
307
|
@hexdumper = Hexdump::Hexdump.new
|
@@ -430,7 +430,7 @@ module Ronin
|
|
430
430
|
end
|
431
431
|
|
432
432
|
regexp = Regexp.new(string[1...index])
|
433
|
-
pattern = string[index+2..]
|
433
|
+
pattern = string[(index + 2)..]
|
434
434
|
|
435
435
|
return regexp, pattern
|
436
436
|
end
|
@@ -465,7 +465,7 @@ module Ronin
|
|
465
465
|
def address(connection)
|
466
466
|
case connection
|
467
467
|
when Array
|
468
|
-
|
468
|
+
_socket, (host, port) = connection
|
469
469
|
|
470
470
|
"#{host}:#{port}"
|
471
471
|
when TCPSocket, UDPSocket
|
@@ -37,7 +37,7 @@ module Ronin
|
|
37
37
|
# -M, --multiline Process each line separately
|
38
38
|
# --keep-newlines Preserves newlines at the end of each line
|
39
39
|
# -A, --alphabet ABC... Alphabet characters
|
40
|
-
# -n, --
|
40
|
+
# -n, --modulo NUM Number of characters to rotate (Default: 13)
|
41
41
|
# -h, --help Print help information
|
42
42
|
#
|
43
43
|
# ## Arguments
|
@@ -55,13 +55,14 @@ module Ronin
|
|
55
55
|
@alphabets << str.chars
|
56
56
|
end
|
57
57
|
|
58
|
-
option :
|
58
|
+
option :modulo, short: '-n',
|
59
59
|
value: {
|
60
|
-
type:
|
61
|
-
usage:
|
60
|
+
type: Integer,
|
61
|
+
usage: 'NUM',
|
62
|
+
default: 13
|
62
63
|
},
|
63
64
|
desc: 'Number of characters to rotate' do |num|
|
64
|
-
@
|
65
|
+
@modulo = num
|
65
66
|
end
|
66
67
|
|
67
68
|
description "Rotates each character of data within an alphabet"
|
@@ -71,7 +72,7 @@ module Ronin
|
|
71
72
|
# The number of characters to rotate.
|
72
73
|
#
|
73
74
|
# @return [Integer]
|
74
|
-
attr_reader :
|
75
|
+
attr_reader :modulo
|
75
76
|
|
76
77
|
# The alphabets to rotate within.
|
77
78
|
#
|
@@ -87,7 +88,7 @@ module Ronin
|
|
87
88
|
def initialize(**kwargs)
|
88
89
|
super(**kwargs)
|
89
90
|
|
90
|
-
@
|
91
|
+
@modulo = 13
|
91
92
|
@alphabets = []
|
92
93
|
end
|
93
94
|
|
@@ -101,10 +102,10 @@ module Ronin
|
|
101
102
|
# The rotated string.
|
102
103
|
#
|
103
104
|
def process_string(string)
|
104
|
-
|
105
|
-
Support::Crypto.rot(string,@
|
105
|
+
unless @alphabets.empty?
|
106
|
+
Support::Crypto.rot(string,@modulo, alphabets: @alphabets)
|
106
107
|
else
|
107
|
-
Support::Crypto.rot(string,@
|
108
|
+
Support::Crypto.rot(string,@modulo)
|
108
109
|
end
|
109
110
|
end
|
110
111
|
|
@@ -140,7 +140,7 @@ module Ronin
|
|
140
140
|
desc: 'Numerical base of the hexdumped numbers'
|
141
141
|
|
142
142
|
option :address_base, short: '-A',
|
143
|
-
value: {type:
|
143
|
+
value: {type: BASES},
|
144
144
|
desc: 'Numerical base of the address column'
|
145
145
|
|
146
146
|
option :named_chars, long: '--[no-]named-chars',
|