GoVanguard/legion

View on GitHub

Showing 128 of 209 total issues

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

    def updateToolsTableView(self):
        if self.ui.MainTabWidget.tabText(self.ui.MainTabWidget.currentIndex()) == 'Scan' and \
                self.ui.HostsTabWidget.tabText(self.ui.HostsTabWidget.currentIndex()) == 'Tools':
            self.ToolsTableModel.setDataList(
                self.controller.getProcessesFromDB(self.viewState.filters,
Severity: Minor
Found in ui/view.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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__( self, HostNode ):
        self.hostNode = HostNode
        self.status = HostNode.getElementsByTagName('status')[0].getAttribute('state')
        for e in HostNode.getElementsByTagName('address'):
            if e.getAttribute('addrtype') == 'ipv4':
Severity: Minor
Found in parsers/Host.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 getContextMenuForHost has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def getContextMenuForHost(self, isChecked, showAll=True):
        menu = QMenu()
        self.nmapSubMenu = QMenu('Portscan')
        actions = []

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

    def format(self, record):
        record.message = record.getMessage()
        if self.usesTime():
            record.asctime = self.formatTime(record, self.datefmt)
        json_log = {
Severity: Minor
Found in utilities/stenoLogging.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 checkHydraResults has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def checkHydraResults(output):
    usernames = []
    passwords = []
    string = '\[[0-9]+\]\[[a-z-]+\].+'  # when a password is found, the line contains [port#][plugin-name]
    results = re.findall(string, output, re.I)
Severity: Minor
Found in app/auxiliary.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 getAllIps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def getAllIps(self, status=None):
        '''get a list of ip address'''
        __tmp_ips = []

        if status is None:
Severity: Minor
Found in parsers/Parser.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 processVulnersScriptOutput has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def processVulnersScriptOutput(self, vulnersOutput):
        output = vulnersOutput.replace('\t\t\t','\t')
        output = output.replace('\t\t','\t')
        output = output.replace('\t',';')
        output = output.replace('\n;','\n')
Severity: Minor
Found in parsers/Script.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 sortArrayWithArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def sortArrayWithArray(array, arrayToSort):
    for i in range(0, len(array) - 1):
        swap_test = False
        for j in range(0, len(array) - i - 1):
            if array[j] > array[j + 1]:
Severity: Minor
Found in app/auxiliary.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 not (s is None):
                            self.runToolsFor(s.name, h.ip, p.portId, p.protocol)

Severity: Major
Found in controller/controller.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                       if len(nmapOptionValueSplit) > 1:
                           nmapOptionValue = nmapOptionValueSplit[1].replace(']','')
                           nmapOptions.append(nmapOptionValue)
                nmapOptions.append(str(self.adddialog.txtCustomOptList.text()))
Severity: Major
Found in ui/view.py - About 45 mins to fix

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

def logEventDecorator(evt, evtSev='info', evtSevIssue='critical', logger=None, objIdAttr=None, objIdParam=None):
    """Decorator to send events to the event log
    You must pass in the event name, and may pass in some method of
    obtaining an objectid from the decorated function's parameters or
    return value.
Severity: Minor
Found in utilities/stenoLogging.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 clearLayout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def clearLayout(layout):
    if layout is not None:
        while layout.count():
            item = layout.takeAt(0)
            widget = item.widget()
Severity: Minor
Found in app/auxiliary.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 p[1] == "Waiting":
                            if str(self.logic.activeProject.repositoryContainer.processRepository.getStatusByProcessId(
                                    p[2])) == 'Running':
                                self.killProcess(self.view.ProcessesTableModel.getProcessPidForId(p[2]), p[2])
                            self.logic.activeProject.repositoryContainer.processRepository.storeProcessCancelStatus(
Severity: Major
Found in controller/controller.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if tool[0] == a[1]:
                            tabTitle = a[1] + " (" + port + "/" + protocol + ")"
                            outputfile = self.logic.activeProject.properties.runningFolder + "/" + \
                                         re.sub("[^0-9a-zA-Z]", "", str(tool[0])) + \
                                         "/" + getTimestamp() + '-' + a[1] + "-" + ip + "-" + port
Severity: Major
Found in controller/controller.py - About 45 mins to fix

Function logEventDecorator has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def logEventDecorator(evt, evtSev='info', evtSevIssue='critical', logger=None, objIdAttr=None, objIdParam=None):
Severity: Minor
Found in utilities/stenoLogging.py - About 45 mins to fix

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

    def restoreToolTabsForHost(self, ip):
        if (self.viewState.hostTabs) and (ip in self.viewState.hostTabs):
            tabs = self.viewState.hostTabs[ip]    # use the ip as a key to retrieve its list of tooltabs
            for tab in tabs:
                # do not display hydra and nmap tabs when restoring for that host
Severity: Minor
Found in ui/view.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 host in targets:
                            targets.remove(host)
                
Severity: Major
Found in ui/view.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if len(tool) == 4:
                            servicesList = tool[3].split(',')
                            self.terminalServicesActiveTable.setRowCount(len(servicesList))
                            for i in range(len(servicesList)):
                                self.terminalServicesActiveTable.setItem(i, 0, QtWidgets.QTableWidgetItem())
Severity: Major
Found in ui/settingsDialog.py - About 45 mins to fix

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, name, host, product='', version='', extrainfo='', fingerprint=''):
Severity: Minor
Found in db/entities/service.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if len(tool) == 4:
                            servicesList = tool[3].split(',')
                            self.terminalServicesActiveTable.setRowCount(len(servicesList))
                            for i in range(len(servicesList)):
                                self.terminalServicesActiveTable.setItem(i, 0, QtWidgets.QTableWidgetItem())
Severity: Major
Found in ui/settingsDialog.py - About 45 mins to fix
Severity
Category
Status
Source
Language