ronin-support 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e7362a5af595979050611362ff0d48ace6148032006e9f05e9d90976b44487c
4
- data.tar.gz: a6c6277a8af8169bf8fb374782b65169ae460c8cd6f4cac28a0c82d7ce7648b5
3
+ metadata.gz: d6f75dd96200bd01190ad5ae040cc28dfc658c3f6bcf6c7f299bcdb01d1ee974
4
+ data.tar.gz: 2a9b6e98f9959efacbbc81fccecbaa68b1620a8f52e38efdc941dcdba74ba38d
5
5
  SHA512:
6
- metadata.gz: f927d978f7af471f00bac7b97cc2bc9244df4b04683af3f6ce89ae6988d8f09cf7b28c16422673414a55b2711c9db05695afa0ffae35b1889b0c35117b7597fa
7
- data.tar.gz: 519478e67e3fd01efa02d800d4badb66ce21a867165f300d4310e5a2a4411614ecacd7292c8095b8cef3ae444306b4402cf96e54fb5054f9d4eeb3d19350a335
6
+ metadata.gz: 604e499c76bfd98e82dd2711a203edb85263742df23f128179d52b283c1f6e468334a34b456119b76c1a0d84b2d06969100d4b75e880a5b4ab963e6ccf244742
7
+ data.tar.gz: 843289f09e088afc611ee793f645cdb978bb51613d69176591599c26fdc4e8bfcc8b255e76fc01a7b8c40b1024aa94b69976754de3d9ef84b9ae5eecc62d4223
@@ -16,7 +16,7 @@ jobs:
16
16
  # - truffleruby
17
17
  name: Ruby ${{ matrix.ruby }}
18
18
  steps:
19
- - uses: actions/checkout@v2
19
+ - uses: actions/checkout@v4
20
20
  - name: Set up Ruby
21
21
  uses: ruby/setup-ruby@v1
22
22
  with:
@@ -31,7 +31,7 @@ jobs:
31
31
  rubocop:
32
32
  runs-on: ubuntu-latest
33
33
  steps:
34
- - uses: actions/checkout@v2
34
+ - uses: actions/checkout@v4
35
35
  - name: Set up Ruby
36
36
  uses: ruby/setup-ruby@v1
37
37
  with:
