GoVanguard/legion

View on GitHub

Showing 217 of 217 total issues

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def __init__(self, controller, processes = [[]], headers = [], parent = None):
        QtCore.QAbstractTableModel.__init__(self, parent)
        self.__headers = headers
        self.__processes = processes
        self.__controller = controller
Severity: Major
Found in ui/models/processmodels.py and 1 other location - About 1 hr to fix
ui/models/scriptmodels.py on lines 28..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                array[j], array[j + 1] = array[j + 1], array[j]  # swap
Severity: Major
Found in app/auxiliary.py and 1 other location - About 1 hr to fix
app/auxiliary.py on lines 107..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                arrayToSort[j], arrayToSort[j + 1] = arrayToSort[j + 1], arrayToSort[j]
Severity: Major
Found in app/auxiliary.py and 1 other location - About 1 hr to fix
app/auxiliary.py on lines 106..106

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                    if not self.__processes[row]['port'] == '' and not self.__processes[row]['protocol'] == '':
                        value = self.__processes[row]['port'] + '/' + self.__processes[row]['protocol']
Severity: Major
Found in ui/models/processmodels.py and 1 other location - About 1 hr to fix
ui/models/scriptmodels.py on lines 63..65

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 45.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                if self.__scripts[row]['portId'] and self.__scripts[row]['protocol'] and \
                        not self.__scripts[row]['portId'] == '' and not self.__scripts[row]['protocol'] == '':
                    value = self.__scripts[row]['portId'] + '/' + self.__scripts[row]['protocol']
Severity: Major
Found in ui/models/scriptmodels.py and 1 other location - About 1 hr to fix
ui/models/processmodels.py on lines 83..84

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 45.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        if Ncol == 2:
            for i in range(len(self.__scripts)):
                array.append(int(self.__scripts[i]['portId']))
Severity: Major
Found in ui/models/scriptmodels.py and 5 other locations - About 1 hr to fix
ui/models/hostmodels.py on lines 139..140
ui/models/processmodels.py on lines 108..110
ui/models/servicemodels.py on lines 109..111
ui/models/servicemodels.py on lines 113..115
ui/models/servicemodels.py on lines 117..119

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def __init__(self, name='', product='', version='', extrainfo='', fingerprint='', cpe=''):
        self.name = name
        self.product = product
        self.version = version
        self.extrainfo = extrainfo
Severity: Major
Found in db/entities/app.py and 1 other location - About 1 hr to fix
db/entities/service.py on lines 40..46

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

            for i in range(len(self.__hosts)):
                array.append(IP2Int(self.__hosts[i]['ip']))
Severity: Major
Found in ui/models/hostmodels.py and 5 other locations - About 1 hr to fix
ui/models/processmodels.py on lines 108..110
ui/models/scriptmodels.py on lines 80..82
ui/models/servicemodels.py on lines 109..111
ui/models/servicemodels.py on lines 113..115
ui/models/servicemodels.py on lines 117..119

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def __init__(self, name, host, product='', version='', extrainfo='', fingerprint=''):
        self.name = name
        self.product = product
        self.version = version
        self.extrainfo = extrainfo
Severity: Major
Found in db/entities/service.py and 1 other location - About 1 hr to fix
db/entities/app.py on lines 34..40

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language