ssl_labs 0.0.2 → 0.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
  SHA1:
3
- metadata.gz: cf7eb84ab8a2af805d670dc1dabc82ffd511c889
4
- data.tar.gz: 25699a813d19b158d8438e0ce635e42818ad7c52
3
+ metadata.gz: 4e911536b26b35a5b2cef5dceee239996f207bbe
4
+ data.tar.gz: 5f6e2a04d72df5e0af1b5d01db7f469b6cdf5975
5
5
  SHA512:
6
- metadata.gz: 8691a86faa72742401114c35e0ab27fe1e18fc807a9cfbfab1e6404155bd908466cb9011029b7935168ca53e840e620b04c2681b571bfb9023ed04d86b5aad76
7
- data.tar.gz: a8498e9f3b63e761a9c674e9a1b67941b82a1b6a09951839c5ae72a356ec0acbc395c4bfc5d05cb603ac7d5cf444b2e2e3614b7df39cddba08ffb4cf902c95ae
6
+ metadata.gz: fa5492ebcde004e09a293fc31b352d6eb8c600c2dbe93cf176ed12774566bd68a429ae32ca3090d6fa99fd0bdb5348f1543b2c40024803ad1aa2199b76f0a47b
7
+ data.tar.gz: 97582172d80044be14898499d18f0d1c264ca11bef355a9abd1b0a7b3cdec1b6e0422c8f10def9f1380555b179593d6bb0adac2af5de7fa0d95db01a101a0a0f
data/README.md CHANGED
@@ -11,18 +11,12 @@ The reference client is at https://github.com/ssllabs/ssllabs-scan
11
11
 
12
12
  * Tests
13
13
 
14
- * Weirdness: #analyze and #analyze! return different things
14
+ * Weirdness: `#analyze` and `#analyze!` return different things
15
15
 
16
- * Helper #methods? for boolean attributes
16
+ * Helper `#methods?` for boolean attributes
17
17
 
18
- * SslLabs constructor must take a URI string _with a scheme_
19
-
20
- * Gem version is hardcoded twice
18
+ * `SslLabs` constructor must take a URI string _with a scheme_
21
19
 
22
20
  * `endpoint_data.details.foo` is annoying; remove `details`
23
21
 
24
22
  * Configurable poll delay
25
-
26
- * Cert and ChainCert are melded
27
-
28
- * Suites.preference is MIA
data/Rakefile CHANGED
@@ -4,6 +4,8 @@ require 'rake/testtask'
4
4
  require 'rdoc/task'
5
5
  require 'rubygems/package_task'
6
6
 
7
+ load File.join(File.dirname(__FILE__), 'lib', 'ssl_labs', 'version.rb')
8
+
7
9
  desc 'Default task (package)'
8
10
  task :default => [:package]
9
11
 
data/lib/ssl_labs.rb CHANGED
@@ -5,12 +5,10 @@ require 'ssl_labs/api'
5
5
  require 'ssl_labs/endpoint_data'
6
6
  require 'ssl_labs/host'
7
7
  require 'ssl_labs/info'
8
+ require 'ssl_labs/version'
8
9
 
9
10
  class SslLabs
10
11
 
11
- # Gem version.
12
- VERSION = '0.0.2'
13
-
14
12
  # User agent for client.
15
13
  USER_AGENT = "ssl_labs.rb #{VERSION}"
16
14
 
@@ -34,7 +34,7 @@ class SslLabs
34
34
  when *ATTRS
35
35
  endpoint.send("#{sym}=", v)
36
36
  else
37
- raise ArgumentError, "Unknown key #{k.inspect} (#{sym})"
37
+ raise ArgumentError, "Unknown key #{k.inspect} (#{sym.inspect})"
38
38
  end
39
39
  end
40
40
  endpoint
@@ -36,7 +36,7 @@ class SslLabs
36
36
  when *ATTRS
37
37
  endpoint.send("#{sym}=", v)
38
38
  else
39
- raise ArgumentError, "Unknown key #{k.inspect} (#{sym})"
39
+ raise ArgumentError, "Unknown key #{k.inspect} (#{sym.inspect})"
40
40
  end
41
41
  end
42
42
  endpoint
