tlsfuzzer/tlsfuzzer

View on GitHub

Showing 77 of 274 total issues

Function _process_extensions has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

    def _process_extensions(self, state, msg):
        for ext in msg.extensions:
            ext_id = ext.extType
            handler = None
            if ext_id in TLS_1_3_CR_FORBIDDEN:
Severity: Minor
Found in tlsfuzzer/expect.py - About 1 hr 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 run has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

    def run(self):
        """
        Run test the specified number of times and start analysis

        :return: int 0 for no difference, 1 for difference, 2 if unavailable
Severity: Minor
Found in tlsfuzzer/timing_runner.py - About 1 hr 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 15 (exceeds 10 allowed). Consider refactoring.
Open

    def generate(self, status):
        """Create a Finished message."""
        if self.protocol is None:
            self.protocol = status.version

Severity: Minor
Found in tlsfuzzer/messages.py - About 1 hr 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 15 (exceeds 10 allowed). Consider refactoring.
Open

    def generate(self, state):
        """Generate a new CLIENT-MASTER-KEY message."""
        if self.cipher is None:
            raise NotImplementedError("No cipher autonegotiation")
        if self.master_key is None:
Severity: Minor
Found in tlsfuzzer/messages.py - About 1 hr 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 26 lines of code (exceeds 25 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 1 hr to fix

    Function diff_scatter_plot has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def diff_scatter_plot(self):
            """Generate scatter plot showing differences between samples."""
            if not self.draw_scatter_plot:
                return
            if self.verbose:
    Severity: Minor
    Found in tlsfuzzer/analysis.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if self.sig_alg and self.sig_alg[1] == SignatureAlgorithm.ecdsa or\
                      self.private_key.key_type == "ecdsa":
                  signature_type = "ecdsa"
              elif self.sig_alg and self.sig_alg in (
                      SignatureScheme.ed25519, SignatureScheme.ed448) or \
      Severity: Major
      Found in tlsfuzzer/messages.py - About 1 hr to fix

        Function _process_extensions has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
        Open

            def _process_extensions(self, state, srv_exts):
                """Check if extensions are correct."""
                # fix these constants, when the extensions are implemented
                ee_supported = [ExtensionType.server_name,
                                1,  # max_fragment_length - RFC 6066
        Severity: Minor
        Found in tlsfuzzer/expect.py - About 55 mins 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_extensions has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
        Open

            def _generate_extensions(self, state):
                """Convert extension generators to extension objects."""
                extensions = []
                for ext_id in self.extensions:
                    if self.extensions[ext_id] is not None:
        Severity: Minor
        Found in tlsfuzzer/messages.py - About 55 mins 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 _check_downgrade_protection has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
        Open

            def _check_downgrade_protection(self, srv_hello):
                """
                Verify that server provided downgrade protection as specified in
                RFC 8446, Section 4.1.3
                """
        Severity: Minor
        Found in tlsfuzzer/expect.py - About 55 mins 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_measurements_and_create_hamming_csv_file has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
        Open

            def process_measurements_and_create_hamming_csv_file(
                    self, values_iter, items_in_tuple = 20):
                """
                Processing all the nonces and associated time measurements from the
                given files and creates a file with tuples associating the Hamming
        Severity: Minor
        Found in tlsfuzzer/extract.py - About 55 mins 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

        Avoid deeply nested control flow statements.
        Open

                                    if tcp_pkt.ack != exp_srv_ack:
                                        print("Mismatched syn/ack seq at {0}\n"
                                              .format(pkt_count))
                                        raise ValueError("Packet drops in capture!")
                                    exp_clnt_ack = exp_clnt_ack + len(tcp_pkt.data) \
        Severity: Major
        Found in tlsfuzzer/extract.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if len(self.server_msgs) > \
                                              len(self.server_msgs_acks):
                                          self.server_msgs_acks[tcp_pkt.ack] = timestamp
                              elif (tcp_pkt.flags & dpkt.tcp.TH_ACK and
          Severity: Major
          Found in tlsfuzzer/extract.py - About 45 mins to fix

            Function create_k_specific_dirs has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
            Open

                def create_k_specific_dirs(self):
                    """
                    Creates a folder with timing.csv for each K bit-size so it can be
                    analyzed one at a time.
                    """
            Severity: Minor
            Found in tlsfuzzer/analysis.py - About 45 mins 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 analyse_hamming_weights has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
            Open

                def analyse_hamming_weights(self):
                    name = join(self.output, self.measurements_filename)
            
                    self._hamming_weight_report += "tlsfuzzer analyse.py version {0} "\
                        .format(VERSION)
            Severity: Minor
            Found in tlsfuzzer/analysis.py - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                                        if tcp_pkt.ack != exp_clnt_ack:
                                            print("Mismatched syn/ack seq at {0}\n"
                                                  .format(pkt_count))
                                            raise ValueError("Packet drops in capture!")
                                        exp_srv_ack = exp_srv_ack + len(tcp_pkt.data) \
            Severity: Major
            Found in tlsfuzzer/extract.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if self.srv_fin > self.clnt_fin:
                                          self.last_warmup_fin = self.srv_fin
                                      else:
                                          self.last_warmup_fin = self.clnt_fin
              
              
              Severity: Major
              Found in tlsfuzzer/extract.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if len(self.client_msgs) > \
                                                    len(self.client_msgs_acks):
                                                self.client_msgs_acks[tcp_pkt.ack] = timestamp
                                        else:
                Severity: Major
                Found in tlsfuzzer/extract.py - About 45 mins to fix

                  Function update has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
                  Open

                      def update(*args, **kwds):
                          '''
                          od.update(E, **F) -> None.  Update od from dict/iterable E and F.
                  
                          If E is a dict instance, does:         for k in E: od[k] = E[k]
                  Severity: Minor
                  Found in tlsfuzzer/utils/_ordered_dict.py - About 45 mins 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_and_create_multiple_csv_files has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
                  Open

                      def process_and_create_multiple_csv_files(self, files = {
                          "measurements.csv": "k-size"
                      }):
                          original_measuremments_csv = self.measurements_csv
                          skipped_h_weight_invert = False
                  Severity: Minor
                  Found in tlsfuzzer/extract.py - About 45 mins 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