ANSSI-FR/polichombr

View on GitHub

Showing 85 of 1,244 total issues

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

Function create_sample_and_run_analysis has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def create_sample_and_run_analysis(
Severity: Minor
Found in polichombr/controllers/api.py - About 35 mins to fix

    Function add_function has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def add_function(cls, sample, address, machoc_hash,
    Severity: Minor
    Found in polichombr/controllers/sample.py - About 35 mins to fix

      Function add_function has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_function(cls, sample, address, machoc_hash,
                           name="", overwrite=False):
              """
                  Add a function. Updates if exists.
              """
      Severity: Minor
      Found in polichombr/controllers/sample.py - About 35 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_families has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def api_post_families():
          """
              Insert a new family
              @return the created family id
          """
      Severity: Minor
      Found in polichombr/views/api_family.py - About 35 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 login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def login():
          """
          Flask-Login.
          """
          if g.user.is_authenticated:
      Severity: Minor
      Found in polichombr/views/webui_user.py - About 35 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 gen_sample_view has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def gen_sample_view(sample_id, graph=None, fctaddr=None):
          """
          Generates a sample's view (template). We split the view because of the
          disassembly view, which is directly included in the sample's view, but
          not "by default".
      Severity: Minor
      Found in polichombr/views/webui_sample.py - About 35 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 execute_rename has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute_rename(name):
              """
                  This is a wrapper to execute the renaming synchronously
              """
              def get_name():
      Severity: Minor
      Found in skelenox_plugin/utils.py - About 35 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 get_comment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_comment(address):
              """
                  Wrapper to get both the Cmt and RptCmt
              """
              cmt_types = [idc.get_cmt, idc.get_func_cmt]  # TODO: RPT CMT
      Severity: Minor
      Found in skelenox_plugin/utils.py - About 35 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 too many return statements within this method.
      Open

            return true if is_linked_block(tdi, start_address)
      Severity: Major
      Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                          return di.block.list[i].instruction.args.last
        Severity: Major
        Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return $gdasm.normalize(di.block.list[i].instruction.args.first)
          Severity: Major
          Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

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

              Avoid too many return statements within this method.
              Open

                  return di.block.list[0].address if $gdasm.function[di.block.list[0].address]
              Severity: Major
              Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                              return nil
                Severity: Major
                Found in polichombr/analysis_tools/AnalyzeIt.rb - About 30 mins to fix

                  Function poli_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def poli_request(self, endpoint, data, method="POST"):
                          """
                              @arg : endpoint The API target endpoint
                              @arg : data dictionary
                              @return : dict issued from JSON
                  Severity: Minor
                  Found in skelenox_plugin/connection.py - About 25 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 do_diff_samples has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def do_diff_samples(sid1, sid2):
                      """
                          Diff form has been submitted
                      """
                      sample1 = api.get_elem_by_type("sample", sid1)
                  Severity: Minor
                  Found in polichombr/views/webui_sample.py - About 25 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 register_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def register_user():
                      """
                      User registration, if enabled in configuration file.
                      """
                      if g.user.is_authenticated or not current_app.config['USERS_CAN_REGISTER']:
                  Severity: Minor
                  Found in polichombr/views/webui_user.py - About 25 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 export_detection_openioc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def export_detection_openioc(family, tlp_level):
                          """
                              Exports the detection OPENIOC items.
                  
                              TODO: move openioc generation to a new file.
                  Severity: Minor
                  Found in polichombr/controllers/family.py - About 25 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 export_detection_snort has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def export_detection_snort(family, tlp_level):
                          """
                              Exports the yara detection SNORT rules.
                          """
                          generated_output = "# SNORT ruleset for family " + family.name + "\n\n"
                  Severity: Minor
                  Found in polichombr/controllers/family.py - About 25 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