tls-map 1.3.0 → 1.3.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
  SHA256:
3
- metadata.gz: 5ac0d9c7dbfc9715ca7387df65617f1202a06ab70b72f764356e6bdb3cbeda3d
4
- data.tar.gz: 37f02d9953363e4fb90e940d894b1ecdafe9bba9ae1636540f9593ee3c37b808
3
+ metadata.gz: 96e73fb397b1d13049c3da41be80eb8187846bebb2c49bb307e99a825e1bb9ab
4
+ data.tar.gz: 4798e654bc27a9c5ef01722cc81ebdf5113119e8d46bc7434256ecd7974547ea
5
5
  SHA512:
6
- metadata.gz: 8a514c524c42e6765e55817dea46b905fdf717e6609e0f1efc2f2555249938b750ae79325b5c2ba3cc58b645f0b378f0f3f13d877a9be37a74dff033b420edbd
7
- data.tar.gz: 8691bfcdb56bbfe8daa408b290f06f1eb2e9dd2f564a9c86e59b2c64e077b037b45b27e4d4e1000fab7b6fc418064b0d4d1b66e1eb174b221b0fe8c022b72b1c
6
+ metadata.gz: '0675008a588def8477d32a3afef6c88dafd4bff9dccaf0885ec012259524e436014abf88aea0da881e1794f7e6be6b3290737aba0d07cd78df25254009d38cbb'
7
+ data.tar.gz: 3c4c8fc5710d153f43f5c82e9b7f44f8e047e0b23ec82f9bd574f933a2759d7f4004abfeb7e7f8c29c3d0bd8237690b9e32a9547848c1e8c327db4e3303652d8
data/lib/tls_map.rb CHANGED
@@ -19,11 +19,11 @@ module TLSmap
19
19
  class App
20
20
  # Will automatically fetch source files and parse them.
21
21
  def initialize
22
- @iana_file = tmpfile('iana', IANA_URL)
23
- @openssl_file = tmpfile('openssl', OPENSSL_URL)
24
- @openssl_file2 = tmpfile('openssl', OPENSSL_URL2)
25
- @gnutls_file = tmpfile('gnutls', GNUTLS_URL)
26
- @nss_file = tmpfile('nss', NSS_URL)
22
+ @iana_file = Utils.tmpfile('iana', IANA_URL)
23
+ @openssl_file = Utils.tmpfile('openssl', OPENSSL_URL)
24
+ @openssl_file2 = Utils.tmpfile('openssl', OPENSSL_URL2)
25
+ @gnutls_file = Utils.tmpfile('gnutls', GNUTLS_URL)
26
+ @nss_file = Utils.tmpfile('nss', NSS_URL)
27
27
 
28
28
  @tls_map = []
29
29
  parse
@@ -45,13 +45,10 @@ module TLSmap
45
45
  2 => { title: 'High', color: :red }
46
46
  }.freeze
47
47
 
48
- include Utils
49
- protected :tmpfile
50
-
51
48
  # Will automatically fetch source files and parse them.
52
49
  def initialize
53
- @tech_file = tmpfile('tech', TECH_DATA)
54
- @vuln_file = tmpfile('vuln', VULN_DATA)
50
+ @tech_file = Utils.tmpfile('tech', TECH_DATA)
51
+ @vuln_file = Utils.tmpfile('vuln', VULN_DATA)
55
52
  @tech = parse_tech
56
53
  @vuln = parse_vuln
57
54
  end
@@ -97,7 +97,7 @@ module TLSmap
97
97
  # See {TLSmap::App::Extractor}
98
98
  # @return [Array<String>] Cipher array (IANA names)
99
99
  def parse(file)
100
- data = JSON.load_file(file)
100
+ data = Utils.json_load_file(file)
101
101
  extract_cipher(data)
102
102
  end
103
103
 
@@ -164,7 +164,7 @@ module TLSmap
164
164
  # See {TLSmap::App::Extractor}
165
165
  # @return [Array<String>] Cipher array (IANA names)
166
166
  def parse(file)
167
- data = JSON.load_file(file)
167
+ data = Utils.json_load_file(file)
168
168
  extract_cipher(data)
169
169
  end
170
170
 
@@ -214,7 +214,7 @@ module TLSmap
214
214
  # See {TLSmap::App::Extractor}
215
215
  # @return [Array<String>] Cipher array (IANA names)
216
216
  def parse(file)
217
- data = JSON.load_file(file)
217
+ data = Utils.json_load_file(file)
218
218
  extract_cipher(data)
219
219
  end
220
220
 
data/lib/tls_map/utils.rb CHANGED
@@ -3,22 +3,27 @@
3
3
  # Ruby internal
4
4
  require 'net/http'
5
5
  require 'tempfile'
6
+ require 'json'
6
7
 
7
8
  # TLS map module
8
9
  module TLSmap
9
10
  # Generic utilities
10
11
  module Utils
11
- def tmpfile(name, url)
12
+ def self.tmpfile(name, url)
12
13
  tmp = Tempfile.new(name)
13
14
  tmp.write(Net::HTTP.get(URI(url)))
14
15
  tmp.close
15
16
  tmp
16
17
  end
17
- end
18
18
 
19
- # TLS mapping
20
- class App
21
- include Utils
22
- protected :tmpfile
19
+ # bring JSON.load_file before ruby 3.0.0
20
+ # https://ruby-doc.org/stdlib-3.0.0/libdoc/json/rdoc/JSON.html#method-i-load_file
21
+ def self.json_load_file(filespec, opts = {})
22
+ if RUBY_VERSION < '3.0.0'
23
+ JSON.parse(File.read(filespec), opts)
24
+ else
25
+ JSON.load_file(filespec, opts)
26
+ end
27
+ end
23
28
  end
24
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TLSmap
4
- VERSION = '1.3.0'
4
+ VERSION = '1.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tls-map
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre ZANNI