Showing 130 of 217 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,
- Read upRead up
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 createNewTabForHost
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def createNewTabForHost(self, ip, tabTitle, restoring=False, content='', filename=''):
# TODO: use regex otherwise tools with 'screenshot' in the name are screwed.
if 'screenshot' in str(tabTitle):
tempWidget = ImageViewer()
tempWidget.setObjectName(str(tabTitle))
- Read upRead up
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 callHydra
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def callHydra(self, bWidget):
if validateNmapInput(bWidget.ipTextinput.text()) and validateNmapInput(bWidget.portTextinput.text()):
# check if host is already in scope
if not self.controller.isHostInDB(bWidget.ipTextinput.text()):
message = "This host is not in scope. Add it to scope and continue?"
- Read upRead up
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 restoreToolTabWidget
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def restoreToolTabWidget(self, clear=False):
if self.ui.DisplayWidget.findChild(QtWidgets.QPlainTextEdit) == self.ui.toolOutputTextView:
return
for host in self.viewState.hostTabs.keys():
- Read upRead up
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 = []
- Read upRead up
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':
- Read upRead up
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:
- Read upRead up
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)
- Read upRead up
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')
- Read upRead up
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 addHosts
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def addHosts(self, targetHosts, runHostDiscovery, runStagedNmap, nmapSpeed, scanMode, nmapOptions = []):
Avoid deeply nested control flow statements. Open
if tool[0] == a[1]:
tabTitle = a[1] + " (" + port + "/" + protocol + ")"
# Cheese
outputfile = self.logic.activeProject.properties.runningFolder + "/" + \
re.sub("[^0-9a-zA-Z]", "", str(tool[0])) + \
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()))
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, host, product='', version='', extrainfo='', fingerprint=''):
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())
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]:
- Read upRead up
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 isWsl():
command = "{0} -oA {1}".format(command, unixPath2Win(outputfile))
else:
command = "{0} -oA {1}".format(command, outputfile)
Avoid deeply nested control flow statements. Open
if host in targets:
targets.remove(host)
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
- Read upRead up
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 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())
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(