ANSSI-FR/polichombr

View on GitHub

Showing 85 of 1,244 total issues

File yara_rule.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
    This file is part of Polichombr.

    (c) 2017 ANSSI-FR

Severity: Minor
Found in polichombr/controllers/yara_rule.py - About 2 hrs to fix

    Function search_fulltext has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def search_fulltext(cls, needle, max_results=50):
            """
                Search a text in lot of items and return associated samples.
                Searchs in filenames, strings, functions names and anlysis
                abstracts. Oh, and also in samples abstracts.
    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 printSubCallTree has 44 lines of code (exceeds 25 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 1 hr to fix

      Method printCallTree has a Cognitive Complexity of 14 (exceeds 5 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

      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 load_tasks has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def load_tasks(self):
              """
              Dynamically loads the tasks in the tasks/ folder. The tasks must
              be loaded here in order to avoid too much memory usage.
              """
      Severity: Minor
      Found in polichombr/controllers/analysis.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 is_looping has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.is_looping(di)
          @blocks_done = []
          @loopcount = 0
          result = false
      
      
      Severity: Minor
      Found in polichombr/analysis_tools/AnalyzeIt.rb - 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

      Function execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute(self):
              self.tstart = int(time.time())
              self.tmessage = "STRINGS TASK %d :: " % (self.sid)
              app.logger.debug(self.tmessage + "EXECUTE")
              if os.path.exists(self.fpath):
      Severity: Minor
      Found in polichombr/controllers/tasks/task_strings.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

      Function view_user has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def view_user(user_id):
          """
              View a single user activity
              Useful for executive report
          """
      Severity: Minor
      Found in polichombr/views/webui_user.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

      Function ui_sample_upload has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def ui_sample_upload():
          """
          Sample creation from binary file.
          """
          upload_form = UploadSampleForm()
      Severity: Minor
      Found in polichombr/views/webui_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

      Function disassemble_sample_get_svg has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def disassemble_sample_get_svg(sample_id, address):
          """
              Gets SVG file data, with functions names.
          """
          graph = disassemble_sample(sample_id, address)
      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

      Function generate_family_row has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function generate_family_row(family){
          row = $("<div></div>");
          row.attr("id", "family_" + family["id"]);
          row.attr("class", "row panel panel-default families");
          row.attr("style", "padding: 5px;");
      Severity: Minor
      Found in polichombr/static/js/families.js - About 1 hr to fix

        Method calculate_machoc_hash has 38 lines of code (exceeds 25 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 1 hr to fix

          Function generate_samples_zip_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def generate_samples_zip_file(family, tlp_level):
                  """
                      Generates a sample ZIP file.
                      We actually store it in the storage under a
                      unique filename : family-tlp_level-sha256(samples sha256).
          Severity: Minor
          Found in polichombr/controllers/family.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 repareIatLinks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def repareIatLinks
            $gdasm.decoded.each do |_addr, di|
              next unless (di.opcode.name == 'mov') && defined?(di.instruction.args.last.symbolic.target)
              label = $gdasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce)
              if label =~ /^iat_/
          Severity: Minor
          Found in polichombr/analysis_tools/AnalyzeIt.rb - 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

          Function expand_callback has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function expand_callback(event_data){
              /*
               * Construct a subpanel with buttons linking to subfamilies
               */
              console.log(`Family ${event_data["data"]} expand requested`);
          Severity: Minor
          Found in polichombr/static/js/families.js - About 1 hr to fix

            Method calculateSizeSubCallTree has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def calculateSizeSubCallTree(fromaddr, toaddr, indent, cnt)
              return 0 if fromaddr == toaddr
              i = 0
              total = 1
              return total if indent.length > 5
            Severity: Minor
            Found in polichombr/analysis_tools/AnalyzeIt.rb - 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

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

                def sample_rename_from_diff(cls, items, sample_dst, sample_src):
                    """
                        Rename a sample's functions with other ones functions.
                    """
                    for fid_dst, fid_src in items:
            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

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

                def add_actions_fromfunc_infos(self, funcinfos, sample_dst, sample_src):
                    """
                        Create IDAActions from the samples's FuncInfos from AnalyzeIt
                    """
                    for fid_dst, fid_src in funcinfos:
            Severity: Minor
            Found in polichombr/controllers/api.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

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

            def ui_yara():
                """
                Yara signatures view.
                """
                create_yara_form = YaraForm()
            Severity: Minor
            Found in polichombr/views/webui.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 is_linked_func has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def is_linked_func(currFunc, start_address, stop_address)
              result = false
              return true if currFunc == stop_address
              @tree_done << currFunc
              getToFunc(currFunc).each do |tdi_addr|
            Severity: Minor
            Found in polichombr/analysis_tools/AnalyzeIt.rb - 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

            Severity
            Category
            Status
            Source
            Language