Class: TLSmap::App::Extractor::SsllabsScan
- Inherits:
-
Object
- Object
- TLSmap::App::Extractor::SsllabsScan
- Defined in:
- lib/tls_map/extractor.rb
Overview
Parsing ssllabs-scan
Class Method Summary collapse
-
.extract_cipher(json_data) ⇒ Array<String>
Extract the ciphers from the ssllabs-scan output file.
-
.id2prot(id) ⇒ String
Convert ssllabs-scan protocol id to protocol name in TLSmap format.
-
.parse(file) ⇒ Array<String>
Extract the ciphers from the ssllabs-scan output file.
Class Method Details
.extract_cipher(json_data) ⇒ Array<String>
Extract the ciphers from the ssllabs-scan output file
245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/tls_map/extractor.rb', line 245 def extract_cipher(json_data) # rubocop:disable Metrics/MethodLength raw = { 'SSL2.0' => [], 'SSL3.0' => [], 'TLS1.0' => [], 'TLS1.1' => [], 'TLS1.2' => [], 'TLS1.3' => [] } json_data[0]['endpoints'].each do |endpoint| endpoint['details']['suites'].each do |suite| suite['list'].each do |cipher| raw[id2prot(suite['protocol'])].push(cipher['name']) end end end raw.transform_values(&:uniq) end |
.id2prot(id) ⇒ String
Convert ssllabs-scan protocol id to protocol name in TLSmap format
263 264 265 266 267 268 269 |
# File 'lib/tls_map/extractor.rb', line 263 def id2prot(id) prot = { 512 => 'SSL2.0', 768 => 'SSL3.0', 769 => 'TLS1.0', 770 => 'TLS1.1', 771 => 'TLS1.2', 772 => 'TLS1.3' } prot[id] end |
.parse(file) ⇒ Array<String>
Extract the ciphers from the ssllabs-scan output file
237 238 239 240 |
# File 'lib/tls_map/extractor.rb', line 237 def parse(file) data = Utils.json_load_file(file) extract_cipher(data) end |