data/ChangeLog.md CHANGED
@@ -1,3 +1,30 @@
1
+ ### 1.0.4 / 2023-12-15
2
+
3
+ * Fixed a bug in {Array#pack} where complex types (ex: `[[:uint32, 4], 10]`)
4
+ were not being packed correctly.
5
+ * Fixed a bug in {String#unpack} where complex types (ex: `[[:uint32, 4], 10]`)
6
+ were not being unpacked correctly.
7
+ * Fixed a bug in {Ronin::Support::Binary::CTypes::ObjectType#initialize} when
8
+ the object's type has an infinite size, such as an unbounded Array type.
9
+ * Allow using non-RSA keys in all SSL/TLS methods.
10
+
11
+ ### 1.0.3 / 2023-09-19
12
+
13
+ * {Ronin::Support::Crypto::Cert::Name#entries} now returns UTF-8 encoded
14
+ Strings.
15
+ * {Ronin::Support::Crypto::Cert.Name} now passes through
16
+ {Ronin::Support::Crypto::Cert::Name} objects instead of copying them.
17
+ * Fixed a bug in {Ronin::Support::Crypto::Cert.generate} when it is given a
18
+ `OpenSSL::PKey::EC` signing key.
19
+ * Fixed a bug in {Ronin::Support::Network::SSL::Mixin#ssl_connect} where the
20
+ `OpenSSL::SSL::SSLSocket#hostname` attribute was not being set to the
21
+ host being connected to, which prevented connecting to TLS servers that use
22
+ SNI.
23
+ * Fixed {Ronin::Support::Network::IP#set} to return `self`.
24
+ * Fixed {Ronin::Support::Network::IP#inspect} to call the lazy-initialized
25
+ {Ronin::Support::Network::IP#address} method instead of the `@address`
26
+ instance variable directly.
27
+
1
28
  ### 1.0.2 / 2023-06-09
2
29
 
3
30
  * Fixed a bug in {Ronin::Support::Encoding::Base32.decode},
data/README.md CHANGED
@@ -8,7 +8,6 @@
8
8
  * [Issues](https://github.com/ronin-rb/ronin-support/issues)
9
9
  * [Documentation](https://ronin-rb.dev/docs/ronin-support/frames)
10
10
  * [Discord](https://discord.gg/6WAb3PsVX9) |
11
- [Twitter](https://twitter.com/ronin_rb) |
12
11
  [Mastodon](https://infosec.exchange/@ronin_rb)
13
12
 
14
13
  ## Description
@@ -41,6 +41,11 @@ class Array
41
41
  # :mips, :mips_le, :mips64, :mips64_le, nil] :arch
42
42
  # The desired architecture to pack the data for.
43
43
  #
44
+ # @option kwargs [:linux, :macos, :windows,
45
+ # :android, :apple_ios, :bsd,
46
+ # :freebsd, :openbsd, :netbsd] :os
47
+ # The Operating System (OS) to use.
48
+ #
44
49
  # @return [String]
45
50
  # The packed Array.
46
51
  #
@@ -67,8 +72,8 @@ class Array
67
72
  if (arguments.length == 1 && arguments.first.kind_of?(String))
68
73
  pack_original(arguments.first)
69
74
  else
70
- format = Ronin::Support::Binary::Template.new(arguments,**kwargs)
71
- pack_original(format.pack_string)
75
+ template = Ronin::Support::Binary::Template.new(arguments,**kwargs)
76
+ template.pack(*self)
72
77
  end
73
78
  end
74
79
 
@@ -43,6 +43,11 @@ class String
43
43
  # :mips, :mips_le, :mips64, :mips64_le, nil] :arch
44
44
  # The desired architecture that the data was packed for.
45
45
  #
46
+ # @option kwargs [:linux, :macos, :windows,
47
+ # :android, :apple_ios, :bsd,
48
+ # :freebsd, :openbsd, :netbsd] :os
49
+ # The Operating System (OS) to use.
50
+ #
46
51
  # @return [Array]
47
52
  # The values unpacked from the String.
48
53
  #
@@ -69,8 +74,8 @@ class String
69
74
  if (arguments.length == 1 && arguments.first.kind_of?(String))
70
75
  unpack_original(arguments.first)
71
76
  else
72
- format = Ronin::Support::Binary::Template.new(arguments,**kwargs)
73
- unpack_original(format.pack_string)
77
+ template = Ronin::Support::Binary::Template.new(arguments,**kwargs)
78
+ template.unpack(self)
74
79
  end
75
80
  end
76
81
 
@@ -45,7 +45,13 @@ module Ronin
45
45
  def initialize(size)
46
46
  @size = size
47
47
 
48
- super(pack_string: "a#{@size}")
48
+ super(
49
+ pack_string: if size.finite?
50
+ "a#{@size}"
51
+ else
52
+ 'a*'
53
+ end
54
+ )
49
55
  end
50
56
 
51
57
  end
@@ -44,7 +44,7 @@ module Ronin
44
44
  typedef :long, :__blkcnt_t
45
45
  typedef :long, :__blksize_t
46
46
  typedef :long, :blksize_t
47
- typedef types::POINTER, :__caddr_t
47
+ typedef :pointer, :__caddr_t
48
48
  typedef :int, :__clockid_t
49
49
  typedef :int, :clockid_t
50
50
  typedef :long, :__clock_t
@@ -170,7 +170,7 @@ module Ronin
170
170
  typedef :uint, :nlink_t
171
171
  typedef :long_long, :__off64_t
172
172
  typedef :long_long, :off_t
173
- typedef types::POINTER, :__qaddr_t
173
+ typedef :pointer, :__qaddr_t
174
174
  typedef :long_long, :__quad_t
175
175
  typedef :long_long, :quad_t
176
176
  typedef :ulong_long, :__rlim64_t
@@ -132,11 +132,16 @@ module Ronin
132
132
  # :arm64, :arm64_le, :arm64_be] :arch
133
133
  # The desired architecture for the values within the template.
134
134
  #
135
+ # @option kwargs [:linux, :macos, :windows,
136
+ # :android, :apple_ios, :bsd,
137
+ # :freebsd, :openbsd, :netbsd] :os
138
+ # The Operating System (OS) to use.
139
+ #
135
140
  # @raise [ArgumentError]
136
141
  # A given type is not known.
137
142
  #
138
143
  # @example
139
- # template = Template.new([:uint32, [:char, 100]])
144
+ # template = Template.new([:uint32, [:char, 10]])
140
145
  # template.pack(0x123456, ['A', 'B', 'C'])
141
146
  # # => "CBA\x00XYZ\x00\x00\x00\x00\x00\x00\x00"
142
147
  # template.unpack("CBA\x00XYZ\x00\x00\x00\x00\x00\x00\x00")
@@ -164,9 +169,39 @@ module Ronin
164
169
  end
165
170
  end
166
171
 
172
+ #
173
+ # Alias for `Template.new`.
174
+ #
175
+ # @param [::Array<Symbol, (Symbol, Integer)>] fields
176
+ # The C-types which the packer will use.
177
+ #
178
+ # @param [Hash{Symbol => Object}] kwargs
179
+ # Additional keyword arguments.
180
+ #
181
+ # @option kwargs [:little, :big, :net, nil] :endian
182
+ # The desired endianness of the values within the template.
183
+ #
184
+ # @option kwargs [:x86, :x86_64,
185
+ # :ppc, :ppc64,
186
+ # :mips, :mips_le, :mips_be,
187
+ # :mips64, :mips64_le, :mips64_be,
188
+ # :arm, :arm_le, :arm_be,
189
+ # :arm64, :arm64_le, :arm64_be] :arch
190
+ # The desired architecture for the values within the template.
191
+ #
192
+ # @option kwargs [:linux, :macos, :windows,
193
+ # :android, :apple_ios, :bsd,
194
+ # :freebsd, :openbsd, :netbsd] :os
195
+ # The Operating System (OS) to use.
196
+ #
197
+ # @return [Template]
198
+ # The new template object.
199
+ #
200
+ # @raise [ArgumentError]
201
+ # A given type is not known.
167
202
  #
168
203
  # @example
169
- # template = Template.new[:uint32, [:char, 10]]
204
+ # template = Template[:uint32, [:char, 10]]
170
205
  # template.pack(0x123456, ['A', 'B', 'C'])
171
206
  # # => "CBA\x00XYZ\x00\x00\x00\x00\x00\x00\x00"
172
207
  # template.unpack("CBA\x00XYZ\x00\x00\x00\x00\x00\x00\x00")
@@ -26,6 +26,8 @@ module Ronin
26
26
  #
27
27
  # ## Example
28
28
  #
29
+ # require 'ronin/support/cli/io_shell'
30
+ #
29
31
  # socket = TCPSocket.new('irc.undernet.org',6667)
30
32
  # CLI::IOShell.sstart(socket)
31
33
  #
@@ -18,6 +18,7 @@
18
18
 
19
19
  require 'ronin/support/crypto/openssl'
20
20
  require 'ronin/support/crypto/key/rsa'
21
+ require 'ronin/support/crypto/key/ec'
21
22
 
22
23
  module Ronin
23
24
  module Support
@@ -83,7 +84,9 @@ module Ronin
83
84
  # @return [Hash{String => String}]
84
85
  #
85
86
  def entries
86
- @entries ||= to_a.to_h { |(oid,value,type)| [oid, value] }
87
+ @entries ||= to_a.to_h do |(oid,value,type)|
88
+ [oid, value && value.force_encoding(Encoding::UTF_8)]
89
+ end
87
90
  end
88
91
 
89
92
  alias to_h entries
@@ -160,7 +163,7 @@ module Ronin
160
163
  #
161
164
  # Coerces a value into a {Name} object.
162
165
  #
163
- # @param [String, Hash, OpenSSL::X509::Name] name
166
+ # @param [String, Hash, OpenSSL::X509::Name, Name] name
164
167
  # The name value to coerce.
165
168
  #
166
169
  # @return [Cert::Name]
@@ -170,8 +173,9 @@ module Ronin
170
173
  #
171
174
  def self.Name(name)
172
175
  case name
173
- when String then Name.parse(name)
174
- when Hash then Name.build(**name)
176
+ when String then Name.parse(name)
177
+ when Hash then Name.build(**name)
178
+ when Name then name
175
179
  when OpenSSL::X509::Name
176
180
  new_name = Name.allocate
177
181
  new_name.send(:initialize_copy,name)
@@ -269,7 +273,7 @@ module Ronin
269
273
  # key: key,
270
274
  # subject: {
271
275
  # common_name: 'localhost',
272
- # organization: 'Test Co..',
276
+ # organization: 'Test Co.',
273
277
  # organizational_unit: 'Test Dept',
274
278
  # locality: 'Test City',
275
279
  # state: 'XX',
@@ -288,7 +292,7 @@ module Ronin
288
292
  # key: ca_key,
289
293
  # subject: {
290
294
  # common_name: 'Test CA',
291
- # organization: 'Test CA, Inc..',
295
+ # organization: 'Test CA, Inc.',
292
296
  # organizational_unit: 'Test Dept',
293
297
  # locality: 'Test City',
294
298
  # state: 'XX',
@@ -309,7 +313,7 @@ module Ronin
309
313
  # ca_cert: ca_cert,
310
314
  # subject: {
311
315
  # common_name: 'test.com',
312
- # organization: 'Test Co..',
316
+ # organization: 'Test Co.',
313
317
  # organizational_unit: 'Test Dept',
314
318
  # locality: 'Test City',
315
319
  # state: 'XX',
@@ -343,7 +347,10 @@ module Ronin
343
347
 
344
348
  cert.not_before = not_before
345
349
  cert.not_after = not_after
346
- cert.public_key = key.public_key
350
+ cert.public_key = case key
351
+ when OpenSSL::PKey::EC then key
352
+ else key.public_key
353
+ end
347
354
  cert.subject = Name(subject) if subject
348
355
  cert.issuer = if ca_cert then ca_cert.subject
349
356
  else cert.subject
@@ -491,7 +498,7 @@ module Ronin
491
498
  #
492
499
  # Coerces a value into a {Cert} object.
493
500
  #
494
- # @param [String, OpenSSL::X509::Certificate] cert
501
+ # @param [String, OpenSSL::X509::Certificate, Cert] cert
495
502
  # The certificate String or `OpenSSL::X509::Certificate` value.
496
503
  #
497
504
  # @return [Cert]
@@ -505,6 +512,7 @@ module Ronin
505
512
  def self.Cert(cert)
506
513
  case cert
507
514
  when String then Cert.parse(cert)
515
+ when Cert then cert
508
516
  when OpenSSL::X509::Certificate
509
517
  new_cert = Cert.allocate
510
518
  new_cert.send(:initialize_copy,cert)
@@ -78,7 +78,7 @@ class Integer
78
78
  # The `format:` or `case:` keyword argument is invalid.
79
79
  #
80
80
  # @example
81
- # 0x41.html_enocde
81
+ # 0x41.html_encode
82
82
  # # => "&#65;"
83
83
  #
84
84
  # @example Zero-padding:
@@ -182,7 +182,7 @@ module Ronin
182
182
  # The HTTP method to use for the request.
183
183
  #
184
184
  # @param [URI::HTTP, Addressable::URI, String] url
185
- # Optional URL to create the HTTP request for.
185
+ # The URL to create the HTTP request for.
186
186
  #
187
187
  # @!macro request_kwargs
188
188
  # @!macro connect_kwargs
@@ -215,7 +215,7 @@ module Ronin
215
215
  # The HTTP method to use for the request.
216
216
  #
217
217
  # @param [URI::HTTP, Addressable::URI, String] url
218
- # Optional URL to create the HTTP request for.
218
+ # The URL to create the HTTP request for.
219
219
  #
220
220
  # @!macro request_kwargs
221
221
  # @!macro connect_kwargs
@@ -240,7 +240,7 @@ module Ronin
240
240
  # The HTTP method to use for the request.
241
241
  #
242
242
  # @param [URI::HTTP, Addressable::URI, String] url
243
- # Optional URL to create the HTTP request for.
243
+ # The URL to create the HTTP request for.
244
244
  #
245
245
  # @!macro request_kwargs
246
246
  # @!macro connect_kwargs
@@ -263,7 +263,7 @@ module Ronin
263
263
  # The HTTP method to use for the request.
264
264
  #
265
265
  # @param [URI::HTTP, Addressable::URI, String] url
266
- # Optional URL to create the HTTP request for.
266
+ # The URL to create the HTTP request for.
267
267
  #
268
268
  # @!macro request_kwargs
269
269
  # @!macro connect_kwargs
@@ -285,7 +285,7 @@ module Ronin
285
285
  # Sends an HTTP request and returns the `Server` header.
286
286
  #
287
287
  # @param [URI::HTTP, Addressable::URI, String] url
288
- # Optional URL to create the HTTP request for.
288
+ # The URL to create the HTTP request for.
289
289
  #
290
290
  # @!macro connect_kwargs
291
291
  # @!macro request_kwargs
@@ -307,7 +307,7 @@ module Ronin
307
307
  # Sends an HTTP request and returns the `X-Powered-By` header.
308
308
  #
309
309
  # @param [URI::HTTP, Addressable::URI, String] url
310
- # Optional URL to create the HTTP request for.
310
+ # The URL to create the HTTP request for.
311
311
  #
312
312
  # @!macro request_kwargs
313
313
  # @!macro connect_kwargs
@@ -332,7 +332,7 @@ module Ronin
332
332
  # The HTTP method to use for the request.
333
333
  #
334
334
  # @param [URI::HTTP, Addressable::URI, String] url
335
- # Optional URL to create the HTTP request for.
335
+ # The URL to create the HTTP request for.
336
336
  #
337
337
  # @!macro request_kwargs
338
338
  # @!macro connect_kwargs
@@ -354,7 +354,7 @@ module Ronin
354
354
  # Performs a `COPY` request for the given URI.
355
355
  #
356
356
  # @param [URI::HTTP, Addressable::URI, String] url
357
- # Optional URL to create the HTTP request for.
357
+ # The URL to create the HTTP request for.
358
358
  #
359
359
  # @!macro request_kwargs
360
360
  # @!macro connect_kwargs
@@ -372,15 +372,15 @@ module Ronin
372
372
  #
373
373
  # @api public
374
374
  #
375
- def http_copy(url, ssl: nil, **kwargs)
376
- Network::HTTP.copy(url, ssl: ssl, **kwargs)
375
+ def http_copy(url, ssl: nil, **kwargs,&block)
376
+ Network::HTTP.copy(url, ssl: ssl, **kwargs,&block)
377
377
  end
378
378
 
379
379
  #
380
380
  # Performs a `DELETE` request for the given URI.
381
381
  #
382
382
  # @param [URI::HTTP, Addressable::URI, String] url
383
- # Optional URL to create the HTTP request for.
383
+ # The URL to create the HTTP request for.
384
384
  #
385
385
  # @!macro request_kwargs
386
386
  # @!macro connect_kwargs
@@ -406,7 +406,7 @@ module Ronin
406
406
  # Performs a `GET` request for the given URI.
407
407
  #
408
408
  # @param [URI::HTTP, Addressable::URI, String] url
409
- # Optional URL to create the HTTP request for.
409
+ # The URL to create the HTTP request for.
410
410
  #
411
411
  # @!macro request_kwargs
412
412
  # @!macro connect_kwargs
@@ -433,7 +433,7 @@ module Ronin
433
433
  # headers.
434
434
  #
435
435
  # @param [URI::HTTP, Addressable::URI, String] url
436
- # Optional URL to create the HTTP request for.
436
+ # The URL to create the HTTP request for.
437
437
  #
438
438
  # @!macro request_kwargs
439
439
  # @!macro connect_kwargs
@@ -456,7 +456,7 @@ module Ronin
456
456
  # header(s).
457
457
  #
458
458
  # @param [URI::HTTP, Addressable::URI, String] url
459
- # Optional URL to create the HTTP request for.
459
+ # The URL to create the HTTP request for.
460
460
  #
461
461
  # @!macro request_kwargs
462
462
  # @!macro connect_kwargs
@@ -477,7 +477,7 @@ module Ronin
477
477
  # body.
478
478
  #
479
479
  # @param [URI::HTTP, Addressable::URI, String] url
480
- # Optional URL to create the HTTP request for.
480
+ # The URL to create the HTTP request for.
481
481
  #
482
482
  # @!macro request_kwargs
483
483
  # @!macro connect_kwargs
@@ -497,7 +497,7 @@ module Ronin
497
497
  # Performs a `HEAD` request for the given URI.
498
498
  #
499
499
  # @param [URI::HTTP, Addressable::URI, String] url
500
- # Optional URL to create the HTTP request for.
500
+ # The URL to create the HTTP request for.
501
501
  #
502
502
  # @!macro request_kwargs
503
503
  # @!macro connect_kwargs
@@ -523,7 +523,7 @@ module Ronin
523
523
  # Performs a `LOCK` request for the given URI.
524
524
  #
525
525
  # @param [URI::HTTP, Addressable::URI, String] url
526
- # Optional URL to create the HTTP request for.
526
+ # The URL to create the HTTP request for.
527
527
  #
528
528
  # @!macro request_kwargs
529
529
  # @!macro connect_kwargs
@@ -549,7 +549,7 @@ module Ronin
549
549
  # Performs a `MKCOL` request for the given URI.
550
550
  #
551
551
  # @param [URI::HTTP, Addressable::URI, String] url
552
- # Optional URL to create the HTTP request for.
552
+ # The URL to create the HTTP request for.
553
553
  #
554
554
  # @!macro request_kwargs
555
555
  # @!macro connect_kwargs
@@ -575,7 +575,7 @@ module Ronin
575
575
  # Performs a `MOVE` request for the given URI.
576
576
  #
577
577
  # @param [URI::HTTP, Addressable::URI, String] url
578
- # Optional URL to create the HTTP request for.
578
+ # The URL to create the HTTP request for.
579
579
  #
580
580
  # @!macro request_kwargs
581
581
  # @!macro connect_kwargs
@@ -601,7 +601,7 @@ module Ronin
601
601
  # Performs a `OPTIONS` request for the given URI.
602
602
  #
603
603
  # @param [URI::HTTP, Addressable::URI, String] url
604
- # Optional URL to create the HTTP request for.
604
+ # The URL to create the HTTP request for.
605
605
  #
606
606
  # @!macro request_kwargs
607
607
  # @!macro connect_kwargs
@@ -628,17 +628,11 @@ module Ronin
628
628
  # `Allow` response header.
629
629
  #
630
630
  # @param [URI::HTTP, Addressable::URI, String] url
631
- # Optional URL to create the HTTP request for.
631
+ # The URL to create the HTTP request for.
632
632
  #
633
633
  # @!macro request_kwargs
634
634
  # @!macro connect_kwargs
635
635
  #
636
- # @yield [response]
637
- # If a block is given it will be passed the received HTTP response.
638
- #
639
- # @yieldparam [Net::HTTPRresponse] response
640
- # The received HTTP response object.
641
- #
642
636
  # @return [Array<Symbol>]
643
637
  # The allowed HTTP request methods for the given URL.
644
638
  #
@@ -646,15 +640,15 @@ module Ronin
646
640
  #
647
641
  # @api public
648
642
  #
649
- def http_allowed_methods(url, ssl: nil, **kwargs,&block)
650
- Network::HTTP.allowed_methods(url, ssl: ssl, **kwargs,&block)
643
+ def http_allowed_methods(url, ssl: nil, **kwargs)
644
+ Network::HTTP.allowed_methods(url, ssl: ssl, **kwargs)
651
645
  end
652
646
 
653
647
  #
654
648
  # Performs a `PATCH` request for the given URI.
655
649
  #
656
650
  # @param [URI::HTTP, Addressable::URI, String] url
657
- # Optional URL to create the HTTP request for.
651
+ # The URL to create the HTTP request for.
658
652
  #
659
653
  # @!macro request_kwargs
660
654
  # @!macro connect_kwargs
@@ -682,7 +676,7 @@ module Ronin
682
676
  # Performs a `POST` request for the given URI.
683
677
  #
684
678
  # @param [URI::HTTP, Addressable::URI, String] url
685
- # Optional URL to create the HTTP request for.
679
+ # The URL to create the HTTP request for.
686
680
  #
687
681
  # @!macro request_kwargs
688
682
  # @!macro connect_kwargs
@@ -709,7 +703,7 @@ module Ronin
709
703
  # headers.
710
704
  #
711
705
  # @param [URI::HTTP, Addressable::URI, String] url
712
- # Optional URL to create the HTTP request for.
706
+ # The URL to create the HTTP request for.
713
707
  #
714
708
  # @!macro request_kwargs
715
709
  # @!macro connect_kwargs
@@ -732,7 +726,7 @@ module Ronin
732
726
  # response body.
733
727
  #
734
728
  # @param [URI::HTTP, Addressable::URI, String] url
735
- # Optional URL to create the HTTP request for.
729
+ # The URL to create the HTTP request for.
736
730
  #
737
731
  # @!macro request_kwargs
738
732
  # @!macro connect_kwargs
@@ -752,7 +746,7 @@ module Ronin
752
746
  # Performs a `PROPFIND` request for the given URI.
753
747
  #
754
748
  # @param [URI::HTTP, Addressable::URI, String] url
755
- # Optional URL to create the HTTP request for.
749
+ # The URL to create the HTTP request for.
756
750
  #
757
751
  # @!macro request_kwargs
758
752
  # @!macro connect_kwargs
@@ -780,7 +774,7 @@ module Ronin
780
774
  # Performs a `PROPPATCH` request for the given URI.
781
775
  #
782
776
  # @param [URI::HTTP, Addressable::URI, String] url
783
- # Optional URL to create the HTTP request for.
777
+ # The URL to create the HTTP request for.
784
778
  #
785
779
  # @!macro request_kwargs
786
780
  # @!macro connect_kwargs
@@ -808,7 +802,7 @@ module Ronin
808
802
  # Performs a `PUT` request for the given URI.
809
803
  #
810
804
  # @param [URI::HTTP, Addressable::URI, String] url
811
- # Optional URL to create the HTTP request for.
805
+ # The URL to create the HTTP request for.
812
806
  #
813
807
  # @!macro request_kwargs
814
808
  # @!macro connect_kwargs
@@ -836,7 +830,7 @@ module Ronin
836
830
  # Performs a `TRACE` request for the given URI.
837
831
  #
838
832
  # @param [URI::HTTP, Addressable::URI, String] url
839
- # Optional URL to create the HTTP request for.
833
+ # The URL to create the HTTP request for.
840
834
  #
841
835
  # @!macro request_kwargs
842
836
  # @!macro connect_kwargs
@@ -862,7 +856,7 @@ module Ronin
862
856
  # Performs a `UNLOCK` request for the given URI.
863
857
  #
864
858
  # @param [URI::HTTP, Addressable::URI, String] url
865
- # Optional URL to create the HTTP request for.
859
+ # The URL to create the HTTP request for.
866
860
  #
867
861
  # @!macro request_kwargs
868
862
  # @!macro connect_kwargs
@@ -116,6 +116,8 @@ module Ronin
116
116
  # @param [Integer] family
117
117
  # Optional IP address family.
118
118
  #
119
+ # @return [self]
120
+ #
119
121
  # @api private
120
122
  #
121
123
  def set(addr,*family)
@@ -123,6 +125,7 @@ module Ronin
123
125
 
124
126
  # unset the cached IP address since the numeric address has changed
125
127
  @address = nil
128
+ return self
126
129
  end
127
130
 
128
131
  public
@@ -557,7 +560,7 @@ module Ronin
557
560
  # The inspected IP object.
558
561
  #
559
562
  def inspect
560
- "#<#{self.class}: #{@address}>"
563
+ "#<#{self.class}: #{address}>"
561
564
  end
562
565
 
563
566
  end
@@ -267,6 +267,8 @@ module Ronin
267
267
  socket = tcp_connect(host,port,bind_host: bind_host,
268
268
  bind_port: bind_port)
269
269
  ssl_socket = ssl_socket(socket,**kwargs)
270
+
271
+ ssl_socket.hostname = host
270
272
  ssl_socket.connect
271
273
 
272
274
  if block_given?
@@ -16,7 +16,8 @@
16
16
  # along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
17
17
  #
18
18
 
19
- require 'ronin/support/network/ssl/openssl'
19
+ require 'ronin/support/crypto/openssl'
20
+ require 'ronin/support/crypto/key'
20
21
  require 'ronin/support/network/ssl/local_key'
21
22
  require 'ronin/support/network/ssl/local_cert'
22
23
  require 'ronin/support/network/ssl/proxy'
@@ -148,7 +149,7 @@ module Ronin
148
149
  context.verify_mode = VERIFY[verify]
149
150
 
150
151
  if (key_file || key) && (cert_file || cert)
151
- context.key = if key_file then Crypto::Key::RSA.load_file(key_file)
152
+ context.key = if key_file then Crypto::Key.load_file(key_file)
152
153
  else key
153
154
  end
154
155
 
@@ -51,7 +51,7 @@ module Ronin
51
51
  length = string.length.to_f
52
52
  entropy = 0.0
53
53
 
54
- char_counts.each do |char,count|
54
+ char_counts.each_value do |count|
55
55
  freq = count / length
56
56
  entropy -= freq * Math.log(freq,base)
57
57
  end
@@ -19,6 +19,6 @@
19
19
  module Ronin
20
20
  module Support
21
21
  # ronin-support version
22
- VERSION = '1.0.2'
22
+ VERSION = '1.0.4'
23
23
  end
24
24
  end
data/lib/ronin/support.rb CHANGED
@@ -28,6 +28,20 @@ require 'ronin/support/text'
28
28
  require 'ronin/support/version'
29
29
 
30
30
  module Ronin
31
+ #
32
+ # Top-level namespace for `ronin-support`.
33
+ #
34
+ # ## Example
35
+ #
36
+ # require 'ronin/support'
37
+ # include Ronin::Support
38
+ #
39
+ # "hello world".base64_encode
40
+ # # => "aGVsbG8gd29ybGQ=\n"
41
+ #
42
+ # http_get 'https://example.com/'
43
+ # # => #<Net::HTTPOK 200 OK readbody=true>
44
+ #
31
45
  module Support
32
46
  include Mixin
33
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-09 00:00:00.000000000 Z
11
+ date: 2023-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chars