cea-sec/miasm

View on GitHub

Showing 1,373 of 3,020 total issues

Function __init__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, pestr=None,
                 loadfrommem=False,
                 parse_resources=True,
                 parse_delay=True,
                 parse_reloc=True,
Severity: Minor
Found in miasm/loader/pe_init.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

Function build_content has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def build_content(self, raw):
        if self.parent_head._wsize == 32:
            mask_ptr = 0x80000000
        elif self.parent_head._wsize == 64:
            mask_ptr = 0x8000000000000000
Severity: Minor
Found in miasm/loader/pe.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

Function del_unused_edges has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def del_unused_edges(ircfg, heads):
    """
    Delete non accessible edges in the @ircfg graph.
    @ircfg: IRCFG instance in ssa form
    @heads: location of the heads of the graph
Severity: Minor
Found in miasm/analysis/data_flow.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

Function _fix_no_def_var has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def _fix_no_def_var(self, head):
        """
        Replace phi source variables which are not ssa vars by ssa vars.
        @head: loc_key of the graph head
        """
Severity: Minor
Found in miasm/analysis/ssa.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

Function merge_sets_interfere has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def merge_sets_interfere(self, merge_a, merge_b, parent):
        """
        Return True if no variable in @merge_a and @merge_b interferes.

        Implementation of "Algorithm 2: Check intersection in a set of variables"
Severity: Minor
Found in miasm/analysis/outofssa.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

Function __contains__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def __contains__(self, other):
        if isinstance(other, interval):
            for intervalB in other.intervals:
                is_in = False
                for intervalA in self.intervals:
Severity: Minor
Found in miasm/core/interval.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

Function _check_node has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def _check_node(self, candidate, expected, graph, partial_sol=None):
        """Check if @candidate can stand for @expected in @graph, given @partial_sol
        @candidate: @graph's node
        @expected: MatchGraphJoker instance
        @graph: DiGraph instance
Severity: Minor
Found in miasm/core/graph.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

Function compute_dominance_frontier has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_dominance_frontier(self, head):
        """
        Compute the dominance frontier of the graph

        Source: Cooper, Keith D., Timothy J. Harvey, and Ken Kennedy.
Severity: Minor
Found in miasm/core/graph.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

File simplifier.py has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Apply simplification passes to an IR cfg
"""

import logging
Severity: Minor
Found in miasm/analysis/simplifier.py - About 2 hrs to fix

    File elf.py has 270 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import struct
    from collections import defaultdict
    
    from future.utils import viewitems
    
    
    Severity: Minor
    Found in miasm/jitter/loader/elf.py - About 2 hrs to fix

      Function apply_change has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def apply_change(self, dst, src):
              eval_cache = {}
              if dst.is_mem():
                  # If Write to TOP, forget all memory information
                  ret = self.eval_expr(dst.arg, eval_cache)
      Severity: Minor
      Found in miasm/ir/symbexec_top.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

      Function eval_updt_irblock has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def eval_updt_irblock(self, irb, step=False):
              """
              Symbolic execution of the @irb on the current state
              @irb: irblock instance
              @step: display intermediate steps
      Severity: Minor
      Found in example/ida/ctype_propagation.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

      Function kernel32_VirtualProtect has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def kernel32_VirtualProtect(jitter):
          ret_ad, args = jitter.func_args_stdcall(['lpvoid', 'dwsize',
                                                   'flnewprotect',
                                                   'lpfloldprotect'])
          # XXX mask hpart
      Severity: Minor
      Found in miasm/os_dep/win_api_x86_32.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

      Function simp_smod_sext has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_smod_sext(expr_s, expr):
          """
          a.size == b.size
          smod(a.signExtend(X), b.signExtend(X)) => smod(a, b).signExtend(X)
          """
      Severity: Minor
      Found in miasm/expression/simplifications_common.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

      Function arg2str has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def arg2str(expr, index=None, loc_db=None):
              if isinstance(expr, ExprId):
                  o = str(expr)
              elif isinstance(expr, ExprInt):
                  o = str(expr)
      Severity: Minor
      Found in miasm/arch/msp430/arch.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

      Function encode has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def encode(self):
              self.parent.immop.value = 1
              self.parent.updown.value = 1
              e = self.expr
              if not isinstance(e, ExprMem):
      Severity: Minor
      Found in miasm/arch/arm/arch.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

      Function mn_do_cond_branch has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def mn_do_cond_branch(ir, instr, dest):
          bo = instr.additional_info.bo
          bi = instr.additional_info.bi
          ret = []
      
      
      Severity: Minor
      Found in miasm/arch/ppc/sem.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

      Function mn_do_store has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def mn_do_store(ir, instr, arg1, arg2, arg3=None):
          assert instr.name[0:2] == 'ST'
      
          ret = []
          additional_ir = []
      Severity: Minor
      Found in miasm/arch/ppc/sem.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

      Function divert has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def divert(self, i, candidates):
              out = []
              for candidate in candidates:
                  cls, name, bases, dct, fields = candidate
                  fopmode = opmode_prefix(
      Severity: Minor
      Found in miasm/arch/x86/arch.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

      Function divert has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def divert(self, i, candidates):
              out = []
              for candidate in candidates:
                  cls, name, bases, dct, fields = candidate
                  fopmode = opmode_prefix(
      Severity: Minor
      Found in miasm/arch/x86/arch.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