@@ -1,8 +1,9 @@
1
1
  require 'ssl_labs/endpoint_data/details/cert'
2
2
  require 'ssl_labs/endpoint_data/details/chain'
3
+ require 'ssl_labs/endpoint_data/details/chain_cert'
3
4
  require 'ssl_labs/endpoint_data/details/key'
4
5
  require 'ssl_labs/endpoint_data/details/protocol'
5
- require 'ssl_labs/endpoint_data/details/suite'
6
+ require 'ssl_labs/endpoint_data/details/suites'
6
7
  require 'ssl_labs/endpoint_data/details/sim'
7
8
  require 'ssl_labs/util'
8
9
 
@@ -39,7 +40,7 @@ class SslLabs
39
40
  :sni_required,
40
41
  :sts_response_header,
41
42
  :sts_max_age,
42
- :sts_sub_domains,
43
+ :sts_subdomains,
43
44
  :suites,
44
45
  :supports_npn,
45
46
  :supports_rc4,
@@ -60,12 +61,14 @@ class SslLabs
60
61
  details.host_start_time = Time.at(v / 1000.0)
61
62
  when :key
62
63
  details.key = Key.from_hash(v)
64
+ when :npn_protocols
65
+ details.npn_protocols = v.split
63
66
  when :protocols
64
67
  details.protocols = v['list'].map { |hash| Protocol.from_hash(hash) }
65
68
  when :sims
66
69
  details.sims = v['results'].map { |hash| Sim.from_hash(hash) }
67
70
  when :suites
68
- details.suites = v['list'].map { |hash| Suite.from_hash(hash) }
71
+ details.suites = Suites.from_hash(v)
69
72
  when *ATTRS
70
73
  details.send("#{sym}=", v)
71
74
  else
@@ -15,11 +15,9 @@ class SslLabs
15
15
  :issuer_label,
16
16
  :issuer_subject,
17
17
  :issues,
18
- :label,
19
18
  :not_after,
20
19
  :not_before,
21
20
  :ocsp_uris,
22
- :raw,
23
21
  :revocation_info,
24
22
  :revocation_status,
25
23
  :scg,
@@ -1,4 +1,4 @@
1
- require 'ssl_labs/endpoint_data/details/cert'
1
+ require 'ssl_labs/endpoint_data/details/chain_cert'
2
2
 
3
3
  class SslLabs
4
4
 
@@ -20,7 +20,7 @@ class SslLabs
20
20
  hash.each do |k, v|
21
21
  case sym = Util.underscore(k).to_sym
22
22
  when :certs
23
- chain.certs = v.map { |cert| Cert.from_hash(cert) }
23
+ chain.certs = v.map { |cert| ChainCert.from_hash(cert) }
24
24
  when *ATTRS
25
25
  chain.send("#{sym}=", v)
26
26
  else
@@ -0,0 +1,41 @@
1
+ require 'ssl_labs/util'
2
+
3
+ class SslLabs
4
+
5
+ class EndpointData
6
+
7
+ class Details
8
+
9
+ class ChainCert
10
+
11
+ ATTRS = [
12
+ :issuer_label,
13
+ :issuer_subject,
14
+ :issues,
15
+ :label,
16
+ :raw,
17
+ :subject
18
+ ]
19
+
20
+ attr_accessor(*ATTRS)
21
+
22
+ def self.from_hash(hash)
23
+ chain_cert = self.new
24
+ hash.each do |k, v|
25
+ case sym = Util.underscore(k).to_sym
26
+ when *ATTRS
27
+ chain_cert.send("#{sym}=", v)
28
+ else
29
+ raise ArgumentError, "Unknown key #{k.inspect} (#{sym.inspect})"
30
+ end
31
+ end
32
+ chain_cert
33
+ end
34
+
35
+ end # ChainCert
36
+
37
+ end # Details
38
+
39
+ end # EndpointData
40
+
41
+ end # SslLabs
@@ -9,13 +9,15 @@ class SslLabs
9
9
  class Suite
10
10
 
11
11
  ATTRS = [
12
- :id,
13
- :name,
14
12
  :cipher_strength,
15
- :dh_strength,
16
- :dh_p,
17
13
  :dh_g,
14
+ :dh_p,
15
+ :dh_strength,
18
16
  :dh_ys,
17
+ :ecdh_bits,
18
+ :ecdh_strength,
19
+ :id,
20
+ :name,
19
21
  :q
20
22
  ]
