ronin 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +14 -0
  3. data/.rubocop.yml +21 -0
  4. data/ChangeLog.md +35 -2
  5. data/Gemfile +20 -16
  6. data/README.md +42 -23
  7. data/Rakefile +2 -2
  8. data/bin/ronin +6 -7
  9. data/data/new/project/Gemfile.erb +9 -9
  10. data/gemspec.yml +7 -7
  11. data/lib/ronin/cli/char_set_options.rb +1 -1
  12. data/lib/ronin/cli/cipher_command.rb +3 -1
  13. data/lib/ronin/cli/command.rb +3 -0
  14. data/lib/ronin/cli/commands/asn.rb +1 -1
  15. data/lib/ronin/cli/commands/banner_grab.rb +5 -3
  16. data/lib/ronin/cli/commands/cert_dump.rb +4 -7
  17. data/lib/ronin/cli/commands/cert_gen.rb +4 -4
  18. data/lib/ronin/cli/commands/cert_grab.rb +5 -6
  19. data/lib/ronin/cli/commands/decode.rb +14 -14
  20. data/lib/ronin/cli/commands/dns.rb +2 -2
  21. data/lib/ronin/cli/commands/encode.rb +14 -14
  22. data/lib/ronin/cli/commands/extract.rb +1 -1
  23. data/lib/ronin/cli/commands/grep.rb +7 -5
  24. data/lib/ronin/cli/commands/hexdump.rb +54 -22
  25. data/lib/ronin/cli/commands/hmac.rb +1 -1
  26. data/lib/ronin/cli/commands/host.rb +15 -15
  27. data/lib/ronin/cli/commands/http.rb +42 -25
  28. data/lib/ronin/cli/commands/ip.rb +5 -3
  29. data/lib/ronin/cli/commands/iprange.rb +2 -2
  30. data/lib/ronin/cli/commands/netcat.rb +32 -38
  31. data/lib/ronin/cli/commands/new/project.rb +19 -19
  32. data/lib/ronin/cli/commands/new/script.rb +12 -12
  33. data/lib/ronin/cli/commands/proxy.rb +37 -41
  34. data/lib/ronin/cli/commands/rot.rb +11 -10
  35. data/lib/ronin/cli/commands/strings.rb +1 -1
  36. data/lib/ronin/cli/commands/unhexdump.rb +1 -1
  37. data/lib/ronin/cli/dns.rb +3 -0
  38. data/lib/ronin/cli/file_processor_command.rb +3 -0
  39. data/lib/ronin/cli/host_and_port.rb +58 -0
  40. data/lib/ronin/cli/http_shell.rb +19 -16
  41. data/lib/ronin/cli/key_options.rb +3 -5
  42. data/lib/ronin/cli/method_options.rb +0 -2
  43. data/lib/ronin/cli/pattern_options.rb +5 -6
  44. data/lib/ronin/cli/printing/syntax_highlighting.rb +3 -0
  45. data/lib/ronin/cli/typo_options.rb +1 -1
  46. data/lib/ronin/cli/value_processor_command.rb +1 -1
  47. data/lib/ronin/config.rb +3 -3
  48. data/lib/ronin/version.rb +2 -2
  49. data/man/ronin-asn.1 +11 -1
  50. data/man/ronin-asn.1.md +9 -1
  51. data/man/ronin-banner-grab.1 +1 -1
  52. data/man/ronin-banner-grab.1.md +1 -1
  53. data/man/ronin-bitflip.1 +1 -1
  54. data/man/ronin-bitflip.1.md +1 -1
  55. data/man/ronin-cert-dump.1 +1 -1
  56. data/man/ronin-cert-dump.1.md +1 -1
  57. data/man/ronin-cert-gen.1 +16 -7
  58. data/man/ronin-cert-gen.1.md +11 -5
  59. data/man/ronin-cert-grab.1 +1 -1
  60. data/man/ronin-cert-grab.1.md +1 -1
  61. data/man/ronin-decode.1 +1 -1
  62. data/man/ronin-decode.1.md +1 -1
  63. data/man/ronin-decrypt.1 +31 -1
  64. data/man/ronin-decrypt.1.md +19 -1
  65. data/man/ronin-dns.1 +2 -2
  66. data/man/ronin-dns.1.md +2 -2
  67. data/man/ronin-email-addr.1 +3 -3
  68. data/man/ronin-email-addr.1.md +3 -3
  69. data/man/ronin-encode.1 +1 -1
  70. data/man/ronin-encode.1.md +1 -1
  71. data/man/ronin-encrypt.1 +31 -1
  72. data/man/ronin-encrypt.1.md +19 -1
  73. data/man/ronin-entropy.1 +1 -1
  74. data/man/ronin-entropy.1.md +1 -1
  75. data/man/ronin-escape.1 +2 -2
  76. data/man/ronin-escape.1.md +2 -2
  77. data/man/ronin-extract.1 +1 -1
  78. data/man/ronin-extract.1.md +1 -1
  79. data/man/ronin-grep.1 +1 -1
  80. data/man/ronin-grep.1.md +1 -1
  81. data/man/ronin-help.1 +1 -1
  82. data/man/ronin-help.1.md +1 -1
  83. data/man/ronin-hexdump.1 +2 -2
  84. data/man/ronin-hexdump.1.md +2 -2
  85. data/man/ronin-highlight.1 +1 -1
  86. data/man/ronin-highlight.1.md +1 -1
  87. data/man/ronin-hmac.1 +1 -1
  88. data/man/ronin-hmac.1.md +1 -1
  89. data/man/ronin-homoglyph.1 +1 -1
  90. data/man/ronin-homoglyph.1.md +1 -1
  91. data/man/ronin-host.1 +3 -3
  92. data/man/ronin-host.1.md +3 -3
  93. data/man/ronin-http.1 +1 -1
  94. data/man/ronin-http.1.md +1 -1
  95. data/man/ronin-ip.1 +1 -1
  96. data/man/ronin-ip.1.md +1 -1
  97. data/man/ronin-iprange.1 +1 -1
  98. data/man/ronin-iprange.1.md +1 -1
  99. data/man/ronin-irb.1 +1 -1
  100. data/man/ronin-irb.1.md +1 -1
  101. data/man/ronin-md5.1 +1 -1
  102. data/man/ronin-md5.1.md +1 -1
  103. data/man/ronin-netcat.1 +1 -1
  104. data/man/ronin-netcat.1.md +1 -1
  105. data/man/ronin-new-project.1 +1 -1
  106. data/man/ronin-new-project.1.md +1 -1
  107. data/man/ronin-new-script.1 +1 -1
  108. data/man/ronin-new-script.1.md +1 -1
  109. data/man/ronin-new.1 +1 -1
  110. data/man/ronin-new.1.md +1 -1
  111. data/man/ronin-proxy.1 +2 -2
  112. data/man/ronin-proxy.1.md +2 -2
  113. data/man/ronin-public-suffix-list.1 +11 -1
  114. data/man/ronin-public-suffix-list.1.md +9 -1
  115. data/man/ronin-quote.1 +2 -2
  116. data/man/ronin-quote.1.md +2 -2
  117. data/man/ronin-rot.1 +20 -3
  118. data/man/ronin-rot.1.md +14 -3
  119. data/man/ronin-sha1.1 +1 -1
  120. data/man/ronin-sha1.1.md +1 -1
  121. data/man/ronin-sha256.1 +2 -2
  122. data/man/ronin-sha256.1.md +2 -2
  123. data/man/ronin-sha512.1 +1 -1
  124. data/man/ronin-sha512.1.md +1 -1
  125. data/man/ronin-strings.1 +1 -1
  126. data/man/ronin-strings.1.md +1 -1
  127. data/man/ronin-tips.1 +1 -1
  128. data/man/ronin-tips.1.md +1 -1
  129. data/man/ronin-tld-list.1 +11 -1
  130. data/man/ronin-tld-list.1.md +9 -1
  131. data/man/ronin-typo.1 +1 -1
  132. data/man/ronin-typo.1.md +1 -1
  133. data/man/ronin-typosquat.1 +1 -1
  134. data/man/ronin-typosquat.1.md +1 -1
  135. data/man/ronin-unescape.1 +1 -1
  136. data/man/ronin-unescape.1.md +1 -1
  137. data/man/ronin-unhexdump.1 +1 -1
  138. data/man/ronin-unhexdump.1.md +1 -1
  139. data/man/ronin-unquote.1 +1 -1
  140. data/man/ronin-unquote.1.md +1 -1
  141. data/man/ronin-url.1 +1 -1
  142. data/man/ronin-url.1.md +1 -1
  143. data/man/ronin-xor.1 +1 -1
  144. data/man/ronin-xor.1.md +1 -1
  145. data/man/ronin.1 +1 -1
  146. data/man/ronin.1.md +1 -1
  147. data/ronin.gemspec +4 -3
  148. metadata +40 -2
