Showing 130 of 217 total issues
Function setupLayoutHlayout
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupLayoutHlayout(self):
hydraServiceConversion = {'login':'rlogin', 'ms-sql-s':'mssql', 'ms-wbt-server':'rdp', 'netbios-ssn':'smb',
'netbios-ns':'smb', 'microsoft-ds':'smb', 'postgresql':'postgres', 'vmware-auth':'vmauthd"'}
# sometimes nmap service name is different from hydra service name
if self.service is None:
Function closeBruteTab
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def closeBruteTab(self, index):
currentTabIndex = self.ui.BruteTabWidget.currentIndex() # remember the currently selected tab
# select the tab for which the cross button was clicked
self.ui.BruteTabWidget.setCurrentIndex(index)
- 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 contextToolHostsTableContextMenu
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def contextToolHostsTableContextMenu(self, pos):
if len(self.ui.ToolHostsTableView.selectionModel().selectedRows()) > 0:
row = self.ui.ToolHostsTableView.selectionModel().selectedRows()[len(
self.ui.ToolHostsTableView.selectionModel().selectedRows())-1].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"
Further reading
Function runCommand
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def runCommand(self, *args, discovery=True, stage=0, stop=False):
def handleProcStop(*vargs):
updateElapsed.stop()
self.processTimers[qProcess.id] = None
procTime = timer.elapsed() / 1000
Function retranslateUi
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtWidgets.QApplication.translate("MainWindow", "LEGION", None))
self.HostsTabWidget.setTabText(self.HostsTabWidget.indexOf(self.HostsTab),
QtWidgets.QApplication.translate("MainWindow", "Hosts", None))
self.HostsTabWidget.setTabText(self.HostsTabWidget.indexOf(self.ServicesLeftTab),
Function openExistingProject
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def openExistingProject(self):
if self.dealWithCurrentProject():
filename = QtWidgets.QFileDialog.getOpenFileName(
self.ui.centralwidget, 'Open project', self.controller.getCWD(),
filter='Legion session (*.legion);; Sparta session (*.sprt)')[0]
- 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 run
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
while self.processing == True:
self.sleep(1) # effectively a semaphore
self.processing = 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 setupUi
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget")) # do not change this name
Function startConnections
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def startConnections(self): # signal initialisations (signals/slots, actions, etc)
### MENU ACTIONS ###
self.connectCreateNewProject()
self.connectOpenExistingProject()
self.connectSaveProject()
Function setupLayout
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupLayout(self):
self.setModal(True)
self.setWindowTitle('Settings')
self.setFixedSize(900, 500)
Function __init__
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, appSettings=None):
# general
self.general_default_terminal = "gnome-terminal"
self.general_tool_output_black_background = "False"
Function validateToolName
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validateToolName(self):
selectGroup = self.selectGroup()
tmpWidget = selectGroup[0]
tmplineEdit = selectGroup[1]
actions = selectGroup[4]
- 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 switchTabClick
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def switchTabClick(self):
if self.ServiceNamesTableModel: # fixes bug when switching tabs at start-up
selectedTab = self.ui.HostsTabWidget.tabText(self.ui.HostsTabWidget.currentIndex())
if selectedTab == 'Hosts':
- 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 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, url, product, hostId, severity='', source='', version='', exploitId=0, exploit='',
Function data
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def data(self, index, role): # this method takes care of how the information is displayed
if role == QtCore.Qt.ItemDataRole.DisplayRole: # how to display each cell
value = ''
row = index.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"
Further reading
Function initTables
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initTables(self): # this function prepares the default settings for each table
# hosts table (left)
headers = ["Id", "OS", "Accuracy", "Host", "IPv4", "IPv6", "Mac", "Status", "Hostname", "Vendor", "Uptime",
"Lastboot", "Distance", "CheckedHost", "Country Code", "State", "City", "Latitude", "Longitude",
"Count", "Closed"]
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, tabTitle, hostIp, port, protocol, command, startTime, outputfile, textbox):
Function apply
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def apply(self, up, down, checked, portopen, portfiltered, portclosed, tcp, udp, keywords=[]):
Function start
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start(self, title='*untitled'):
self.viewState = ViewState()
self.ui.keywordTextInput.setText('') # clear keyword filter
self.ProcessesTableModel = None # fixes bug when sorting processes for the first time
Function __init__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, d):
for a, b in d.items():
if isinstance(b, (list, tuple)):
setattr(self, a, [DictObject(x) if isinstance(x, dict) else x for x in b])
else:
- 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"