Class: TLSmap::App::Extractor::Sslyze

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

Overview

Parsing SSLyze

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)



132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/tls_map/app/extractor/extractor.rb', line 132

def extract_cipher(json_data)
  ciphers = json_data['server_scan_results'][0]['scan_commands_results']
  raw = {
    'SSL2.0' => ciphers['ssl_2_0_cipher_suites']['accepted_cipher_suites'],
    'SSL3.0' => ciphers['ssl_3_0_cipher_suites']['accepted_cipher_suites'],
    'TLS1.0' => ciphers['tls_1_0_cipher_suites']['accepted_cipher_suites'],
    'TLS1.1' => ciphers['tls_1_1_cipher_suites']['accepted_cipher_suites'],
    'TLS1.2' => ciphers['tls_1_2_cipher_suites']['accepted_cipher_suites'],
    'TLS1.3' => ciphers['tls_1_3_cipher_suites']['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)



124
125
126
127
# File 'lib/tls_map/app/extractor/extractor.rb', line 124

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