tlsfuzzer/tlsfuzzer

View on GitHub

Showing 78 of 275 total issues

File analysis.py has 2269 lines of code (exceeds 500 allowed). Consider refactoring.
Open

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Author: Jan Koscielniak, (c) 2020
# Author: Hubert Kario, (c) 2020
Severity: Major
Found in tlsfuzzer/analysis.py - About 5 days to fix

    File messages.py has 1730 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    # Author: Hubert Kario, (c) 2015
    # Released under Gnu GPL v2.0, see LICENSE file for details
    
    """Objects for generating TLS messages to send."""
    
    
    Severity: Major
    Found in tlsfuzzer/messages.py - About 3 days to fix

      File expect.py has 1651 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      # Author: Hubert Kario, (c) 2015
      # Released under Gnu GPL v2.0, see LICENSE file for details
      
      """Parsing and processing of received TLS messages"""
      from __future__ import print_function
      Severity: Major
      Found in tlsfuzzer/expect.py - About 3 days to fix

        File extract.py has 1363 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        # Author: Jan Koscielniak, (c) 2020
        # Released under Gnu GPL v2.0, see LICENSE file for details
        
        """Extraction and analysis of timing information from a packet capture."""
        
        
        Severity: Major
        Found in tlsfuzzer/extract.py - About 2 days to fix

          Function analyze_bit_sizes has a Cognitive Complexity of 69 (exceeds 10 allowed). Consider refactoring.
          Open

              def analyze_bit_sizes(self):
                  """
                  Analyses K bit-sizes and creates the plots and the test result files
                  which are placed in an analysis_results directory in the output folder.
          
          
          Severity: Minor
          Found in tlsfuzzer/analysis.py - About 1 day to fix

          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

          Analysis has 58 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Analysis(object):
              """Analyse extracted timing information from csv file."""
          
              def __init__(self, output, draw_ecdf_plot=True, draw_scatter_plot=True,
                           draw_conf_interval_plot=True, multithreaded_graph=False,
          Severity: Major
          Found in tlsfuzzer/analysis.py - About 1 day to fix

            Function run has a Cognitive Complexity of 57 (exceeds 10 allowed). Consider refactoring.
            Open

                def run(self):
                    """Execute conversation"""
                    node = self.conversation
                    try:
                        while node is not None:
            Severity: Minor
            Found in tlsfuzzer/runner.py - About 1 day to fix

            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 main has a Cognitive Complexity of 55 (exceeds 10 allowed). Consider refactoring.
            Open

            def main():
                """Process arguments and start extraction."""
                logfile = None
                capture = None
                output = None
            Severity: Minor
            Found in tlsfuzzer/extract.py - About 7 hrs to fix

            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 _parse_pcap has a Cognitive Complexity of 51 (exceeds 10 allowed). Consider refactoring.
            Open

                def _parse_pcap(self):
                    """Process capture file."""
                    with open(self.capture, 'rb') as pcap:
                        progress = None
                        try:
            Severity: Minor
            Found in tlsfuzzer/extract.py - About 7 hrs to fix

            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 (tcp_pkt.flags & dpkt.tcp.TH_SYN and
                                        tcp_pkt.dport == self.port and
                                        ip_pkt.dst == self.ip_address):
                                    # a SYN packet was found - new connection
                                    # (if a retransmission it won't be counted as at least
            Severity: Critical
            Found in tlsfuzzer/extract.py - About 6 hrs to fix

              Function _analyse_weight_pairs has a Cognitive Complexity of 44 (exceeds 10 allowed). Consider refactoring.
              Open

                  def _analyse_weight_pairs(self, pairs):
                      out_dir = self.output
                      output_files = dict()
                      if self.run_sign_test:
                          output_files['sign_test'] = open(
              Severity: Minor
              Found in tlsfuzzer/analysis.py - About 5 hrs to fix

              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 generate has a Cognitive Complexity of 37 (exceeds 10 allowed). Consider refactoring.
              Open

                  def generate(self, status):
                      """Create a Client Key Exchange message."""
                      if self.version is None:
                          self.version = status.version
              
              
              Severity: Minor
              Found in tlsfuzzer/messages.py - About 4 hrs to fix

              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

              Extract has 35 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Extract:
                  """Extract timing information from packet capture."""
              
                  def __init__(self, log=None, capture=None, output=None, ip_address=None,
                               port=None, raw_times=None, col_name=None,
              Severity: Minor
              Found in tlsfuzzer/extract.py - About 4 hrs to fix

                Function process_measurements_and_create_csv_file has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring.
                Open

                    def process_measurements_and_create_csv_file(
                            self, values_iter, comparing_value
                            ):
                        """
                        Processing all the nonces and associated time measurements from the
                Severity: Minor
                Found in tlsfuzzer/extract.py - About 4 hrs to fix

                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 _write_pkts has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring.
                Open

                    def _write_pkts(self):
                        for _, _, _, clnt_msgs, clnt_msgs_acks, srv_msgs, srv_msgs_acks, _, _, _ in self.pckt_times:
                            if len(clnt_msgs) != len(clnt_msgs_acks): # pragma: no cover
                                # no coverage; assert
                                print(clnt_msgs)
                Severity: Minor
                Found in tlsfuzzer/extract.py - About 4 hrs to fix

                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 process has a Cognitive Complexity of 30 (exceeds 10 allowed). Consider refactoring.
                Open

                    def process(self, state, msg):
                        """Process the Server Key Exchange message"""
                        assert msg.contentType == ContentType.handshake
                        parser = Parser(msg.write())
                        hs_type = parser.get(1)
                Severity: Minor
                Found in tlsfuzzer/expect.py - About 3 hrs to fix

                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 add_timing has a Cognitive Complexity of 29 (exceeds 10 allowed). Consider refactoring.
                Open

                    def add_timing(self):
                        """Associate the timing information with its class"""
                        if self.client_message and self.server_message:
                            if self.warm_up_messages_left == 0:
                                class_index = next(self.class_generator)
                Severity: Minor
                Found in tlsfuzzer/extract.py - About 3 hrs to fix

                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 main has a Cognitive Complexity of 27 (exceeds 10 allowed). Consider refactoring.
                Open

                def main():
                    """Process arguments and start analysis."""
                    output = None
                    ecdf_plot = True
                    scatter_plot = True
                Severity: Minor
                Found in tlsfuzzer/analysis.py - About 3 hrs to fix

                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

                OrderedDict has 25 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class OrderedDict(dict):
                    'Dictionary that remembers insertion order'
                    # An inherited dict maps keys to values.
                    # The inherited dict provides __getitem__, __len__, __contains__, and get.
                    # The remaining methods are order-aware.
                Severity: Minor
                Found in tlsfuzzer/utils/_ordered_dict.py - About 2 hrs to fix

                  Function _create_and_write_sanity_entries has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
                  Open

                      def _create_and_write_sanity_entries(self):
                          """
                          Reads the intermediate file and adds sanity records to the final
                          mesurements file.
                          """
                  Severity: Minor
                  Found in tlsfuzzer/extract.py - About 2 hrs to fix

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language