hackedteam/test-av

View on GitHub

Showing 1,005 of 1,471 total issues

File maec11.py has 20341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2012 Cuckoo Sandbox Developers.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
Severity: Major
Found in lib/maec/maec11.py - About 2 mos to fix

    File pefile.py has 3140 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: Latin-1 -*-
    """pefile, Portable Executable reader module
    
    
    All the PE file basic structures are available with their default names
    Severity: Major
    Found in lib/pefile/pefile.py - About 1 wk to fix

      File bottle.py has 2548 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      """
      Bottle is a fast and simple micro-framework for small web applications. It
      offers request dispatching (Routes) with url parameter support, templates,
      Severity: Major
      Found in lib/bottle.py - About 1 wk to fix

        Function dump_info has a Cognitive Complexity of 189 (exceeds 5 allowed). Consider refactoring.
        Open

            def dump_info(self, dump=None):
                """Dump all the PE header information into human readable string."""
                
                
                if dump is None:
        Severity: Minor
        Found in lib/pefile/pefile.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

        Function parse_version_information has a Cognitive Complexity of 122 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_version_information(self, version_struct):
                """Parse version information structure.
                
                The date will be made available in three attributes of the PE object.
                
        Severity: Minor
        Found in lib/pefile/pefile.py - About 2 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 code has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
        Open

            def code(self):
                stack = [] # Current Code indentation
                lineno = 0 # Current line of code
                ptrbuffer = [] # Buffer for printable strings and token tuple instances
                codebuffer = [] # Buffer for generated python code
        Severity: Minor
        Found in lib/bottle.py - About 1 day 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

        Optional_HeaderType has 74 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Optional_HeaderType(GeneratedsSuper):
            subclass = None
            superclass = None
            def __init__(self, Hashes=None, Major_Linker_Version=None, Minor_Linker_Version=None, Size_Of_Code=None, Size_Of_Initialized_Data=None, Size_Of_Uninitialized_Data=None, Address_Of_Entry_Point=None, Base_Of_Code=None, Base_Of_Data=None, Image_Base=None, Section_Alignment=None, File_Alignment=None, Major_OS_Version=None, Minor_OS_Version=None, Major_Image_Version=None, Minor_Image_Version=None, Major_Subsystem_Version=None, Minor_Subsystem_Version=None, Reserved=None, Size_Of_Image=None, Size_Of_Headers=None, Checksum=None, Subsystem=None, DLL_Characteristics=None, Size_Of_Stack_Reserve=None, Size_Of_Stack_Commit=None, Size_Of_Heap_Reserve=None, Size_Of_Heap_Commit=None, Loader_Flags=None, Number_Of_Rva_And_Sizes=None, Data_Directory=None):
                self.Hashes = Hashes
        Severity: Major
        Found in lib/maec/maec11.py - About 1 day to fix

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

          class PE:
              """A Portable Executable representation.
              
              This class provides access to most of the information in a PE file.
              
          Severity: Major
          Found in lib/pefile/pefile.py - About 1 day to fix

            Function write has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
            Open

                def write(self, filename=None):
                    """Write the PE file.
                    
                    This function will process all headers and components
                    of the PE file and include all changes made (by just
            Severity: Minor
            Found in lib/pefile/pefile.py - About 1 day 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 parse_resources_directory has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
            Open

                def parse_resources_directory(self, rva, size=0, base_rva = None, level = 0, dirs=None):
                    """Parse the resources directory.
                    
                    Given the RVA of the resources directory, it will process all
                    its entries.
            Severity: Minor
            Found in lib/pefile/pefile.py - About 1 day 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

            Consider simplifying this complex logical expression.
            Open

                    if (
                        self.Hashes is not None or
                        self.Major_Linker_Version is not None or
                        self.Minor_Linker_Version is not None or
                        self.Size_Of_Code is not None or
            Severity: Critical
            Found in lib/maec/maec11.py - About 1 day to fix

              Function __parse__ has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __parse__(self, fname, data, fast_load):
                      """Parse a Portable Executable file.
                      
                      Loads a PE file, parsing all its structures and making them available
                      through the instance's attributes.
              Severity: Minor
              Found in lib/pefile/pefile.py - About 1 day 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 createFileObj has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                  def createFileObj(self, file):
                      """Creates a File object.
                      @param file: file dict from Cuckoo dict.
                      @requires: file object.
                      """
              Severity: Minor
              Found in modules/reporting/maec11.py - About 7 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 errors.py has 480 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # Copyright (C) 2010-2012 Cuckoo Sandbox Developers.
              # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
              # See the file 'docs/LICENSE' for copying permission.
              
              ERRORS = {
              Severity: Minor
              Found in analyzer/windows/lib/core/errors.py - About 7 hrs to fix

                Function parse_export_directory has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                Open

                    def parse_export_directory(self, rva, size):
                        """Parse the export directory.
                        
                        Given the RVA of the export directory, it will process all
                        its entries.
                Severity: Minor
                Found in lib/pefile/pefile.py - About 7 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

                ObjectType has 50 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class ObjectType(GeneratedsSuper):
                    """ObjectType is intended to serve as a method for the characterization
                    of any entities that actions and behaviors operate on or are
                    associated with.The object_name attribute specifies the name of
                    the object, if applicable.The type attribute is intended to
                Severity: Minor
                Found in lib/maec/maec11.py - About 7 hrs to fix

                  ActionImplementationType has 48 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ActionImplementationType(GeneratedsSuper):
                      """ActionImplementationType is intended to serve as a method for the
                      characterization of action implementations. Currently supported
                      are implementation achieved through API function calls and
                      abstractly defined code. The type attribute refers to the type
                  Severity: Minor
                  Found in lib/maec/maec11.py - About 6 hrs to fix

                    Function addRelations has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def addRelations(self):
                            """Adds relationships."""
                            # Dropped files
                            for file in self.results['dropped']:
                                self.relationships.add_relationship(self.createRelation(
                    Severity: Minor
                    Found in modules/reporting/metadata.py - About 6 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

                    objectsType has 44 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class objectsType(GeneratedsSuper):
                        subclass = None
                        superclass = None
                        def __init__(self, file=None, uri=None, domain=None, registry=None, ip=None, asn=None, entity=None, classification=None):
                            if file is None:
                    Severity: Minor
                    Found in lib/maec/maec11.py - About 6 hrs to fix

                      DOS_HeaderType has 44 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class DOS_HeaderType(GeneratedsSuper):
                          subclass = None
                          superclass = None
                          def __init__(self, Hashes=None, signature=None, lastsize=None, nblocks=None, nreloc=None, hdrsize=None, minalloc=None, maxalloc=None, checksum=None, relocpos=None, noverlay=None, reserved1=None, oem_id=None, oem_info=None, reserved2=None, e_lfanew=None):
                              self.Hashes = Hashes
                      Severity: Minor
                      Found in lib/maec/maec11.py - About 6 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language