Class: TLSmap::App::Extractor::Tlsx
- Inherits:
-
Object
- Object
- TLSmap::App::Extractor::Tlsx
- Defined in:
- lib/tls_map/app/extractor/extractor.rb
Overview
Parsing tlsx
Class Method Summary collapse
-
.extract_cipher(json_data) ⇒ Array<String>
Extract the ciphers from the tlsx output file.
-
.id2prot(id) ⇒ String
Convert tlsx protocol id to protocol name in TLSmap format.
-
.parse(file) ⇒ Array<String>
Extract the ciphers from the tlsx output file.
Class Method Details
.extract_cipher(json_data) ⇒ Array<String>
Extract the ciphers from the tlsx output file
331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/tls_map/app/extractor/extractor.rb', line 331 def extract_cipher(json_data) # rubocop:disable Metrics/MethodLength raw = { 'SSL2.0' => [], 'SSL3.0' => [], 'TLS1.0' => [], 'TLS1.1' => [], 'TLS1.2' => [], 'TLS1.3' => [] } json_data['cipher_enum'].each do |version| next if version['ciphers'].nil? version['ciphers'].each do |cipher| raw[id2prot(version['version'])].push(cipher) end end raw.transform_values(&:uniq) end |
.id2prot(id) ⇒ String
Convert tlsx protocol id to protocol name in TLSmap format
349 350 351 352 353 354 355 |
# File 'lib/tls_map/app/extractor/extractor.rb', line 349 def id2prot(id) prot = { 'ssl30' => 'SSL3.0', 'tls10' => 'TLS1.0', 'tls11' => 'TLS1.1', 'tls12' => 'TLS1.2', 'tls13' => 'TLS1.3' } prot[id] end |
.parse(file) ⇒ Array<String>
Extract the ciphers from the tlsx output file
323 324 325 326 |
# File 'lib/tls_map/app/extractor/extractor.rb', line 323 def parse(file) data = Utils.json_load_file(file) extract_cipher(data) end |