class TLSmap::App::Extractor::SsllabsScan
Parsing ssllabs-scan
Public Class Methods
parse(file)
click to toggle source
Extract the ciphers from the ssllabs-scan output file @param file [String] Path of the ssllabs-scan output file, beware of the format expected.
See {TLSmap::App::Extractor}
@return [Array<String>] Cipher
array (IANA names)
# File lib/tls_map/app/extractor/extractor.rb, line 237 def parse(file) data = Utils.json_load_file(file) extract_cipher(data) end
Protected Class Methods
extract_cipher(json_data)
click to toggle source
Extract the ciphers from the ssllabs-scan output file @param json_data [Hash] Ruby hash of the parsed JSON @return [Array<String>] Cipher
array (IANA names)
# File lib/tls_map/app/extractor/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)
click to toggle source
Convert ssllabs-scan protocol id to protocol name in TLSmap
format @param id [String] ssllabs-scan protocol id @return [String] protocol name in TLSmap
format
# File lib/tls_map/app/extractor/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