Showing 130 of 217 total issues
Function setupPortCommandsTab
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupPortCommandsTab(self):
self.label11 = QtWidgets.QLabel()
self.label11.setText('Tools')
self.toolForServiceTableWidget = QtWidgets.QTableWidget(self.PortActionsWidget)
AddSettingsDialog
has 60 functions (exceeds 50 allowed). Consider refactoring. Open
class AddSettingsDialog(QtWidgets.QDialog): # dialog shown when the user selects settings menu
def __init__(self, shell: Shell, parent=None):
QtWidgets.QDialog.__init__(self, parent)
self.setupLayout()
Function updateToolForTerminalInformation
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def updateToolForTerminalInformation(self, update = True):
#if self.commandTabsValidate() == True:
if self.validateCommandTabs(self.terminalActionNameText, self.terminalLabelText, self.terminalCommandText):
# do not update anything the first time or when you remove a line
if self.terminalTableRow == -1 or update == False:
- 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 updateToolForServiceInformation
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def updateToolForServiceInformation(self, update = True):
#if self.commandTabsValidate() == True:
if self.validateCommandTabs(self.portActionNameText, self.portLabelText, self.portCommandText):
# the first time do not update anything
if self.portTableRow == -1 or update == False:
- 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 handleProcessAction
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def handleProcessAction(self, selectedProcesses, action):
if action.text() == 'Kill':
if self.view.killProcessConfirmation():
for p in selectedProcesses:
if p[1] != "Running":
- 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 populateAutomatedAttacksTab
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def populateAutomatedAttacksTab(self): # TODO: this one is still to big and ugly. needs work.
self.typeDic = {}
for i in range(len(self.settings.portActions)):
# the dictionary contains the name, the text input and the layout for each tool
self.typeDic.update({self.settings.portActions[i][1]:[QtWidgets.QLabel(),QtWidgets.QLineEdit(),
- 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 setupRightPanel
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupRightPanel(self):
self.ServicesTabWidget = QtWidgets.QTabWidget()
self.ServicesTabWidget.setEnabled(True)
self.sizePolicy2.setHeightForWidth(self.ServicesTabWidget.sizePolicy().hasHeightForWidth())
self.ServicesTabWidget.setSizePolicy(self.sizePolicy2)
Function callAddHosts
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def callAddHosts(self):
hostListStr = str(self.adddialog.txtHostList.toPlainText()).replace(';',' ')
nmapOptions = []
scanMode = 'Unset'
- 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 switchToolTabClick
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def switchToolTabClick(self): # TODO: check for duplicate code.
if self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex()) == 'Host Commands':
self.toolForHostsTableWidget.selectRow(0)
self.updateToolForHostInformation(False)
- 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
File NmapImporter.py
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
LEGION (https://shanewilliamscott.com)
Copyright (c) 2024 Shane Scott
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
File auxiliary.py
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
"""
LEGION (https://shanewilliamscott.com)
Copyright (c) 2024 Shane Scott
Function contextMenuServicesTableView
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def contextMenuServicesTableView(self, pos):
if len(self.ui.ServicesTableView.selectionModel().selectedRows()) > 0:
# if there is only one row selected, get service name
if len(self.ui.ServicesTableView.selectionModel().selectedRows()) == 1:
row = self.ui.ServicesTableView.selectionModel().selectedRows()[len(
- 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 buildHydraCommand
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def buildHydraCommand(self, runningfolder, userlistPath, passlistPath):
self.ip = self.ipTextinput.text()
self.port = self.portTextinput.text()
self.service = str(self.serviceComboBox.currentText())
- 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 runStagedNmap
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def runStagedNmap(self, targetHosts, discovery = True, stage = 1, stop = False):
log.info("runStagedNmap called for stage {0}".format(str(stage)))
runningFolder = self.logic.activeProject.properties.runningFolder
if not stop:
textbox = self.view.createNewTabForHost(str(targetHosts), 'nmap (stage ' + str(stage) + ')', True)
- 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 setupHostCommandsTab
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupHostCommandsTab(self):
self.toolForHostsTableWidget = QtWidgets.QTableWidget(self.HostActionsWidget)
self.toolForHostsTableWidget.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.toolForHostsTableWidget.setFixedWidth(180)
self.toolForHostsTableWidget.setShowGrid(False) # to make the cells of the table read only
Function setupGeneralTab
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupGeneralTab(self):
self.terminalLabel = QtWidgets.QLabel()
self.terminalLabel.setText('Terminal')
self.terminalLabel.setFixedWidth(150)
self.terminalComboBox = QtWidgets.QComboBox()
Function setupLeftPanel
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupLeftPanel(self):
self.HostsTabWidget = QtWidgets.QTabWidget(self.splitter)
self.sizePolicy.setHeightForWidth(self.HostsTabWidget.sizePolicy().hasHeightForWidth())
self.HostsTabWidget.setSizePolicy(self.sizePolicy2)
self.HostsTabWidget.setObjectName(_fromUtf8("HostsTabWidget"))
Function sort
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def sort(self, Ncol, order):
self.layoutAboutToBeChanged.emit()
array = []
- 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 processFinished
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def processFinished(self, qProcess):
processRepository = self.logic.activeProject.repositoryContainer.processRepository
try:
if not processRepository.isKilledProcess(
str(qProcess.id)): # if process was not killed
- 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 toolHostsClick
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def toolHostsClick(self):
if self.ui.ToolHostsTableView.selectionModel().selectedRows():
row = self.ui.ToolHostsTableView.selectionModel().selectedRows()[len(
self.ui.ToolHostsTableView.selectionModel().selectedRows())-1].row()
self.viewState.tool_host_clicked = self.ToolHostsTableModel.getProcessIdForRow(row)
- 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"