cea-sec/miasm

View on GitHub

Showing 1,373 of 3,020 total issues

AsmCFG has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class AsmCFG(DiGraph):

    """Directed graph standing for a ASM Control Flow Graph with:
     - nodes: AsmBlock
     - edges: constraints between blocks, synchronized with AsmBlock's "bto"
Severity: Minor
Found in miasm/core/asmblock.py - About 3 hrs to fix

    Function analyse_function has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def analyse_function():
        # Get settings
        settings = TypePropagationForm()
        ret = settings.Execute()
        if not ret:
    Severity: Minor
    Found in example/ida/ctype_propagation.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 launch_depgraph has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def launch_depgraph():
        global graphs, comments, sol_nb, settings, addr, lifter, ircfg
        # Get the current function
        addr = idc.get_screen_ea()
        func = ida_funcs.get_func(addr)
    Severity: Minor
    Found in example/ida/depgraph.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 read has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def read(self, offset, size):
            """
            Return memory at @offset with @size as an Expr list
            @offset: integer (in bytes)
            @size: integer (in bits), byte aligned
    Severity: Minor
    Found in miasm/ir/symbexec.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 __init__ has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, expr, var_prefix="v"):
            """Set the expression @expr to handle and launch variable identification
            process
            @expr: Expr instance
            @var_prefix: (optional) prefix of the variable name, default is 'v'"""
    Severity: Minor
    Found in miasm/expression/expression_helper.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 flen has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def flen(cls, mode, v):
            if admode_prefix((mode, v['opmode'], v['admode'])) == 16:
                if v['mod'] == 0b00:
                    if v['rm'] == 0b110:
                        return 16
    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 __len__ has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def __len__(self):
            length = 0
            if self.resdesc is None:
                return length
            dir_todo = [self.resdesc]
    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 get_rvaitem has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_rvaitem(self, start, stop=None):
            if stop == None:
                s = self.parent.getsectionbyvad(start)
                if s:
                    start = start - s.sh.addr
    Severity: Minor
    Found in miasm/loader/elf_init.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 find_definitions_from_worklist has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_definitions_from_worklist(self, worklist, ircfg):
            """
            Find variables definition in @worklist by browsing the @ircfg
            """
            locs_done = set()
    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 arm_guess_subcall has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def arm_guess_subcall(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 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

    File graph_ir.py has 292 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from __future__ import print_function
    import os
    import tempfile
    from builtins import int as int_types
    
    
    Severity: Minor
    Found in example/ida/graph_ir.py - About 3 hrs to fix

      AssignBlock has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class AssignBlock(object):
          """Represent parallel IR assignment, such as:
          EAX = EBX
          EBX = EAX
      
      
      Severity: Minor
      Found in miasm/ir/ir.py - About 3 hrs to fix

        SymbolicExecutionEngine has 26 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class SymbolicExecutionEngine(object):
            """
            Symbolic execution engine
            Allow IR code emulation in symbolic domain
        
        
        Severity: Minor
        Found in miasm/ir/symbexec.py - About 3 hrs to fix

          PE has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class PE(object):
              content = ContentManager()
          
              def __init__(self, pestr=None,
                           loadfrommem=False,
          Severity: Minor
          Found in miasm/loader/pe_init.py - About 3 hrs to fix

            Function st_ld_m has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

            def st_ld_m(ir, instr, a, b, store=False, postinc=False, updown=False):
                e = []
                wb = False
                dst = None
                if isinstance(a, ExprOp) and a.op == 'wback':
            Severity: Minor
            Found in miasm/arch/arm/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 do_it_block has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def do_it_block(self, loc, index, block, assignments, gen_pc_updt):
                    instr = block.lines[index]
                    it_hints, it_cond = self.parse_itt(instr)
                    cond_num = cond_dct_inv[it_cond.name]
                    cond_eq = tab_cond[cond_num]
            Severity: Minor
            Found in miasm/arch/arm/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 encode has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def encode(self):
                    if not isinstance(self.expr, ExprInt):
                        return
                    arg0_expr = self.parent.args[0].expr
                    self.parent.rex_w.value = 0
            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 arg2str has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def arg2str(expr, index=None, loc_db=None):
                    if expr.is_id() or expr.is_int():
                        o = str(expr)
                    elif expr.is_loc():
                        if loc_db is not None:
            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 gete has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def gete(self, raw, off):
                    if not off:
                        return None, off
                    if off >= len(self.parent_head.img_rva):
                        log.warning('cannot parse resources, %X' % off)
            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 handle_exception has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def handle_exception(self, res):
                    if not res:
                        # A breakpoint has stopped the execution
                        return DebugBreakpointTerminate(res)
            
            
            Severity: Minor
            Found in miasm/analysis/debugging.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