GoVanguard/legion

View on GitHub

Showing 128 of 209 total issues

File NmapImporter.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
LEGION (https://govanguard.com)
Copyright (c) 2020 GoVanguard

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
Severity: Minor
Found in app/importers/NmapImporter.py - About 2 hrs to fix

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('./legion.conf', './backup/' + getTimestamp() + '-legion.conf')
Severity: Major
Found in app/settings.py - About 2 hrs to fix

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)
            
Severity: Minor
Found in ui/view.py - About 2 hrs 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 scheduler has a Cognitive Complexity of 16 (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!')
Severity: Minor
Found in controller/controller.py - About 2 hrs 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 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()
Severity: Major
Found in ui/settingsDialog.py - About 2 hrs to fix

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)
        
Severity: Minor
Found in ui/dialogs.py - About 2 hrs to fix

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')
Severity: Minor
Found in ui/settingsDialog.py - About 1 hr to fix

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')
Severity: Minor
Found in ui/dialogs.py - About 1 hr to fix

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

def extractParams(f, args, kwargs, matchParam):
    """Find the value of a parameter by name, even if it was passed via *args or is a default value.
    """
    if matchParam in kwargs:
        return kwargs[matchParam]
Severity: Minor
Found in utilities/stenoLogging.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 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())
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 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]
Severity: Minor
Found in controller/controller.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 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()
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 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()
Severity: Minor
Found in ui/helpDialog.py - About 1 hr to fix

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,
Severity: Major
Found in ui/helpDialog.py - About 1 hr to fix

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)
Severity: Minor
Found in ui/dialogs.py - About 1 hr to fix

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)
Severity: Minor
Found in ui/gui.py - About 1 hr to fix

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:
Severity: Minor
Found in ui/dialogs.py - About 1 hr to fix

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()
Severity: Minor
Found in ui/settingsDialog.py - About 1 hr to fix

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()
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

Severity
Category
Status
Source
Language