lib/tls_map/ciphersuiteinfo.rb in tls-map-1.1.0 vs lib/tls_map/ciphersuiteinfo.rb in tls-map-1.2.0
- old
+ new
@@ -8,15 +8,17 @@
# TLS map module
module TLSmap
class App
# Partial wrapper around ciphersuite.info API to get extra info about a cipher
+ #
# Documentation:
- # - https://ciphersuite.info/blog/2019/04/05/how-to-use-our-api/
- # - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md
- # - https://ciphersuite.info/api/
- # - https://github.com/hcrudolph/ciphersuite.info
+ #
+ # - https://ciphersuite.info/blog/2019/04/05/how-to-use-our-api/
+ # - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md
+ # - https://ciphersuite.info/api/
+ # - https://github.com/hcrudolph/ciphersuite.info
class Extended
# Root URL of Cipher Suite Info
ROOT = 'https://ciphersuite.info/'
# Root URL of Cipher Suite Info API
API_ROOT = "#{ROOT}api/"
@@ -55,12 +57,12 @@
end
# Retrieve advanced about a cipher on Cipher Suite Info API and enhanced it
# @param iana_name [String] IANA cipher name
# @return [Hash] Hash containing advanced information. The keys are the same as {DICO}. All valeus are string
- # except +vulns+ which is an array of hashes containing two keys: +:severity+ (integer) and +:description+
- # (string). Each hash in +vulns+ correspond to a vulnerability.
+ # except `vulns` which is an array of hashes containing two keys: `:severity` (integer) and `:description`
+ # (string). Each hash in `vulns` correspond to a vulnerability.
def extend(iana_name) # rubocop:disable Metrics/MethodLength
obj = Net::HTTP.get(URI("#{API_ROOT}cs/#{iana_name}/"))
out = JSON.parse(obj)[iana_name]
out.store('vulns', [])
%w[openssl_name gnutls_name hex_byte_1 hex_byte_2].each do |key|
@@ -97,19 +99,19 @@
out
end
# Translate cipher related acronyms
# @param term [String] Acronym, eg. DSS
- # @return [String] The long name of the acronym, eg. Digital Signature Standard or +nil+ if it's not found
+ # @return [String] The long name of the acronym, eg. Digital Signature Standard or `nil` if it's not found
def translate_acronym(term)
return @tech[term][:long_name] unless @tech[term].nil?
nil
end
# Find vulnerabilities related to a technology
# @param tech [String] The technology acronym, eg. CBC
- # @return [Array<Hash>] Array of vulnerabilities as described for {extend} return value in the +vulns+ key.
+ # @return [Array<Hash>] Array of vulnerabilities as described for {extend} return value in the `vulns` key.
def find_vuln(tech)
return @tech[tech][:vulnerabilities].map { |vuln| @vuln[vuln] } unless @tech[tech][:vulnerabilities].nil?
nil
end