hackedteam/test-av

View on GitHub

Showing 1,005 of 1,471 total issues

Avoid deeply nested control flow statements.
Open

                        if resource_id.name is not None:
                            dump.add_line('Name: [%s]' % resource_id.name, 6)
                        else:
                            dump.add_line('Id: [0x%X]' % resource_id.struct.Id, 6)
                        
Severity: Major
Found in lib/pefile/pefile.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if stringtable_offset >= stringfileinfo_struct.Length:
                                break
                
                # Parse a VarFileInfo entry
                #
    Severity: Major
    Found in lib/pefile/pefile.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if not var_struct:
                                  break
                              
      Severity: Major
      Found in lib/pefile/pefile.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for st_entry in entry.StringTable:
                                    [dump.add_line('  '+line) for line in st_entry.dump()]
                                    dump.add_line('  LangID: '+st_entry.LangID)
                                    dump.add_newline()
                                    for str_entry in st_entry.entries.items():
        Severity: Major
        Found in lib/pefile/pefile.py - About 45 mins to fix

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

              def __init__(self, id=None, schema_version=None, Analyses=None, Behaviors=None, Actions=None, Pools=None):
          Severity: Minor
          Found in lib/maec/maec11.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if not stringtable_struct:
                                        break
                                    
            Severity: Major
            Found in lib/pefile/pefile.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      while varword_offset < orig_varword_offset + var_struct.ValueLength:
                                          word1 = self.get_word_from_data(
                                              raw_data[varword_offset:varword_offset+2], 0)
                                          word2 = self.get_word_from_data(
                                              raw_data[varword_offset+2:varword_offset+4], 0)
              Severity: Major
              Found in lib/pefile/pefile.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for st_entry in entry.StringTable:
                                            for key, entry in st_entry.entries.items():
                                                
                                                offsets = st_entry.entries_offsets[key]
                                                lengths = st_entry.entries_lengths[key]
                Severity: Major
                Found in lib/pefile/pefile.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if var_offset <= var_offset+var_struct.Length:
                                              break
                                  
                              
                              # Increment and align the offset
                  Severity: Major
                  Found in lib/pefile/pefile.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if hasattr(resource_id, 'directory'):
                                                if hasattr(resource_id.directory, 'strings') and resource_id.directory.strings:
                                                    for res_string in resource_id.directory.strings.values():
                                                        resources_strings.append( res_string )
                                                        
                    Severity: Major
                    Found in lib/pefile/pefile.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              for var_entry in entry.Var:
                                                  if hasattr(var_entry, 'entry'):
                                                      [dump.add_line('  '+line) for line in var_entry.dump()]
                                                      dump.add_line(
                                                          '    ' + 
                      Severity: Major
                      Found in lib/pefile/pefile.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if hasattr(resource_id, 'directory'):
                                                    
                                                    resource_strings = dict()
                                                    
                                                    for resource_lang in resource_id.directory.entries:
                        Severity: Major
                        Found in lib/pefile/pefile.py - About 45 mins to fix

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

                          def new(host=None, port=10000, ident=None, secret=None, reconnect=True, sleepwait=20):
                          Severity: Minor
                          Found in lib/hpfeeds.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if hasattr(resource_id, 'directory'):
                                                        dump.add_lines(resource_id.directory.struct.dump(), 8)
                                                        
                                                        for resource_lang in resource_id.directory.entries:
                                                            if hasattr(resource_lang, 'data'):
                            Severity: Major
                            Found in lib/pefile/pefile.py - About 45 mins to fix

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

                                  def __init__(self, type_=None, id=None, classificationName=None, companyName=None, category=None, classificationDetails=None):
                              Severity: Minor
                              Found in lib/maec/maec11.py - About 45 mins to fix

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

                                    def __init__(self, Start_Address=None, Source_Address=None, Destination_Address=None, Page_Base_Address=None, Target_PID=None, Requested_Address=None):
                                Severity: Minor
                                Found in lib/maec/maec11.py - About 45 mins to fix

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

                                      def __init__(self, Existing_File_Name=None, Destination_File_Name=None, Access_Mode=None, Flags=None, Open_Mode=None, File_Attributes=None):
                                  Severity: Minor
                                  Found in lib/maec/maec11.py - About 45 mins to fix

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

                                        def __init__(self, Process_Base_Address=None, Thread_ID=None, Start_Address=None, Creation_Flags=None, User_Name=None, Target_PID=None):
                                    Severity: Minor
                                    Found in lib/maec/maec11.py - About 45 mins to fix

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

                                          def exportLiteralChildren(self, outfile, level, name_):
                                              if self.company is not None:
                                                  showIndent(outfile, level)
                                                  outfile.write('company=%s,\n' % quote_python(self.company).encode(ExternalEncoding))
                                              if self.author is not None:
                                      Severity: Minor
                                      Found in lib/maec/maec11.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 buildChildren has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
                                              if nodeName_ == 'company':
                                                  company_ = child_.text
                                                  company_ = self.gds_validate_string(company_, node, 'company')
                                                  self.company = company_
                                      Severity: Minor
                                      Found in lib/maec/maec11.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