cea-sec/miasm

View on GitHub

Showing 1,373 of 3,019 total issues

Function add_dlldesc has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def add_dlldesc(self, new_dll):
        rva_size = self.parent_head._wsize // 8
        if self.parent_head._wsize == 32:
            mask_ptr = 0x80000000
        elif self.parent_head._wsize == 64:
Severity: Minor
Found in miasm/loader/pe.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 add_dlldesc has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def add_dlldesc(self, new_dll):
        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 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

LLVMFunction has 34 functions (exceeds 20 allowed). Consider refactoring.
Open

class LLVMFunction(object):
    """Represent a LLVM function

    Implementation note:
    A new module is created each time to avoid cumulative lag (if @new_module)
Severity: Minor
Found in miasm/jitter/llvmconvert.py - About 4 hrs to fix

    File gdbserver.py has 347 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #-*- coding:utf-8 -*-
    
    from __future__ import print_function
    from future.builtins import map, range
    
    
    Severity: Minor
    Found in miasm/analysis/gdbserver.py - About 4 hrs to fix

      Function arg2html has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          def arg2html(expr, index=None, loc_db=None):
              wb = False
              if expr.is_id() or expr.is_int() or expr.is_loc():
                  return color_expr_html(expr, loc_db)
              elif isinstance(expr, m2_expr.ExprOp) and expr.op in shift_expr:
      Severity: Minor
      Found in miasm/arch/aarch64/arch.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 st_ld_r has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

      def st_ld_r(ir, instr, a, a2, b, store=False, size=32, s_ext=False, z_ext=False):
          e = []
          wb = False
          postinc = False
          b = b.ptr
      Severity: Minor
      Found in miasm/arch/arm/sem.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 simp_flags has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_flags(_, expr):
          args = expr.args
      
          if expr.is_op("FLAG_EQ"):
              return ExprCond(args[0], ExprInt(0, 1), ExprInt(1, 1))
      Severity: Minor
      Found in miasm/expression/simplifications_explicit.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 simp_cmp_bijective_op has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      def simp_cmp_bijective_op(expr_simp, expr):
          """
          A + B == A => A == 0
      
          X + A == X + B => A == B
      Severity: Minor
      Found in miasm/expression/simplifications_common.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 arm_guess_jump_table has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      def arm_guess_jump_table(dis_engine, cur_block, offsets_to_dis):
          arch = dis_engine.arch
          loc_db = dis_engine.loc_db
          lifter_model_call = get_lifter_model_call(arch, dis_engine.attrib)
      
      
      Severity: Minor
      Found in miasm/analysis/disasm_cb.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 order_ssa_var_dom has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def order_ssa_var_dom(self):
              """Compute dominance order of each ssa variable"""
              ircfg = self.ssa.graph
      
              # compute dominator tree
      Severity: Minor
      Found in miasm/analysis/outofssa.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 _parse_body has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def _parse_body(self, body, argument_names):
              """Recursive function transforming a @body to a block expression
              Return:
               - AST to append to body (real python statements)
               - a list of blocks, ie list of affblock, ie list of ExprAssign (AST)"""
      Severity: Minor
      Found in miasm/core/sembuilder.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

      DebugCmd has 32 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class DebugCmd(cmd.Cmd, object):
      
          "CommandLineInterpreter for Debugguer instance"
      
          color_g = '\033[92m'
      Severity: Minor
      Found in miasm/analysis/debugging.py - About 4 hrs to fix

        Function simp_cond has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        def simp_cond(_, expr):
            """
            Common simplifications on ExprCond.
            Eval exprcond src1/src2 with satifiable/unsatisfiable condition propagation
            """
        Severity: Minor
        Found in miasm/expression/simplifications_common.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 may_interfer has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            def may_interfer(self, dsts, src):
                """
                Return True if @src may interfere with expressions in @dsts
                @dsts: Set of Expressions
                @src: expression to test
        Severity: Minor
        Found in miasm/analysis/data_flow.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 vm_load_elf has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        def vm_load_elf(vm, fdata, name="", base_addr=0, loc_db=None, apply_reloc=False,
                        **kargs):
            """
            Very dirty elf loader
            TODO XXX: implement real loader
        Severity: Minor
        Found in miasm/jitter/loader/elf.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 decode has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            def decode(self, v):
                size = 16
                if hasattr(self.parent, 'size'):
                    size = [16, 8][self.parent.size.value]
                v = v & self.lmask
        Severity: Minor
        Found in miasm/arch/msp430/arch.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 asm_ast_to_expr has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            def asm_ast_to_expr(self, value, loc_db, size_hint=None, fixed_size=None):
                if size_hint is None:
                    size_hint = self.parent.mode
                if fixed_size is None:
                    fixed_size = set()
        Severity: Minor
        Found in miasm/arch/x86/arch.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 set_rva has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_rva(self, rva, size=None):
                if self.resdesc is None:
                    return
                self.parent_head.NThdr.optentries[DIRECTORY_ENTRY_RESOURCE].rva = rva
                if not size:
        Severity: Minor
        Found in miasm/loader/pe.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_location has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_location(self, name=None, offset=None, strict=True):
                """Add a new location in the locationDB. Returns the corresponding LocKey.
                If @name is set, also associate a name to this new location.
                If @offset is set, also associate an offset to this new location.
        
        
        Severity: Minor
        Found in miasm/core/locationdb.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 objc_to_str has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        def objc_to_str(objc, result=None):
            if result is None:
                result = ""
            while True:
                if isinstance(objc, ObjCArray):
        Severity: Minor
        Found in miasm/core/objc.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

        Severity
        Category
        Status
        Source
        Language