etz69/irhelper

View on GitHub

Showing 58 of 165 total issues

Function vol_regdump has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def vol_regdump(_project):
    global result

    print_header("Executing vol_regdump command")

Severity: Minor
Found in modules/cmds/vol_regdump_module.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 vol_netscan has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def vol_netscan(_project):
    global result
    print_header("Gathering network information")

    ###Testing area
Severity: Minor
Found in modules/cmds/vol_netscan_module.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 generator has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def generator(self, data):
        for result in data:
            try:
                yield (0, ['{0}'.format(result.get('timestamp') if result.get('timestamp') else result.get('key').LastWriteTime),
                        '{0}'.format(result.get('value') if not result.get('timestamp_type') else result.get('timestamp_type')),
Severity: Minor
Found in vol_plugins/system_info.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 execute_volatility_plugin has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def execute_volatility_plugin(plugin_type, plugin_name,
Severity: Major
Found in modules/utils/helper.py - About 1 hr to fix

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

def memoize(func):
    if os.path.exists(CACHE_FILE) and args.cache:
        debug("Using local cache ..")
        with open(CACHE_FILE) as f:
            cache = pickle.load(f)
Severity: Minor
Found in irhelper.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 vol_getosversion has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def vol_getosversion(_project):
    global result

    print_header("Attempting to gather OS version info")

Severity: Minor
Found in modules/cmds/vol_getosversion_module.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 clean_db has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def clean_db(self):
        '''
        Deletes the DB, cache and all files from dump dir

        '''
Severity: Minor
Found in modules/utils/helper.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 enrich_pslist has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def enrich_pslist(_project, plist):

    rdbl = dbops.DBOps(_project.db_name)
    query = "select FileName,CompanyName,OriginalFileName," \
            "FileDescription,FileSize,LegalCopyright,FileDescription,md5," \
Severity: Minor
Found in modules/cmds/vol_pslist_module.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

Avoid deeply nested control flow statements.
Open

                    if idx == (len(sections)-1):
                        running = False
                        thiselem = elem
                        nextelem = last_element+(len(cmd_out)-1)
                    else:
Severity: Major
Found in modules/cmds/vol_malfind_extended_module.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    for acctype in types:
                        if account_type == int(acctype):
                            results['users'][username]['Account Type'] = types[acctype]
                    results['users'][username]['RID'] = str(int(x.name().strip("0000"), 16)) #Since im converting hex to int, you need to tell python it's in base 16
Severity: Major
Found in modules/utils/samparser.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if content != None:
                            outfd.write("".join(["{0:#010x}  {1:<48}  {2}\n".format(vad.Start + o, h, ''.join(c))
                                       for o, h, c in utils.Hexdump(content)]))
                        else:
                            outfd.write("\tNo Hexdump: Memory Unreadable at {0:#010x}\n".format(vad.Start))
Severity: Major
Found in vol_plugins/hollowfind.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if int(suspicious_process['risk_index']) >= 2:
                        list_of_suspicious_processes.append(suspicious_process.copy())
                else:
Severity: Major
Found in modules/utils/helper.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if eth.eth_type == 0x0800: # IPv4:
                            eth_payload = obj.Object('_IPv4', vm=session_space,
                                offset = eth.v() + 0x0E)
                            end = 14 + eth_payload.length
                            if self._config.SLACK:
Severity: Major
Found in vol_plugins/ndispktscan.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if n not in jdata_keys:
                            jdata_keys.append(n)

Severity: Major
Found in modules/cmds/vol_pslist_module.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        for dst in dsts:
                            dsts_file.write(dst + '\n')
                    outfd.write('Written {:,} destination IPs to \'{}\'.\n'.format(
Severity: Major
Found in vol_plugins/ndispktscan.py - About 45 mins to fix

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

    def calculate(self):
        if self._config.PID:
            filter_pid = self._config.PID
            # This is so that when -p option is given it can still enumerate all processes to determine parent
            self._config.PID = None
Severity: Minor
Found in vol_plugins/psinfo2.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 process_list['mz']:
                        choice = "bad"
                        grisk_dict = {'pid': process_list['pid'], 'risk': 1}
                        result['risk_index'].append(grisk_dict.copy())

Severity: Major
Found in modules/cmds/vol_malfind_extended_module.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if username != None:
                            results['groups'][groupname]['Members'] += " -> " + username + "</br>"
                        else:
                            results['groups'][groupname]['Members'] += "\n"
                        newOffset += 28
Severity: Major
Found in modules/utils/samparser.py - About 45 mins to fix

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

    def update_parent_proc_info(self, proc_peb_info):
        """Builds a dictionary containing parent process information for all the processes"""
        self.parent_proc_info = {}
        for pid in proc_peb_info:
            self.parent_proc_info[pid] = []
Severity: Minor
Found in vol_plugins/psinfo2.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 update_parent_proc_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def update_parent_proc_info(self, proc_peb_info):
        """Builds a dictionary containing parent process information for all the processes"""
        self.parent_proc_info = {}
        for pid in proc_peb_info:
            self.parent_proc_info[pid] = []
Severity: Minor
Found in vol_plugins/hollowfind.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

Severity
Category
Status
Source
Language