rex-socket 0.1.17 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rex/socket/parameters.rb +12 -0
- data/lib/rex/socket/ssl.rb +5 -7
- data/lib/rex/socket/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dd18788e55337f4c64c6a2b5bdc221b897a4ca9
|
4
|
+
data.tar.gz: 4b7d5ec7e28ea4cfecd8e3eeff2bb3fafd116882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f8e493f4349b58068e7c33e1e5b116290ddd35b96f6eda50dc7577c61fb845999730e398c359773a5ddf05628a387ef41b9eb3f2ebd0f69da8c12d90e007c1c
|
7
|
+
data.tar.gz: 5532feff68e43c54f1c32318bae095097a1e9fd1b2d243e8f5582a8972f10a326221a69551781f7aad62ec9600e98e437a1e2eba5ff1d07978f25879196355d5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -140,6 +140,14 @@ class Rex::Socket::Parameters
|
|
140
140
|
self.ssl_cipher = hash['SSLCipher']
|
141
141
|
end
|
142
142
|
|
143
|
+
if (hash['VHOST'])
|
144
|
+
self.ssl_cn = hash['VHOST']
|
145
|
+
end
|
146
|
+
|
147
|
+
if (hash['SSLCommonName'])
|
148
|
+
self.ssl_cn = hash['SSLCommonName']
|
149
|
+
end
|
150
|
+
|
143
151
|
if (hash['SSLCert'] and ::File.file?(hash['SSLCert']))
|
144
152
|
begin
|
145
153
|
self.ssl_cert = ::File.read(hash['SSLCert'])
|
@@ -359,6 +367,10 @@ class Rex::Socket::Parameters
|
|
359
367
|
# @return [String,Array]
|
360
368
|
attr_accessor :ssl_cipher
|
361
369
|
|
370
|
+
# Which Common Name to use for certificate
|
371
|
+
# @return [String}
|
372
|
+
attr_accessor :ssl_cn
|
373
|
+
|
362
374
|
# The SSL certificate, in pem format, stored as a string. See
|
363
375
|
# {Rex::Socket::SslTcpServer#makessl}
|
364
376
|
# @return [String]
|
data/lib/rex/socket/ssl.rb
CHANGED
@@ -13,12 +13,10 @@ module Rex::Socket::Ssl
|
|
13
13
|
|
14
14
|
module CertProvider
|
15
15
|
|
16
|
-
def self.ssl_generate_subject
|
16
|
+
def self.ssl_generate_subject(cn = Rex::Text.rand_hostname, org = Rex::Text.rand_name)
|
17
17
|
st = Rex::Text.rand_state
|
18
18
|
loc = Rex::Text.rand_name.capitalize
|
19
|
-
org
|
20
|
-
cn = Rex::Text.rand_hostname
|
21
|
-
"/C=US/ST=#{st}/L=#{loc}/O=#{org}/CN=#{cn}"
|
19
|
+
"/C=US/ST=#{st}/L=#{loc}/O=#{org.capitalize}/CN=#{cn}"
|
22
20
|
end
|
23
21
|
|
24
22
|
def self.ssl_generate_issuer
|
@@ -32,11 +30,11 @@ module Rex::Socket::Ssl
|
|
32
30
|
# certificate. This matches a typical "snakeoil" cert.
|
33
31
|
#
|
34
32
|
# @return [String, String, Array]
|
35
|
-
def self.ssl_generate_certificate
|
33
|
+
def self.ssl_generate_certificate(cn = Rex::Text.rand_hostname, org = Rex::Text.rand_name)
|
36
34
|
yr = 24*3600*365
|
37
35
|
vf = Time.at(Time.now.to_i - rand(yr * 3) - yr)
|
38
36
|
vt = Time.at(vf.to_i + (rand(9)+1) * yr)
|
39
|
-
subject = ssl_generate_subject
|
37
|
+
subject = ssl_generate_subject(cn, org)
|
40
38
|
issuer = ssl_generate_issuer
|
41
39
|
key = OpenSSL::PKey::RSA.new(2048){ }
|
42
40
|
cert = OpenSSL::X509::Certificate.new
|
@@ -119,7 +117,7 @@ module Rex::Socket::Ssl
|
|
119
117
|
if params.ssl_cert
|
120
118
|
key, cert, chain = ssl_parse_pem(params.ssl_cert)
|
121
119
|
else
|
122
|
-
key, cert, chain = ssl_generate_certificate
|
120
|
+
key, cert, chain = ssl_generate_certificate(params.ssl_cn)
|
123
121
|
end
|
124
122
|
|
125
123
|
ctx = OpenSSL::SSL::SSLContext.new()
|
data/lib/rex/socket/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rex-socket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Maloney
|
@@ -88,7 +88,7 @@ cert_chain:
|
|
88
88
|
G+Hmcg1v810agasPdoydE0RTVZgEOOMoQ07qu7JFXVWZ9ZQpHT7qJATWL/b2csFG
|
89
89
|
8mVuTXnyJOKRJA==
|
90
90
|
-----END CERTIFICATE-----
|
91
|
-
date: 2019-
|
91
|
+
date: 2019-06-26 00:00:00.000000000 Z
|
92
92
|
dependencies:
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: bundler
|
metadata.gz.sig
CHANGED
Binary file
|