cea-sec/miasm

View on GitHub

Showing 1,373 of 3,020 total issues

File sem.py has 4353 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#
# Copyright (C) 2011 EADS France, Fabrice Desclaux <fabrice.desclaux@eads.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Severity: Major
Found in miasm/arch/x86/sem.py - About 1 wk to fix

    File arch.py has 3761 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #-*- coding:utf-8 -*-
    
    from __future__ import print_function
    from builtins import range
    import re
    Severity: Major
    Found in miasm/arch/x86/arch.py - About 1 wk to fix

      File arch.py has 2720 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #-*- coding:utf-8 -*-
      
      from builtins import range
      from future.utils import viewitems
      
      
      Severity: Major
      Found in miasm/arch/arm/arch.py - About 1 wk to fix

        File win_api_x86_32.py has 2634 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from __future__ import print_function
        #
        # Copyright (C) 2011 EADS France, Fabrice Desclaux <fabrice.desclaux@eads.net>
        #
        # This program is free software; you can redistribute it and/or modify
        Severity: Major
        Found in miasm/os_dep/win_api_x86_32.py - About 1 wk to fix

          File data_flow.py has 1918 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """Data flow analysis based on miasm intermediate representation"""
          from builtins import range
          from collections import namedtuple, Counter
          from pprint import pprint as pp
          from future.utils import viewitems, viewvalues
          Severity: Major
          Found in miasm/analysis/data_flow.py - About 5 days to fix

            File sem.py has 1821 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            from builtins import range
            from future.utils import viewitems
            
            from miasm.expression.expression import ExprId, ExprInt, ExprLoc, ExprMem, \
                ExprCond, ExprCompose, ExprOp, ExprAssign
            Severity: Major
            Found in miasm/arch/aarch64/sem.py - About 4 days to fix

              File sem.py has 1788 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              from builtins import range
              from future.utils import viewitems, viewvalues
              
              from miasm.expression.expression import *
              from miasm.expression.simplifications import expr_simp
              Severity: Major
              Found in miasm/arch/arm/sem.py - About 4 days to fix

                File arch.py has 1728 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                #-*- coding:utf-8 -*-
                
                from builtins import range
                from future.utils import viewitems, viewvalues
                
                
                Severity: Major
                Found in miasm/arch/aarch64/arch.py - About 4 days to fix

                  File expression.py has 1643 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  #
                  # Copyright (C) 2011 EADS France, Fabrice Desclaux <fabrice.desclaux@eads.net>
                  #
                  # This program is free software; you can redistribute it and/or modify
                  # it under the terms of the GNU General Public License as published by
                  Severity: Major
                  Found in miasm/expression/expression.py - About 4 days to fix

                    Function simp_cst_propagation has a Cognitive Complexity of 210 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def simp_cst_propagation(e_s, expr):
                        """This passe includes:
                         - Constant folding
                         - Common logical identities
                         - Common binary identities
                    Severity: Minor
                    Found in miasm/expression/simplifications_common.py - About 4 days 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 gen_modrm_form has a Cognitive Complexity of 201 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def gen_modrm_form():
                        global db_afs_64, sib_64_s08_ebp
                        ebp = 5
                    
                        sib_s08_ebp = [{f_isad: True} for i in range(0x100)]
                    Severity: Minor
                    Found in miasm/arch/x86/arch.py - About 4 days 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 simplifications_common.py has 1535 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # ----------------------------- #
                    # Common simplifications passes #
                    # ----------------------------- #
                    
                    from future.utils import viewitems
                    Severity: Major
                    Found in miasm/expression/simplifications_common.py - About 4 days to fix

                      File pe.py has 1470 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      #! /usr/bin/env python
                      
                      from __future__ import print_function
                      from builtins import range, str
                      from collections import defaultdict
                      Severity: Major
                      Found in miasm/loader/pe.py - About 3 days to fix

                        File llvmconvert.py has 1463 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        #
                        #
                        # Miasm2 Extension:                                                            #
                        # - Miasm2 IR to LLVM IR                                                       #
                        # - JiT                                                                        #
                        Severity: Major
                        Found in miasm/jitter/llvmconvert.py - About 3 days to fix

                          File objc.py has 1424 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          """
                          C helper for Miasm:
                          * raw C to Miasm expression
                          * Miasm expression to raw C
                          * Miasm expression to C type
                          Severity: Major
                          Found in miasm/core/objc.py - About 3 days to fix

                            File cpu.py has 1364 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            #-*- coding:utf-8 -*-
                            
                            from builtins import range
                            import re
                            import struct
                            Severity: Major
                            Found in miasm/core/cpu.py - About 3 days to fix

                              File elf.py has 1349 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              #! /usr/bin/env python
                              
                              from miasm.loader.cstruct import CStruct
                              
                              class Ehdr(CStruct):
                              Severity: Major
                              Found in miasm/loader/elf.py - About 3 days to fix

                                Function add_ir has a Cognitive Complexity of 164 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def add_ir(self, expr):
                                        "Add a Miasm2 IR to the last bbl. Return the var created"
                                
                                        if self.main_stream is True and expr in self.expr_cache:
                                            return self.expr_cache[expr]
                                Severity: Minor
                                Found in miasm/jitter/llvmconvert.py - About 3 days 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 types.py has 1269 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                """This module provides classes to manipulate pure C types as well as their
                                representation in memory. A typical usecase is to use this module to
                                easily manipylate structures backed by a VmMngr object (a miasm sandbox virtual
                                memory):
                                
                                
                                Severity: Major
                                Found in miasm/core/types.py - About 3 days to fix

                                  File asmblock.py has 1109 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  #-*- coding:utf-8 -*-
                                  
                                  from builtins import map
                                  from builtins import range
                                  import logging
                                  Severity: Major
                                  Found in miasm/core/asmblock.py - About 2 days to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language