Class: TLSmap::App::Extractor::Sslyze6

Inherits:
Object
  • Object
show all
Defined in:
lib/tls_map/app/extractor/extractor.rb

Overview

Parsing SSLyze 6.x

Class Method Summary collapse

Class Method Details

.extract_cipher(json_data) ⇒ Array<String>

Extract the ciphers from the sslyze output file

Parameters:

  • json_data (Hash)

    Ruby hash of the parsed JSON

Returns:

  • (Array<String>)

    Cipher array (IANA names)



165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/tls_map/app/extractor/extractor.rb', line 165

def extract_cipher(json_data)
  ciphers = json_data['server_scan_results'][0]['scan_result']
  raw = {
    'SSL2.0' => ciphers['ssl_2_0_cipher_suites']['result']['accepted_cipher_suites'],
    'SSL3.0' => ciphers['ssl_3_0_cipher_suites']['result']['accepted_cipher_suites'],
    'TLS1.0' => ciphers['tls_1_0_cipher_suites']['result']['accepted_cipher_suites'],
    'TLS1.1' => ciphers['tls_1_1_cipher_suites']['result']['accepted_cipher_suites'],
    'TLS1.2' => ciphers['tls_1_2_cipher_suites']['result']['accepted_cipher_suites'],
    'TLS1.3' => ciphers['tls_1_3_cipher_suites']['result']['accepted_cipher_suites']
  }
  raw.transform_values { |v| v.empty? ? v : v.map { |x| x['cipher_suite']['name'] } }
end

.parse(file) ⇒ Array<String>

Extract the ciphers from the sslyze output file

Parameters:

Returns:

  • (Array<String>)

    Cipher array (IANA names)



157
158
159
160
# File 'lib/tls_map/app/extractor/extractor.rb', line 157

def parse(file)
  data = Utils.json_load_file(file)
  extract_cipher(data)
end