File sslyze.py
has 706 lines of code (exceeds 250 allowed). Consider refactoring. Open
###
# Inspect a site's TLS configuration using sslyze.
#
# If data exists for a domain from `pshtt`, will check results
# and only process domains with valid HTTPS, or broken chains.
Function analyze_certs
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
def analyze_certs(certs):
data = {'certs': {}}
# Served chain.
served_chain = certs.received_certificate_chain
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function analyze_protocols_and_ciphers
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def analyze_protocols_and_ciphers(data, sslv2, sslv3, tlsv1, tlsv1_1, tlsv1_2, tlsv1_3):
data['protocols'] = {
'sslv2': supported_protocol(sslv2),
'sslv3': supported_protocol(sslv3),
'tlsv1.0': supported_protocol(tlsv1),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function scan_parallel
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def scan_parallel(scanner, server_info, data, options):
logging.debug("\tRunning scans in parallel.")
def queue(command):
try:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function scan_serial
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def scan_serial(scanner, server_info, data, options):
errors = 0
def run_scan(scan_type, command, errors):
if(errors >= 2):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function post_scan
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def post_scan(domain: str, data: Any, environment: dict, options: dict):
"""Post-scan hook for sslyze
Add SMTP results to the fast cache, keyed by the concatenation of
the mail server and port. Do not update if an appropriate cache
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function init_domain
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def init_domain(domain, environment, options):
hosts_to_scan = []
cached_data = []
cache_dir = options.get('_', {}).get('cache_dir', './cache')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function analyze_certs
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def analyze_certs(certs):
data = {'certs': {}}
# Served chain.
served_chain = certs.received_certificate_chain
Function analyze_protocols_and_ciphers
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def analyze_protocols_and_ciphers(data, sslv2, sslv3, tlsv1, tlsv1_1, tlsv1_2, tlsv1_3):
Function run_sslyze
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_sslyze(data, environment, options):
# Each sslyze worker can use a sync or parallel mode.
#
# SynchronousScanner can show memory leaks when parsing certs,
# so local scanning defaults to using ConcurrentScanner.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Consider simplifying this complex logical expression. Open
if sslv2 and sslv3 and tlsv1 and tlsv1_1 and tlsv1_2 and tlsv1_3:
analyze_protocols_and_ciphers(data, sslv2, sslv3, tlsv1, tlsv1_1, tlsv1_2, tlsv1_3)
Function init_sslyze
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def init_sslyze(hostname, port, starttls_smtp, options, sync=False):
Function init_sslyze
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def init_sslyze(hostname, port, starttls_smtp, options, sync=False):
global network_timeout, CA_FILE
network_timeout = int(options.get("network_timeout", network_timeout))
if options.get('ca_file'):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"