ronin-support 1.0.2 → 1.0.3

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: 3f47bb5e6e9e8b720f2b2e66cfd1eb49bcb4562e5ed0025a3ed491ee7e39f106
4
+ data.tar.gz: a68c5f263d3d7caf40f789354e51a977ada25c52cb7a93f58c4c10208c40da67
5
5
  SHA512:
6
- metadata.gz: f927d978f7af471f00bac7b97cc2bc9244df4b04683af3f6ce89ae6988d8f09cf7b28c16422673414a55b2711c9db05695afa0ffae35b1889b0c35117b7597fa
7
- data.tar.gz: 519478e67e3fd01efa02d800d4badb66ce21a867165f300d4310e5a2a4411614ecacd7292c8095b8cef3ae444306b4402cf96e54fb5054f9d4eeb3d19350a335
6
+ metadata.gz: 302af7c9324ba08daff8107236734c211b10f969723f55cac2843ec52a5e367357c1b3c06d4138215553960a994ae4c3338e3a4302105979fedb1dac51b2cc20
7
+ data.tar.gz: 542b8b0d1caab51fce5fedf516b3b849c2a673492995916db6a43b3522090cd8bb1acc1b3200741832153e874522fcd60eae76f74e2aa90bb76d57dafb6daa1e
data/ChangeLog.md CHANGED
@@ -1,3 +1,20 @@
1
+ ### 1.0.3 / 2023-09-19
2
+
3
+ * {Ronin::Support::Crypto::Cert::Name#entries} now returns UTF-8 encoded
4
+ Strings.
5
+ * {Ronin::Support::Crypto::Cert.Name} now passes through
6
+ {Ronin::Support::Crypto::Cert::Name} objects instead of copying them.
7
+ * Fixed a bug in {Ronin::Support::Crypto::Cert.generate} when it is given a
8
+ `OpenSSL::PKey::EC` signing key.
9
+ * Fixed a bug in {Ronin::Support::Network::SSL::Mixin#ssl_connect} where the
10
+ `OpenSSL::SSL::SSLSocket#hostname` attribute was not being set to the
11
+ host being connected to, which prevented connecting to TLS servers that use
12
+ SNI.
13
+ * Fixed {Ronin::Support::Network::IP#set} to return `self`.
14
+ * Fixed {Ronin::Support::Network::IP#inspect} to call the lazy-initialized
15
+ {Ronin::Support::Network::IP#address} method instead of the `@address`
16
+ instance variable directly.
17
+
1
18
  ### 1.0.2 / 2023-06-09
2
19
 
3
20
  * 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
@@ -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)
@@ -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?
@@ -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.3'
23
23
  end
24
24
  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.3
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-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chars