cea-sec/miasm

View on GitHub

Showing 1,373 of 3,020 total issues

Function del_reloc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def del_reloc(self, taboffset):
        if self.reldesc is None:
            return
        for rel in self.reldesc:
            of1 = rel.rva
Severity: Minor
Found in miasm/loader/pe.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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, loc_db, *args, **kwargs):
        super(Sandbox_Linux_ppc32b, self).__init__(loc_db, *args, **kwargs)

        # Init stack
        self.jitter.stack_size = self.STACK_SIZE
Severity: Minor
Found in miasm/analysis/sandbox.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 remove_empty_assignblks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def remove_empty_assignblks(ircfg):
    """
    Remove empty assignblks in irblocks of @ircfg
    Return True if at least an irblock has been modified

Severity: Minor
Found in miasm/analysis/data_flow.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 _range_and_min has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _range_and_min(self, x_min, x_max, y_min, y_max):
        """Interval min for x & y, with
         - x, y of size self.size
         - @x_min <= x <= @x_max
         - @y_min <= y <= @y_max
Severity: Minor
Found in miasm/analysis/modularintervals.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 run_at has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def run_at(self, cpu, offset, stop_offsets):
        """Run from the starting address @offset.
        Execution will stop if:
        - max_exec_per_call option is reached
        - a new, yet unknown, block is reached after the execution of block at
Severity: Minor
Found in miasm/jitter/jitcore.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 add_breakpoints has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def add_breakpoints(self, bp_addr):
        for addr in bp_addr:
            addr = int(addr, 0)

            good = True
Severity: Minor
Found in miasm/analysis/debugging.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 conservative_asm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def conservative_asm(mnemo, instr, symbols, conservative):
    """
    Asm instruction;
    Try to keep original instruction bytes if it exists
    """
Severity: Minor
Found in miasm/core/asmblock.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 asm_resolve_final has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def asm_resolve_final(mnemo, asmcfg, dst_interval=None):
    """Resolve and assemble @asmcfg into interval
    @dst_interval"""

    asmcfg.sanity_check()
Severity: Minor
Found in miasm/core/asmblock.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_dst_ad has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def check_dst_ad(self):
        for ad in self.lib_imp2dstad:
            all_ads = sorted(viewvalues(self.lib_imp2dstad[ad]))
            for i, x in enumerate(all_ads[:-1]):
                if x is None or all_ads[i + 1] is None:
Severity: Minor
Found in miasm/jitter/loader/utils.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 dis_multiblock has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def dis_multiblock(self, offset, blocks=None, job_done=None):
        """Disassemble every block reachable from @offset regarding
        specific disasmEngine conditions
        Return an AsmCFG instance containing disassembled blocks
        @offset: starting offset
Severity: Minor
Found in miasm/core/asmblock.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 ast_to_typeid_funcdecl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def ast_to_typeid_funcdecl(self, ast):
        """Return the CTypeBase of an FuncDecl ast"""
        type_ret = self.ast_to_typeid(ast.type)
        name, decl_info = self.get_funcname(ast.type)
        if ast.args:
Severity: Minor
Found in miasm/core/ctypesmngr.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 preload_elf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def preload_elf(vm, e, runtime_lib, patch_vm_imp=True, loc_db=None):
    # XXX quick hack
    fa = get_import_address_elf(e)
    dyn_funcs = {}
    for (libname, libfunc), ads in viewitems(fa):
Severity: Minor
Found in miasm/jitter/loader/elf.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 find_path_from_src has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def find_path_from_src(self, src, dst, cycles_count=0, done=None):
        """
        This function does the same as function find_path.
        But it searches the paths from src to dst, not vice versa like find_path.
        This approach might be more efficient in some cases.
Severity: Minor
Found in miasm/core/graph.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 mmap has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def mmap(self, addr, len_, prot, flags, fd, off, vmmngr):
Severity: Major
Found in miasm/os_dep/linux/environment.py - About 50 mins to fix

    Function build_graph has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def build_graph(start_addr, type_graph, simplify=False, use_ida_stack=True, dontmodstack=False, loadint=False, verbose=False):
    Severity: Major
    Found in example/ida/graph_ir.py - About 50 mins to fix

      Function _shift_rotate_tpl has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _shift_rotate_tpl(ir, instr, dst, shift_operation, setflags=False, is_not=False, onlyCarry=False):
      Severity: Major
      Found in miasm/arch/arm/sem.py - About 50 mins to fix

        Function st_ld_m has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def st_ld_m(ir, instr, a, b, store=False, postinc=False, updown=False):
        Severity: Major
        Found in miasm/arch/arm/sem.py - About 50 mins to fix

          Function mn_do_rotate has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def mn_do_rotate(ir, instr, ra, rs, shift, mb, me):
          Severity: Major
          Found in miasm/arch/ppc/sem.py - About 50 mins to fix

            Function modrm2expr has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def modrm2expr(modrm, parent, w8, sx=0, xmm=0, mm=0, bnd=0):
            Severity: Major
            Found in miasm/arch/x86/arch.py - About 50 mins to fix

              Function expr2modrm has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def expr2modrm(expr, parent, w8, sx=0, xmm=0, mm=0, bnd=0):
              Severity: Major
              Found in miasm/arch/x86/arch.py - About 50 mins to fix
                Severity
                Category
                Status
                Source
                Language