cea-sec/miasm

View on GitHub

Showing 1,373 of 3,020 total issues

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

    def __init__(self, op, *args):
        """Create an ExprOp
        @op: str, operation
        @*args: Expr, operand list
        """
Severity: Minor
Found in miasm/expression/expression.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 EncodeBitMasks has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def EncodeBitMasks(wmask):
    # Find replicate
    M = wmask.size
    for i in range(1, M + 1):
        if M % i != 0:
Severity: Minor
Found in miasm/arch/aarch64/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 16 (exceeds 5 allowed). Consider refactoring.
Open

    def encode(self):
        self.parent.immop.value = 1
        self.parent.updown.value = 1

        e = self.expr
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 encode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def encode(self):
        self.parent.updown.value = 1
        self.parent.wback.value = 0

        e = self.expr
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 retrieve_stack_accesses has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def retrieve_stack_accesses(lifter, ircfg):
    """
    Walk the ssa graph and find stack based variables.
    Return a dictionary linking stack base address to its size/name
    @lifter: lifter_model_call instance
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 get_phi_sources has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def get_phi_sources(phi_src, phi_dsts, ids_to_src):
    """
    Return False if the @phi_src has more than one non-phi source
    Else, return its source
    @ids_to_src: Dictionary linking phi source to its definition
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 build_content has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def build_content(self, raw):
        if len(self.parent_head.NThdr.optentries) < DIRECTORY_ENTRY_DELAY_IMPORT:
            return
        dirdelay = self.parent_head.NThdr.optentries[
            DIRECTORY_ENTRY_DELAY_IMPORT]
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 _place_phi has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _place_phi(self, head):
        """
        For all blocks, empty phi functions will be placed for every
        variable in the block's dominance frontier.

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 access_str has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def access_str(expr):
    """Return the C string of a C access represented in Miasm

    @expr: Miasm expression representing the C access

Severity: Minor
Found in miasm/core/objc.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_generic_dominators has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _compute_generic_dominators(head, reachable_cb, prev_cb, next_cb):
        """Generic algorithm to compute either the dominators or postdominators
        of the graph.
        @head: the head/leaf of the graph
        @reachable_cb: sons/parents of the head/leaf
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 full.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import print_function
import logging
from argparse import ArgumentParser
from pdb import pm

Severity: Minor
Found in example/disasm/full.py - About 2 hrs to fix

    File machine.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #-*- coding:utf-8 -*-
    import warnings
    
    
    class Machine(object):
    Severity: Minor
    Found in miasm/analysis/machine.py - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

              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:
                  op_str = shift_str[shift_expr.index(expr.op)]
                  return "%s %s %s" % (
      Severity: Critical
      Found in miasm/arch/aarch64/arch.py - About 2 hrs to fix

        Function __init__ has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(self):
                self.alloc_ad = 0x20000000
                self.alloc_align = 0x1000
                self.heap = heap()
                self.handle_toolhelpsnapshot = 0xaaaa00
        Severity: Minor
        Found in miasm/os_dep/win_api_x86_32.py - About 1 hr to fix

          Function ioctl has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def ioctl(self, fd, cmd, arg):
                  """Stub for 'ioctl' syscall
                  Return the list of element to pack back depending on target ioctl
                  If the ioctl is disallowed, return False
                  """
          Severity: Minor
          Found in miasm/os_dep/linux/environment.py - About 1 hr 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 15 (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 = 64
                  if fixed_size is None:
                      fixed_size = set()
          Severity: Minor
          Found in miasm/arch/aarch64/arch.py - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def decode(self, v):
                  val = v & self.lmask
                  if self.parent.immop.value == 0:
                      imm = val
                      if self.parent.updown.value == 0:
          Severity: Minor
          Found in miasm/arch/arm/arch.py - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def encode(self):
                  if not isinstance(self.expr, ExprId):
                      return False
                  if self.expr in gpregs64.expr and not hasattr(self.parent, 'stk'):
                      self.parent.rex_w.value = 1
          Severity: Minor
          Found in miasm/arch/x86/arch.py - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def divert(self, i, candidates):
                  out = []
                  done = False
                  for cls, name, bases, dct, fields in candidates:
                      ndct = dict(dct)
          Severity: Minor
          Found in miasm/arch/x86/arch.py - About 1 hr 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 fromstring has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def fromstring(self, text, loc_db, parser_result=None):
                  if not hasattr(self.parent, 'sx') and hasattr(self.parent, "w8"):
                      self.parent.w8.value = 1
                  if parser_result:
                      result, start, stop = parser_result[self.parser]
          Severity: Minor
          Found in miasm/arch/x86/arch.py - About 1 hr 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