Hackman238/legion

View on GitHub

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

    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!')
    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 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
    
    
    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 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'}
    Severity: Minor
    Found in ui/models/processmodels.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 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')
    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 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 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 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 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 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 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 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 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:
              Severity: Minor
              Found in buildHugeNmapTest.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 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 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 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
                        Severity
                        Category
                        Status
                        Source
                        Language