@@ -61,14 +61,14 @@ module Ronin
61
61
  class Encode < StringMethodsCommand
62
62
 
63
63
  option :base16, desc: 'Base16 encodes the data' do
64
- require 'ronin/support/encoding/base16'
65
- @method_calls << :base16_encode
66
- end
64
+ require 'ronin/support/encoding/base16'
65
+ @method_calls << :base16_encode
66
+ end
67
67
 
68
68
  option :base32, desc: 'Base32 encodes the data' do
69
- require 'ronin/support/encoding/base32'
70
- @method_calls << :base32_encode
71
- end
69
+ require 'ronin/support/encoding/base32'
70
+ @method_calls << :base32_encode
71
+ end
72
72
 
73
73
  option :base64, short: '-b',
74
74
  equals: true,
@@ -78,11 +78,11 @@ module Ronin
78
78
  },
79
79
  desc: 'Base64 encodes the data' do |mode=nil|
80
80
  require 'ronin/support/encoding/base64'
81
- if mode
82
- @method_calls << [:base64_encode, [mode]]
83
- else
84
- @method_calls << :base64_encode
85
- end
81
+ @method_calls << if mode
82
+ [:base64_encode, [mode]]
83
+ else
84
+ :base64_encode
85
+ end
86
86
  end
87
87
 
