hackedteam/test-av

View on GitHub
modules/processing/behavior.py

Summary

Maintainability
F
4 days
Test Coverage

Function _gen_keys has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def _gen_keys(self):
        """Get registry calls.
        @return: keys information list.
        """
        keys = []
Severity: Minor
Found in modules/processing/behavior.py - About 5 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 _gen_files has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def _gen_files(self):
        """Gets files calls.
        @return: information list.
        """
        files = []
Severity: Minor
Found in modules/processing/behavior.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 _gen_mutexes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def _gen_mutexes(self):
        """Get mutexes information.
        @return: Mutexes information list.
        """
        mutexes = []
Severity: Minor
Found in modules/processing/behavior.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

File behavior.py has 278 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (C) 2010-2012 Cuckoo Sandbox Developers.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.

import os
Severity: Minor
Found in modules/processing/behavior.py - About 2 hrs to fix

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

        def gen_proclist(self):
            """Generate processes list.
            @return: True.
            """
            for entry in self.proc_results:
    Severity: Minor
    Found in modules/processing/behavior.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 _parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _parse(self, row):
            """Parse log row.
            @param row: row data.
            @return: parsed information dict.
            """
    Severity: Minor
    Found in modules/processing/behavior.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

    Avoid deeply nested control flow statements.
    Open

                            if argument["name"] == "FileName":
                                if argument["value"] not in files:
                                    files.append(argument["value"])
    
    
    Severity: Major
    Found in modules/processing/behavior.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if argument["name"] == "Registry":
                                  registry = int(argument["value"], 16)
                              elif argument["name"] == "SubKey":
                                  subkey = argument["value"]
                              elif argument["name"] == "Handle":
      Severity: Major
      Found in modules/processing/behavior.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if argument["name"] == "MutexName":
                                    if argument["value"] not in mutexes:
                                        mutexes.append(argument["value"])
        
        
        Severity: Major
        Found in modules/processing/behavior.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if argument["name"] == "ProcessId":
                                      process["children"].append(int(argument["value"]))
          
          
          Severity: Major
          Found in modules/processing/behavior.py - About 45 mins to fix

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

                def run(self):
                    """Run analysis.
                    @return: processes infomartion list.
                    """
                    results = []
            Severity: Minor
            Found in modules/processing/behavior.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 populate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def populate(self, node):
                    """Populate tree.
                    @param node: node to add.
                    @return: True.
                    """
            Severity: Minor
            Found in modules/processing/behavior.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

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

                def _gen_mutexes(self):
                    """Get mutexes information.
                    @return: Mutexes information list.
                    """
                    mutexes = []
            Severity: Major
            Found in modules/processing/behavior.py and 1 other location - About 7 hrs to fix
            modules/processing/behavior.py on lines 176..190

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

            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 _gen_files(self):
                    """Gets files calls.
                    @return: information list.
                    """
                    files = []
            Severity: Major
            Found in modules/processing/behavior.py and 1 other location - About 7 hrs to fix
            modules/processing/behavior.py on lines 242..256

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

            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 4 locations. Consider refactoring.
            Open

                    if not os.path.exists(self._log_path):
                        log.error("Analysis logs folder does not exist at path \"%s\"."
                                  % self._log_path)
                        return False
            Severity: Major
            Found in modules/processing/behavior.py and 3 other locations - About 1 hr to fix
            lib/cuckoo/core/sniffer.py on lines 29..31
            modules/processing/behavior.py on lines 132..135
            modules/processing/network.py on lines 173..175

            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 4 locations. Consider refactoring.
            Open

                    if not os.path.exists(self._logs_path):
                        log.error("Analysis results folder does not exist at path \"%s\"."
                                  % self._logs_path)
                        return results
            Severity: Major
            Found in modules/processing/behavior.py and 3 other locations - About 1 hr to fix
            lib/cuckoo/core/sniffer.py on lines 29..31
            modules/processing/behavior.py on lines 103..106
            modules/processing/network.py on lines 173..175

            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

            There are no issues that match your filters.

            Category
            Status