cea-sec/miasm

View on GitHub

Showing 1,373 of 3,020 total issues

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

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

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

    def inter_block_flow(lifter, ircfg, flow_graph, irb_0, irb_in_nodes, irb_out_nodes, link_exec_to_data=True):
    Severity: Major
    Found in miasm/analysis/data_analysis.py - About 50 mins to fix

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

          def __init__(self, pestr=None,
      Severity: Major
      Found in miasm/loader/pe_init.py - About 50 mins to fix

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

        def inter_block_flow_link(lifter, ircfg, flow_graph, irb_in_nodes, irb_out_nodes, todo, link_exec_to_data):
        Severity: Major
        Found in miasm/analysis/data_analysis.py - About 50 mins to fix

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

          def vm_load_pe(vm, fdata, align_s=True, load_hdr=True, name="", winobjs=None, **kargs):
          Severity: Major
          Found in miasm/jitter/loader/pe.py - About 50 mins to fix

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

            def vm_load_elf(vm, fdata, name="", base_addr=0, loc_db=None, apply_reloc=False,
            Severity: Major
            Found in miasm/jitter/loader/elf.py - About 50 mins to fix

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

                  def __init__(self, strbits=None, l=None, cls=None,
              Severity: Major
              Found in miasm/core/cpu.py - About 50 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if stat.S_ISDIR(s.st_mode):
                                        # open dir
                                        ret = winobjs.handle_pool.add(sb_fname, 0x1337)
                                    else:
                                        h = open(sb_fname, 'wb')
                Severity: Major
                Found in miasm/os_dep/win_api_x86_32.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  for dest in instr.getdstflow(mdis.loc_db):
                                      if not dest.is_loc():
                                          continue
                                      offset = mdis.loc_db.get_location_offset(dest.loc_key)
                                      todo.append((mdis, instr, offset))
                  Severity: Major
                  Found in example/disasm/full.py - About 45 mins to fix

                    Function kernel32_SetFilePointerEx has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def kernel32_SetFilePointerEx(jitter):
                        ret_ad, args = jitter.func_args_stdcall(["hwnd", "dinstance_l",
                                                                 "dinstance_h",
                                                                 "pnewfileptr",
                                                                 "movemethod"])
                    Severity: Minor
                    Found in miasm/os_dep/win_api_x86_32.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 not instr:
                                        continue
                                    for dest in instr.getdstflow(mdis.loc_db):
                    Severity: Major
                    Found in example/disasm/full.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if dst != lifter.sp:
                                              dst = dst.replace_expr(fix_dct)
                                      dst, src = expr_simp(dst), expr_simp(src)
                      Severity: Major
                      Found in example/ida/depgraph.py - About 45 mins to fix

                        Function advapi32_RegOpenKeyEx has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def advapi32_RegOpenKeyEx(jitter, funcname, get_str):
                            ret_ad, args = jitter.func_args_stdcall(["hkey", "subkey",
                                                                     "reserved", "access",
                                                                     "phandle"])
                            s_subkey = get_str(args.subkey).lower() if args.subkey else ""
                        Severity: Minor
                        Found in miasm/os_dep/win_api_x86_32.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 stat.S_ISDIR(s.st_mode):
                                                ret = winobjs.handle_pool.add(sb_fname, 0x1337)
                                            else:
                                                h = open(sb_fname, 'r+b')
                                                ret = winobjs.handle_pool.add(sb_fname, h)
                        Severity: Major
                        Found in miasm/os_dep/win_api_x86_32.py - About 45 mins to fix

                          Function prepare_loader_x86_64 has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def prepare_loader_x86_64(jitter, argv, envp, auxv, linux_env,
                          Severity: Minor
                          Found in miasm/os_dep/linux/environment.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if stat.S_ISDIR(s.st_mode):
                                                    ret = winobjs.handle_pool.add(sb_fname, 0x1337)
                                                else:
                                                    open_mode = 'rb'
                                                    if (args.access & 0x40000000) or args.access == 2:
                            Severity: Major
                            Found in miasm/os_dep/win_api_x86_32.py - About 45 mins to fix

                              Function add_asmblock_to_ircfg has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def add_asmblock_to_ircfg(self, block, ircfg, gen_pc_updt=False):
                                      """
                                      Add a native block to the current IR
                                      @block: native assembly block
                                      @ircfg: IRCFG instance
                              Severity: Minor
                              Found in miasm/ir/ir.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 node2lines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def node2lines(self, node):
                                      node_name = self.loc_db.pretty_str(node)
                                      yield self.DotCellDescription(
                                          text="%s" % node_name,
                                          attr={
                              Severity: Minor
                              Found in miasm/ir/ir.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 dst_trackback has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def dst_trackback(self, irb):
                                      """
                                      Naive backtracking of IRDst
                                      @irb: irbloc instance
                                      """
                              Severity: Minor
                              Found in miasm/ir/ir.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 kernel32_GetModuleFileName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def kernel32_GetModuleFileName(jitter, funcname, set_str):
                                  ret_ad, args = jitter.func_args_stdcall(["hmodule", "lpfilename", "nsize"])
                              
                                  if args.hmodule in [0, winobjs.hcurmodule]:
                                      p = winobjs.module_path[:]
                              Severity: Minor
                              Found in miasm/os_dep/win_api_x86_32.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