ssh_scan 0.0.9 → 0.0.10.beta.1

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
  SHA1:
3
- metadata.gz: 6ab6ade0f667010fdd604bbf4e0a166319c0e332
4
- data.tar.gz: a2d102a46eca3c35ae5e9eda0c2d714b5cce415b
3
+ metadata.gz: fc658367e83ea612b5d9dc210e0b050adffaa80c
4
+ data.tar.gz: 9fc7ed603f1dab9250b31e38d50e0b5907b75991
5
5
  SHA512:
6
- metadata.gz: 509adb5236bcb0aea6489a266d0c3ef1f9312d6c4b7860156c6174614014288441d73209110fe7ccc8cee6dc26bb1001e0585e1b1340026a8af8ec84e926b659
7
- data.tar.gz: 3d327bf76e6c9f9211f506bee4ab52cfd28fd0b4560f37578a5bc9d6fea81bda475ac3c3edb3e45c5a2b7c59ce082b58853233399a0a9720074ebf9ece8287b4
6
+ metadata.gz: df7fd981d2356f4129ee20a481540f64ce12011014af63eb24170cfeb3233c297aefbc8fbda4b093030791b253410737b729db05014e97dcd1b7a192378e37de
7
+ data.tar.gz: 3ddf2ad7d0a9e8115246f9e123063bce9c8a65b8cbbb68a1390758c715003ec3ba29164e3ead55ba4a09bfec617888fc46fd10010c33d5d496bebdbe8530d4cb
@@ -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
- # only supporting RSA for the moment
33
- if host_key.is_a?(OpenSSL::PKey::RSA)
34
- data_string = OpenSSL::ASN1::Sequence([
35
- OpenSSL::ASN1::Integer.new(host_key.public_key.n),
36
- OpenSSL::ASN1::Integer.new(host_key.public_key.e)
37
- ])
38
-
39
- fingerprint_md5 = OpenSSL::Digest::MD5.hexdigest(data_string.to_der).scan(/../).join(':')
40
- fingerprint_sha1 = OpenSSL::Digest::SHA1.hexdigest(data_string.to_der).scan(/../).join(':')
41
- fingerprint_sha256 = OpenSSL::Digest::SHA256.hexdigest(data_string.to_der).scan(/../).join(':')
42
- else
43
- warn("Host key support for #{host_key.class} is not provided yet, fingerprints will not be available")
44
- end
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
- result[index]['fingerprints'] = {
47
- "md5" => fingerprint_md5,
48
- "sha1" => fingerprint_sha1,
49
- "sha256" => fingerprint_sha256,
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?
@@ -1,3 +1,3 @@
1
1
  module SSHScan
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10.beta.1'
3
3
  end
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.9
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: '0'
169
+ version: 1.3.1
170
170
  requirements: []
171
171
  rubyforge_project:
172
172
  rubygems_version: 2.6.2