ANSSI-FR/polichombr

View on GitHub

Showing 1,243 of 1,244 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def make_data(self, *args):
        ea, flags, tid, length = args
        logger.debug("New data at 0x%x, length 0x%x, flags 0x%x ",
                     ea,
                     length,
Severity: Major
Found in skelenox_plugin/hooks.py and 1 other location - About 1 hr to fix
skelenox_plugin/hooks.py on lines 210..216

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 41.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def op_ti_changed(self, *args):
        self, ea, ftype, fnames = args
        logger.debug("TI Changed at 0x%x type %s fnames 0x%s",
                     ea,
                     ftype,
Severity: Major
Found in skelenox_plugin/hooks.py and 1 other location - About 1 hr to fix
skelenox_plugin/hooks.py on lines 202..208

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 41.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

    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

    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 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

    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

    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

    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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        if 'newname' in list(data.keys()):
            result = api.idacontrol.change_struct_member_name(struct_id, mid,
                                                              data["newname"])
    Severity: Major
    Found in polichombr/views/api_idaactions.py and 1 other location - About 1 hr to fix
    polichombr/views/api_idaactions.py on lines 309..311

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        if 'newsize' in list(data.keys()):
            result = api.idacontrol.change_struct_member_size(struct_id, mid,
                                                              data["newsize"])
    Severity: Major
    Found in polichombr/views/api_idaactions.py and 1 other location - About 1 hr to fix
    polichombr/views/api_idaactions.py on lines 306..308

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                for s in unicodestrings:
                    x = (StringsType.UNICODE, s)
                    if x not in self.resultstrings:
                        self.resultstrings.append(x)
    Severity: Major
    Found in polichombr/controllers/tasks/task_strings.py and 1 other location - About 1 hr to fix
    polichombr/controllers/tasks/task_strings.py on lines 46..49

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                for s in asciistrings:
                    x = (StringsType.ASCII, s)
                    if x not in self.resultstrings:
                        self.resultstrings.append(x)
    Severity: Major
    Found in polichombr/controllers/tasks/task_strings.py and 1 other location - About 1 hr to fix
    polichombr/controllers/tasks/task_strings.py on lines 50..53

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          elif rename_yara_form.validate_on_submit():
              if rename_yara_form.item_id:
                  yar = api.get_elem_by_type("yara",
                                             rename_yara_form.item_id.data)
                  api.yaracontrol.rename(rename_yara_form.newname.data, yar)
      Severity: Major
      Found in polichombr/views/webui.py and 1 other location - About 1 hr to fix
      polichombr/views/webui.py on lines 240..245

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 38.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          elif change_tlp_level_form.validate_on_submit():
              if change_tlp_level_form.item_id:
                  yar = api.get_elem_by_type("yara",
                                             change_tlp_level_form.item_id.data)
                  api.yaracontrol.set_tlp_level(
      Severity: Major
      Found in polichombr/views/webui.py and 1 other location - About 1 hr to fix
      polichombr/views/webui.py on lines 246..250

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 38.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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 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 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

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      class FamilyForm(FlaskForm):
      
          """
          Create family.
          """
      Severity: Major
      Found in polichombr/views/forms.py and 2 other locations - About 50 mins to fix
      polichombr/views/forms.py on lines 209..218
      polichombr/views/forms.py on lines 275..285

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 36.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language