ANSSI-FR/polichombr

View on GitHub

Showing 85 of 1,244 total issues

File AnalyzeIt.rb has 1196 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require './metasm/metasm'
include Metasm

require 'pp'
require 'date'
Severity: Major
Found in polichombr/analysis_tools/AnalyzeIt.rb - About 3 days to fix

    File sample.py has 868 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
        This file is part of Polichombr.
    
        (c) 2017 ANSSI-FR
    
    
    Severity: Major
    Found in polichombr/controllers/sample.py - About 2 days to fix

      Method getArg has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.getArg(addrori, arg)
          di = $gdasm.di_at(addrori)
          return nil unless defined?(di.opcode)
      
          carg = 0
      Severity: Minor
      Found in polichombr/analysis_tools/AnalyzeIt.rb - 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

      Method checkCall has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
      Open

      def checkCall(strFunc, xrefCall)
        basefunc = MetasmUtils.find_start_of_function(xrefCall)
        unless basefunc.nil?
          log('')
          log("Top of function : #{PoliUtils.poliLinkAddr(basefunc)} ; Top of block : #{PoliUtils.poliLinkAddr($gdasm.di_at(xrefCall).block.list[0].address)}")
      Severity: Minor
      Found in polichombr/analysis_tools/AnalyzeIt.rb - 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

      SampleController has 56 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class SampleController(object):
      
          """
              Wrapper to the Sample model. It is in charge of managing the creation,
              extraction and modification of samples, and all of directly related
      Severity: Major
      Found in polichombr/controllers/sample.py - About 1 day to fix

        File family.py has 387 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """
            This file is part of Polichombr.
        
            (c) 2018 ANSSI-FR
        
        
        Severity: Minor
        Found in polichombr/controllers/family.py - About 5 hrs to fix

          File connection.py has 382 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """
              Skelenox: the collaborative IDA Pro Agent
          
              This file is part of Polichombr
                  (c) ANSSI-FR 2018
          Severity: Minor
          Found in skelenox_plugin/connection.py - About 5 hrs to fix

            Method calculate_machoc_hash has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.calculate_machoc_hash(dasm)
                @fullFuncSign = ''
                @fullHashSign = ''
                @listoffunct = []
                dasm.function.each do |addr, _symb|
            Severity: Minor
            Found in polichombr/analysis_tools/AnalyzeIt.rb - About 4 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

            Method checkCall has 100 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def checkCall(strFunc, xrefCall)
              basefunc = MetasmUtils.find_start_of_function(xrefCall)
              unless basefunc.nil?
                log('')
                log("Top of function : #{PoliUtils.poliLinkAddr(basefunc)} ; Top of block : #{PoliUtils.poliLinkAddr($gdasm.di_at(xrefCall).block.list[0].address)}")
            Severity: Major
            Found in polichombr/analysis_tools/AnalyzeIt.rb - About 4 hrs to fix

              Method printSubCallTree has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              def printSubCallTree(fromaddr, toaddr, indent, cnt)
                return if fromaddr == toaddr
                i = 0
                space1 = ''
                indent.each do |_id, iscontinue|
              Severity: Minor
              Found in polichombr/analysis_tools/AnalyzeIt.rb - About 3 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

              FamilyController has 28 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class FamilyController(object):
                  """
                      Family object controller.
                  """
              
              
              Severity: Minor
              Found in polichombr/controllers/family.py - About 3 hrs to fix

                Method find_start_of_function has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.find_start_of_function(address)
                    blocks = []
                    di = $gdasm.di_at(address)
                    return nil unless defined?(di.instruction)
                    return nil unless defined?(di.block)
                Severity: Minor
                Found in polichombr/analysis_tools/AnalyzeIt.rb - About 3 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 sample.py has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """
                    This file is part of Polichombr.
                
                    (c) 2016 ANSSI-FR
                
                
                Severity: Minor
                Found in polichombr/models/sample.py - About 2 hrs to fix

                  File api_idaactions.py has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  """
                      This file is part of Polichombr.
                  
                      (c) 2018 ANSSI-FR
                  
                  
                  Severity: Minor
                  Found in polichombr/views/api_idaactions.py - About 2 hrs to fix

                    Function execute_task has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def execute_task(mqueue, kill_event):
                        """
                        Simple worker wich will execute the tasks analyses. It ends on setting the
                        analysis status as finished.
                        """
                    Severity: Minor
                    Found in polichombr/controllers/jobpool.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 set_tlp_level has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def set_tlp_level(self, family, tlp_level, no_propagation=False):
                            """
                                Change TLP level. Propagates to other items.
                            """
                            if family.parents:
                    Severity: Minor
                    Found in polichombr/controllers/family.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

                    Method getArg has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.getArg(addrori, arg)
                        di = $gdasm.di_at(addrori)
                        return nil unless defined?(di.opcode)
                    
                        carg = 0
                    Severity: Major
                    Found in polichombr/analysis_tools/AnalyzeIt.rb - About 2 hrs to fix

                      File forms.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      """
                          This file is part of Polichombr.
                      
                          (c) 2018 ANSSI-FR
                      
                      
                      Severity: Minor
                      Found in polichombr/views/forms.py - About 2 hrs to fix

                        SkelIDBHook has 21 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class SkelIDBHook(ida_idp.IDB_Hooks):
                            """
                                IDB hooks, subclassed from ida_idp.py
                            """
                            skel_conn = None
                        Severity: Minor
                        Found in skelenox_plugin/hooks.py - About 2 hrs to fix

                          Method is_linked_block has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def self.is_linked_block(di, start_address)
                              result = false
                              @loopcount += 1
                              return false if @loopcount > 500
                              return result unless defined?(di.block)
                          Severity: Minor
                          Found in polichombr/analysis_tools/AnalyzeIt.rb - 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

                          Severity
                          Category
                          Status
                          Source
                          Language