88
88
  option :zlib, short: '-z',
@@ -122,9 +122,9 @@ module Ronin
122
122
  end
123
123
 
124
124
  option :http, desc: 'HTTP encodes the data' do
125
- require 'ronin/support/encoding/http'
126
- @method_calls << :http_encode
127
- end
125
+ require 'ronin/support/encoding/http'
126
+ @method_calls << :http_encode
127
+ end
128
128
 
129
129
  option :js, short: '-j',
130
130
  desc: 'JavaScript encodes the data' do
@@ -122,7 +122,7 @@ module Ronin
122
122
  def run(*files)
123
123
  unless @pattern
124
124
  print_error "must specify a pattern to search for"
125
- exit -1
125
+ exit(-1)
126
126
  end
127
127
 
128
128
  super(*files)
@@ -136,7 +136,7 @@ module Ronin
136
136
  def run(*files)
137
137
  unless @pattern
138
138
  print_error "must specify a pattern to search for"
139
- exit -1
139
+ exit(-1)
140
140
  end
141
141
 
142
142
  super(*files)
@@ -151,8 +151,8 @@ module Ronin
151
151
  def process_input(input)
152
152
  filename = filename_of(input)
153
153
 
154
- input.each_line(chomp: true).each_with_index do |line,index|
155
- match_line(line, filename: filename, line_number: index+1)
154
+ input.each_line(chomp: true).with_index do |line,index|
155
+ match_line(line, filename: filename, line_number: index + 1)
156
156
  end
157
157
  end
158
158
 
@@ -184,7 +184,9 @@ module Ronin
184
184
  #
185
185
  def match_line(line,**kwargs)
186
186
  index = 0
