ANSSI-FR/polichombr

View on GitHub

Showing 85 of 1,244 total issues

Function machoc_get_similar_functions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def machoc_get_similar_functions(cls, sample_dst, sample_src):
        """
            Diff two sample in order to identify similar functions.
            This is performed by:
                - getting unique machoc hashes;
Severity: Minor
Found in polichombr/controllers/sample.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

Method printCallTree has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def printCallTree(fromaddr, toaddr)
  @currenttree_done = []
  i = 0
  @glinestree = 9999
  log('')
Severity: Minor
Found in polichombr/analysis_tools/AnalyzeIt.rb - About 1 hr to fix

    Function execute_yara_task has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def execute_yara_task(mqueue):
        """
        Special dedicated YARA worker. Dispatches newly created yara rules on the
        samples pool. There is no analysis in this case,
        nor priority considerations, that's why it has been separated.
    Severity: Minor
    Found in polichombr/controllers/jobpool.py - About 55 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 renamed has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def renamed(self, *args):
            logger.debug("[IDB Hook] Something is renamed")
            ea, new_name, is_local_name = args
            min_ea = idc.get_inf_attr(idc.INF_MIN_EA)
            max_ea = idc.get_inf_attr(idc.INF_MAX_EA)
    Severity: Minor
    Found in skelenox_plugin/hooks.py - About 55 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 parse_ida_cmds has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_ida_cmds(self, sid, functions):
            """
                Parse and add IDA commands dumped by AnalyzeIt,
                and updates the functions names if needed
            """
    Severity: Minor
    Found in polichombr/controllers/tasks/task_analyzeitrb.py - About 55 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 api_post_samples has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def api_post_samples():
        """
        @description : Insert a new sample in database, launch analysis
        @arg: string filename
        @arg: binary data : the sample content
    Severity: Minor
    Found in polichombr/views/api_sample.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 match_by_importhash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def match_by_importhash(cls, sample):
            """
                Match samples by import hash.
            """
            if sample.import_hash is None or sample.import_hash == "":
    Severity: Minor
    Found in polichombr/controllers/sample.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

    Avoid deeply nested control flow statements.
    Open

                  printCallTree(dasm.normalize(ep), orifunc) if isFuncTreeLink(dasm.normalize(ep), orifunc)
    Severity: Major
    Found in polichombr/analysis_tools/AnalyzeIt.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if di.block.list[i - 1].opcode.name == 'push'
                    if carg == arg
                      return $gdasm.normalize(di.block.list[i - 1].instruction.args.first)
                    end
                    carg += 1
      Severity: Major
      Found in polichombr/analysis_tools/AnalyzeIt.rb - About 45 mins to fix

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

        def ui_search():
            """
            Handle search forms
            """
            hform = HashSearchForm()
        Severity: Minor
        Found in polichombr/views/webui.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

        Avoid deeply nested control flow statements.
        Open

                    if (di.block.list[i].opcode.name == 'call') && (di.block.list[i].instruction.args.first == creg)
                      i -= 1
                      while i >= 0
                        if di.block.list[i].opcode.name == 'push'
                          if carg == arg
        Severity: Major
        Found in polichombr/analysis_tools/AnalyzeIt.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    AddTagFunction(basefunc, 'Net_') unless basefunc.nil?
          Severity: Major
          Found in polichombr/analysis_tools/AnalyzeIt.rb - About 45 mins to fix

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

                def create_sample_from_file(self, file_data, orig_filename="", user=None,
                                            tlp_level=TLPLevel.TLPWHITE):
                    """
                        Creates a sample from file data. Updates metadata, etc.
                    """
            Severity: Minor
            Found in polichombr/controllers/sample.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 search_machoc_full_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def search_machoc_full_hash(self, machoc_hash, limit=0.8):
                    """
                        Search a full machoc hash.
                        In one word, diffs with other samples in database.
                    """
            Severity: Minor
            Found in polichombr/controllers/sample.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

            Avoid deeply nested control flow statements.
            Open

                        if (di.block.list[i - 1].opcode.name == 'mov') && ((di.block.list[i - 1].instruction.args.first.to_s == "dword ptr [esp+0#{arg.to_s(16)}h]") || (((di.block.list[i - 1].instruction.args.first.to_s == 'dword ptr [esp]') && (esp == 0))))
                          return $gdasm.normalize(di.block.list[i - 1].instruction.args.last)
                        end
            Severity: Major
            Found in polichombr/analysis_tools/AnalyzeIt.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        AddTagFunction(basefunc, 'Net_') unless basefunc.nil?
              Severity: Major
              Found in polichombr/analysis_tools/AnalyzeIt.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              printCallTree(dasm.normalize(ep), orifunc) if isFuncTreeLink(dasm.normalize(ep), orifunc)
                Severity: Major
                Found in polichombr/analysis_tools/AnalyzeIt.rb - About 45 mins to fix

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

                  def get_filter_arguments(mrequest):
                      """
                          Get timestamp and address from request
                      """
                      data = mrequest.args
                  Severity: Minor
                  Found in polichombr/views/api_idaactions.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 dispatch_sample_creation has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def dispatch_sample_creation(self,
                  Severity: Minor
                  Found in polichombr/controllers/api.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                return nil if di.block.list[i - 1].opcode.name == 'call'
                    Severity: Major
                    Found in polichombr/analysis_tools/AnalyzeIt.rb - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language