etz69/irhelper

View on GitHub
vol_plugins/ndispktscan.py

Summary

Maintainability
A
2 hrs
Test Coverage

Function calculate has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def calculate(self):

        if self._config.SLACK and (self._config.DSTS or self._config.PCAP):
            debug.error('SLACK can\'t be used with PCAP or DSTS')
        
Severity: Minor
Found in vol_plugins/ndispktscan.py - About 1 day 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 ndispktscan.py has 463 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

###https://github.com/bridgeythegeek/ndispktscan
##Bridgey the Geek

import os
import re
Severity: Minor
Found in vol_plugins/ndispktscan.py - About 7 hrs to fix

Function render_text has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def render_text(self, outfd, data):

        if self._config.SLACK:
        
            # Output the table header
Severity: Minor
Found in vol_plugins/ndispktscan.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 macfind_ndsh has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def macfind_ndsh(addr_space, start):
    
        macs = set()
        scanner = NDshScanner()
        for ss in NDISPktScan.gen_session_spaces(addr_space):
Severity: Minor
Found in vol_plugins/ndispktscan.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 get_flags has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def get_flags(self):
        """Get string representation of TCP flags"""

        flags = []
        if self.ns == 1: flags.append('NS')
Severity: Minor
Found in vol_plugins/ndispktscan.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 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

                        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

Avoid deeply nested control flow statements.
Open

                        if eth_payload.is_tcp():
                            payload = obj.Object('_TCP', vm=session_space,
                                offset=eth_payload.payload_offset())
                        elif eth_payload.is_udp():
                            payload = obj.Object('_UDP', vm=session_space,
Severity: Major
Found in vol_plugins/ndispktscan.py - About 45 mins to fix

Function make_ip has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def make_ip(ip):
        """Get string representation of IPv6 address"""

        # TODO: There's gotta be a cleaner way, right?
        r = ''
Severity: Minor
Found in vol_plugins/ndispktscan.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 gen_session_spaces has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def gen_session_spaces(addr_space):
    
        sessions = []
        for proc in tasks.pslist(addr_space):
            sid = proc.SessionId
Severity: Minor
Found in vol_plugins/ndispktscan.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

There are no issues that match your filters.

Category
Status