187
+
187
188
  printed_prefix = false
189
+ only_matching = options[:only_matching]
188
190
 
189
191
  while (match = line.match(@pattern,index))
190
192
  unless printed_prefix
@@ -195,13 +197,13 @@ module Ronin
195
197
  match_start, match_stop = match.offset(0)
196
198
 
197
199
  # print the text before the match, unless --only-matching is enabled
198
- print(line[index...match_start]) unless options[:only_matching]
200
+ print(line[index...match_start]) unless only_matching
199
201
  print_match(match)
200
202
 
201
203
  index = match_stop
202
204
  end
203
205
 
204
- unless options[:only_matching]
206
+ unless only_matching
205
207
  # print the rest of the line, if we've had at least one match
206
208
  puts(line[index..]) if index > 0
207
209
  end
@@ -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
@@ -417,6 +417,7 @@ module Ronin
417
417
  # List of command `options` that directly map to the keyword arguments
418
418
  # of `Hexdump.hexdump`.
419
419
  HEXDUMP_OPTIONS = [
420
+ :type,
420
421
  :format,
421
422
  :offset,
422
423
  :length,
@@ -445,34 +446,65 @@ module Ronin
445
446
  kwargs[key] = options[key] if options.has_key?(key)
446
447
  end
447
448
 
448
- if (index_style = options[:style_index]) ||
449
- (numeric_style = options[:style_numeric]) ||
450
- (chars_style = options[:style_chars])
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
449
+ if options.has_key?(:style_index) ||
450
+ options.has_key?(:style_numeric) ||
451
+ options.has_key?(:style_chars)
452
+ kwargs[:style] = hexdump_style_kwargs
455
453
  end
456
454
 
457
455
  if !@highlight_index.empty? ||
458
456
  !@highlight_numeric.empty? ||
459
457
  !@highlight_chars.empty?
460
- kwargs[:highlights] = {}
458
+ kwargs[:highlights] = hexdump_highlights_kwargs
459
+ end
461
460
 
462
- unless @highlight_index.empty?
463
- kwargs[:highlights][:index] = @highlight_index
464
- end
461
+ return kwargs
462
+ end
465
463
 
466
- unless @highlight_numeric.empty?
467
- kwargs[:highlights][:numeric] = @highlight_numeric
468
- end
464
+ #
465
+ # The hexdump `style:` keyword arguments.
466
+ #
467
+ # @return [Hash{Symbol => Object}]
468
+ #
469
+ def hexdump_style_kwargs
470
+ style = {}
469
471
 
470
- unless @highlight_chars.empty?
471
- kwargs[:highlights][:chars] = @highlight_chars
472
- end
472
+ if (index_style = options[:style_index])
473
+ style[:index] = index_style
473
474
  end
474
475
 
475
- return kwargs
476
+ if (numeric_style = options[:style_numeric])
477
+ style[:numeric] = numeric_style
478
+ end
479
+
480
+ if (chars_style = options[:style_chars])
481
+ style[:chars] = chars_style
482
+ end
483
+
484
+ return style
485
+ end
486
+
487
+ #
488
+ # The hexdump `highlights:` keyword arguments.
489
+ #
490
+ # @return [Hash{Symbol => Object}]
491
+ #
492
+ def hexdump_highlights_kwargs
493
+ highlights = {}
494
+
495
+ unless @highlight_index.empty?
496
+ highlights[:index] = @highlight_index
497
+ end
498
+
499
+ unless @highlight_numeric.empty?
500
+ highlights[:numeric] = @highlight_numeric
501
+ end
502
+
503
+ unless @highlight_chars.empty?
504
+ highlights[:chars] = @highlight_chars
505
+ end
506
+
507
+ return highlights
476
508
  end
477
509
 
478
510
  end
@@ -57,7 +57,7 @@ module Ronin
57
57
  option :hash, short: '-H',
58
58
  value: {
59
59
  type: [:md5, :sha1, :sha256, :sha512],
60
- default: :sha1,
60
+ default: :sha1
61
61
  },
62
62
  desc: 'Hash algorithm to use'
63
63
 
@@ -30,17 +30,17 @@ module Ronin
30
30
  #
31
31
  # ## Usage
32
32
  #
33
- # ronin host [options] [HOST ...]
33
+ # ronin host [options] {HOST ... | --file FILE}
34
34
  #
35
35
  # ## Options
36
36
  #
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
@@ -63,7 +63,7 @@ module Ronin
63
63
 
64
64
  include DNS
65
65
 
66
- usage '[options] [HOST ...]'
66
+ usage '[options] {HOST ... | --file FILE}'
67
67
 
68
68
  option :subdomain, value: {
69
69
  type: String,
@@ -117,20 +117,20 @@ module Ronin
117
117
  option :has_records, short: '-H',
118
118
  value: {
119
119
  type: {
120
- A: :a,
121
- AAAA: :aaaa,
122
- ANY: :any,
120
+ A: :a,
121
+ AAAA: :aaaa,
122
+ ANY: :any,
123
123
  CNAME: :cname,
124
124
  HINFO: :hinfo,
125
- LOC: :loc,
125
+ LOC: :loc,
126
126
  MINFO: :minfo,
127
- MX: :mx,
128
- NS: :ns,
129
- PTR: :ptr,
130
- SOA: :soa,
131
- SRV: :srv,
132
- TXT: :txt,
133
- WKS: :wks
127
+ MX: :mx,
128
+ NS: :ns,
129
+ PTR: :ptr,
130
+ SOA: :soa,
131
+ SRV: :srv,
132
+ TXT: :txt,
133
+ WKS: :wks
134
134
  }
135
135
  },
136
136
  desc: 'Filters hostnames that have a certain DNS record type'
@@ -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: String,
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: Hash[
176
- Support::Network::HTTP::UserAgents::ALIASES.keys.map { |key|
177
- [key.to_s.tr('_','-'), key]
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
@@ -326,25 +332,36 @@ module Ronin
326
332
  # The URL to request.
327
333
  #
328
334
  def process_value(url)
329
- url = URI(url)
330
-
331
- Support::Network::HTTP.request(
332
- @http_method, url, proxy: @proxy,
333
- user_agent: @user_agent,
334
- user: url.user,
335
- password: url.password,
336
- query_params: @query_params,
337
- headers: @headers,
338
- body: @body,
339
- form_data: @form_data
340
- ) do |response|
341
- # NOTE: we must call HTTP.request with a block to avoid causing
342
- # #read_body to be called twice.
343
- print_response(response)
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
344
364
  end
345
- rescue => error
346
- print_error(error.message)
347
- exit(1)
348
365
  end
349
366
 
350
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] = true
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] = true
143
+ options[:uri] = true
144
144
  options[:uri_scheme] = 'https'
145
145
  end
146
146
 
@@ -197,7 +197,9 @@ module Ronin
197
197
 
198
198
  puts "#{ip}/#{ip.prefix}"
199
199
  elsif options[:host]
200
- puts ip.host
200
+ if (host = ip.host)
201
+ puts host
202
+ end
201
203
  elsif options[:port]
202
204
  puts "#{format_ip(ip)}:#{options[:port]}"
203
205
  elsif options[:uri]
@@ -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 -1
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: Hash[
141
- Support::Network::SSL::VERIFY.keys.map { |key|
142
- [key.to_s.tr('_','-'), key]
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
- endpoint = async_endpoint
305
- stdin = async_stdin
306
- finished = Async::Notification.new
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
- begin
323
- while (data = stream.read_partial(buffer_size))
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
- begin
334
- while (data = stdin.read_partial(buffer_size))
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
- endpoint = async_endpoint
357
- stdin = async_stdin
358
- finished = Async::Notification.new
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
- begin
388
- while (data = stdin.read_partial(buffer_size))
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' PATH'
44
+ usage 'PATH'
45
45
 
46
46
  argument :path, required: true,
47
47
  desc: 'The script file to create'