ssh_scan 0.0.9 → 0.0.10.beta.1
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.
- checksums.yaml +4 -4
- data/lib/ssh_scan/scan_engine.rb +39 -26
- data/lib/ssh_scan/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc658367e83ea612b5d9dc210e0b050adffaa80c
|
4
|
+
data.tar.gz: 9fc7ed603f1dab9250b31e38d50e0b5907b75991
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df7fd981d2356f4129ee20a481540f64ce12011014af63eb24170cfeb3233c297aefbc8fbda4b093030791b253410737b729db05014e97dcd1b7a192378e37de
|
7
|
+
data.tar.gz: 3ddf2ad7d0a9e8115246f9e123063bce9c8a65b8cbbb68a1390758c715003ec3ba29164e3ead55ba4a09bfec617888fc46fd10010c33d5d496bebdbe8530d4cb
|
data/lib/ssh_scan/scan_engine.rb
CHANGED
@@ -17,37 +17,50 @@ module SSHScan
|
|
17
17
|
client.connect()
|
18
18
|
result.push(client.get_kex_result())
|
19
19
|
|
20
|
-
# Connect and get results (Net-SSH)
|
21
|
-
net_ssh_session = Net::SSH::Transport::Session.new(target, :port => port)
|
22
|
-
auth_session = Net::SSH::Authentication::Session.new(net_ssh_session, :auth_methods => ["none"])
|
23
|
-
auth_session.authenticate("none", "test", "test")
|
24
|
-
result[index]['auth_methods'] = auth_session.allowed_auth_methods
|
25
|
-
host_key = net_ssh_session.host_keys.first
|
26
|
-
net_ssh_session.close
|
27
|
-
|
28
20
|
fingerprint_md5 = nil
|
29
21
|
fingerprint_sha1 = nil
|
30
22
|
fingerprint_sha256 = nil
|
31
23
|
|
32
|
-
#
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
]
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
24
|
+
# Connect and get results (Net-SSH)
|
25
|
+
begin
|
26
|
+
net_ssh_session = Net::SSH::Transport::Session.new(target, :port => port)
|
27
|
+
auth_session = Net::SSH::Authentication::Session.new(net_ssh_session, :auth_methods => ["none"])
|
28
|
+
auth_session.authenticate("none", "test", "test")
|
29
|
+
result[index]['auth_methods'] = auth_session.allowed_auth_methods
|
30
|
+
host_key = net_ssh_session.host_keys.first
|
31
|
+
net_ssh_session.close
|
32
|
+
|
33
|
+
#only supporting RSA for the moment
|
34
|
+
if host_key.is_a?(OpenSSL::PKey::RSA)
|
35
|
+
data_string = OpenSSL::ASN1::Sequence([
|
36
|
+
OpenSSL::ASN1::Integer.new(host_key.public_key.n),
|
37
|
+
OpenSSL::ASN1::Integer.new(host_key.public_key.e)
|
38
|
+
])
|
45
39
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
fingerprint_md5 = OpenSSL::Digest::MD5.hexdigest(data_string.to_der).scan(/../).join(':')
|
41
|
+
fingerprint_sha1 = OpenSSL::Digest::SHA1.hexdigest(data_string.to_der).scan(/../).join(':')
|
42
|
+
fingerprint_sha256 = OpenSSL::Digest::SHA256.hexdigest(data_string.to_der).scan(/../).join(':')
|
43
|
+
|
44
|
+
result[index]['fingerprints'] = {
|
45
|
+
"md5" => fingerprint_md5,
|
46
|
+
"sha1" => fingerprint_sha1,
|
47
|
+
"sha256" => fingerprint_sha256,
|
48
|
+
}
|
49
|
+
else
|
50
|
+
warn("WARNING: Host key support for #{host_key.class} is not provided yet (fingerprints will not be available)")
|
51
|
+
result[index]['fingerprints'] = {}
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
rescue Net::SSH::Exception => e
|
56
|
+
if e.to_s.match(/could not settle on encryption_client algorithm/)
|
57
|
+
warn("WARNING: net-ssh could not find a mutually acceptable encryption algorithm (fingerprints and auth_methods will not be available)")
|
58
|
+
result[index]['auth_methods'] = []
|
59
|
+
result[index]['fingerprints'] = {}
|
60
|
+
else
|
61
|
+
raise e
|
62
|
+
end
|
63
|
+
end
|
51
64
|
|
52
65
|
# If policy defined, then add compliance results
|
53
66
|
unless policy.nil?
|
data/lib/ssh_scan/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssh_scan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Claudius
|
@@ -164,9 +164,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
|
-
- - "
|
167
|
+
- - ">"
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version:
|
169
|
+
version: 1.3.1
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project:
|
172
172
|
rubygems_version: 2.6.2
|