21
23
 
@@ -0,0 +1,55 @@
1
+ require 'ssl_labs/endpoint_data/details/suite'
2
+ require 'ssl_labs/util'
3
+
4
+ class SslLabs
5
+
6
+ class EndpointData
7
+
8
+ class Details
9
+
10
+ # Implements a list of ciphersuites. The list is directly accessible
11
+ # via #list but otherwise Array instance methods called on Suites
12
+ # are delegated to the list automatically.
13
+ class Suites
14
+
15
+ ATTRS = [
16
+ :list,
17
+ :preference
18
+ ]
19
+
20
+ attr_accessor(*ATTRS)
21
+
22
+ def initialize
23
+ @list = []
24
+ end
25
+
26
+ def method_missing(method, *args, &blk)
27
+ [].respond_to?(method) ? @list.send(method, *args, &blk) : super
28
+ end
29
+
30
+ def respond_to?(method)
31
+ super || [].respond_to?(method)
32
+ end
33
+
34
+ def self.from_hash(hash)
35
+ suites = self.new
36
+ hash.each do |k, v|
37
+ case sym = Util.underscore(k).to_sym
38
+ when :list
39
+ suites.list = v.map { |hash| Suite.from_hash(hash) }
40
+ when *ATTRS
41
+ suites.send("#{sym}=", v)
42
+ else
43
+ raise ArgumentError, "Unknown key #{k.inspect} (#{sym.inspect})"
44
+ end
45
+ end
46
+ suites
47
+ end
48
+
49
+ end # Suites
50
+
51
+ end # Details
52
+
53
+ end # EndpointData
54
+
55
+ end # SslLabs
data/lib/ssl_labs/info.rb CHANGED
@@ -26,7 +26,7 @@ class SslLabs
26
26
  when *ATTRS
27
27
  info.send("#{sym}=", v)
28
28
  else
29
- raise ArgumentError, "Unknown key #{k.inspect}"
29
+ raise ArgumentError, "Unknown key #{k.inspect} (#{sym.inspect})"
30
30
  end
31
31
  info
32
32
  end
@@ -0,0 +1,6 @@
1
+ class SslLabs
2
+
3
+ # Gem version.
4
+ VERSION = '0.0.3'
5
+
6
+ end # SslLabs
@@ -8,8 +8,7 @@ class TestEndpointData < Test::Unit::TestCase
8
8
 
9
9
  def test_constructor
10
10
  json = File.read(File.join(File.dirname(__FILE__), 'endpoint_data.json'))
11
- hash = JSON.parse(json)
12
- epd = SslLabs::EndpointData.from_hash(hash)
11
+ epd = SslLabs::EndpointData.from_json(json)
13
12
  # XXX insert tests here
14
13
  #binding.pry
15
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssl_labs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Carpenter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-31 00:00:00.000000000 Z
11
+ date: 2014-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -67,14 +67,17 @@ files:
67
67
  - lib/ssl_labs/endpoint_data/details.rb
68
68
  - lib/ssl_labs/endpoint_data/details/cert.rb
69
69
  - lib/ssl_labs/endpoint_data/details/chain.rb
70
+ - lib/ssl_labs/endpoint_data/details/chain_cert.rb
70
71
  - lib/ssl_labs/endpoint_data/details/key.rb
71
72
  - lib/ssl_labs/endpoint_data/details/protocol.rb
72
73
  - lib/ssl_labs/endpoint_data/details/sim.rb
73
74
  - lib/ssl_labs/endpoint_data/details/sim/client.rb
74
75
  - lib/ssl_labs/endpoint_data/details/suite.rb
76
+ - lib/ssl_labs/endpoint_data/details/suites.rb
75
77
  - lib/ssl_labs/host.rb
76
78
  - lib/ssl_labs/info.rb
77
79
  - lib/ssl_labs/util.rb
80
+ - lib/ssl_labs/version.rb
78
81
  - test/endpoint_data.json
79
82
  - test/test_endpoint_data.rb
80
83
  - Rakefile