Showing 130 of 217 total issues
File addHostDialog.py
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
"""
LEGION (https://shanewilliamscott.com)
Copyright (c) 2024 Shane Scott
Function scheduler
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def scheduler(self, parser, isNmapImport):
if isNmapImport and self.settings.general_enable_scheduler_on_import == 'False':
return
if self.settings.general_enable_scheduler == 'True':
log.info('Scheduler started!')
- 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 a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def addHosts(self, targetHosts, runHostDiscovery, runStagedNmap, nmapSpeed, scanMode, nmapOptions = []):
if targetHosts == '':
log.info('No hosts entered..')
return
- 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 sort
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def sort(self, Ncol, order):
self.layoutAboutToBeChanged.emit()
array=[]
sortColumns = {5:'name', 6:'tabTitle', 11:'startTime', 12:'endTime'}
- 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 backupAndSave
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def backupAndSave(self, newSettings, saveBackup=True):
# Backup and save
if saveBackup:
log.info('Backing up old settings and saving new settings...')
os.rename(os.path.expanduser('~/.local/share/legion/legion.conf'), os.path.expanduser("~/.local/share/legion/backup/") + getTimestamp() + '-legion.conf')
Function updateInformationView
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def updateInformationView(self, hostIP):
if hostIP:
host = self.controller.getHostInformation(hostIP)
- 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 setupStagedNmapTab
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupStagedNmapTab(self):
self.stage1label = QtWidgets.QLabel()
self.stage1label.setText('nmap stage 1')
self.stage1label.setFixedWidth(100)
self.stage1Input = QtWidgets.QLineEdit()
Function setupLayout
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupLayout(self):
self.setModal(True)
self.setWindowTitle('Filters')
self.setFixedSize(640, 200)
Function setupLayoutHlayout3
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupLayoutHlayout3(self):
#add usernames wordlist
self.singlePassRadio = QtWidgets.QRadioButton()
self.label6 = QtWidgets.QLabel()
self.label6.setText('Password')
Function setupBruteTab
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupBruteTab(self):
self.vlayoutBrute = QtWidgets.QVBoxLayout(self.BruteSettingsTab)
self.label5 = QtWidgets.QLabel()
self.label5.setText('Username lists path')
Function handlePortAction
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def handlePortAction(self, targets, *args):
actions = args[0]
terminalActions = args[1]
action = args[2]
restoring = args[3]
- 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 updateToolForHostInformation
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def updateToolForHostInformation(self, update = True):
#if self.commandTabsValidate() == True:
if self.validateCommandTabs(self.hostActionNameText, self.hostLabelText, self.hostCommandText):
# do not update any values the first time or when the remove button is clicked
- 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 saveProjectAs
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def saveProjectAs(self):
self.ui.statusbar.showMessage('Saving..')
log.info('Saving project..')
self.controller.saveProject(self.viewState.lastHostIdClicked, self.ui.NotesTextEdit.toPlainText())
- 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 closeHostToolTab
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def closeHostToolTab(self, index):
currentTabIndex = self.ui.ServicesTabWidget.currentIndex() # remember the currently selected tab
self.ui.ServicesTabWidget.setCurrentIndex(index) # select the tab for which the cross button was clicked
currentWidget = self.ui.ServicesTabWidget.currentWidget()
- 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 generate_nmap_xml
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def generate_nmap_xml(num_hosts=1000, base_subnet="172.16"):
"""
Generate a full sample nmap XML file with session information included.
Parameters:
- 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 Qui_update
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Qui_update(self):
self.logoapp = QtWidgets.QLabel('')
self.logoapp.setPixmap(QtGui.QPixmap(self.smallIcon).scaled(64,64))
self.form = QtWidgets.QFormLayout()
self.form2 = QtWidgets.QVBoxLayout()
Function __init__
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, author, copyright, links, emails, version, build, update, license, desc, smallIcon,
Function setupMenuBar
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupMenuBar(self, MainWindow):
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1010, 25))
self.menubar.setObjectName(_fromUtf8("menubar"))
self.menuFile = QtWidgets.QMenu(self.menubar)
Function setupLayoutHlayout2
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupLayoutHlayout2(self):
self.singleUserRadio = QtWidgets.QRadioButton()
self.label4 = QtWidgets.QLabel()
self.label4.setText('Username')
self.label4.setFixedWidth(70)
Function setupToolPathsTab
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupToolPathsTab(self):
self.nmapPathlabel = QtWidgets.QLabel()
self.nmapPathlabel.setText('Nmap')
self.nmapPathlabel.setFixedWidth(100)
self.nmapPathInput = QtWidgets.QLineEdit()