Hackman238/legion

View on GitHub

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

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

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

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

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

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

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

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

                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]
                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 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':
                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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, name, url, product, hostId, severity='', source='', version='', exploitId=0, exploit='',
                Severity: Major
                Found in db/entities/cve.py - About 1 hr to fix

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

                    Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(self, name, tabTitle, hostIp, port, protocol, command, startTime, outputfile, textbox):
                    Severity: Major
                    Found in app/auxiliary.py - About 1 hr to fix

                      Function apply has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def apply(self, up, down, checked, portopen, portfiltered, portclosed, tcp, udp, keywords=[]):
                      Severity: Major
                      Found in app/auxiliary.py - About 1 hr to fix

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

                          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:
                          Severity: Minor
                          Found in utilities.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