GoVanguard/legion

View on GitHub
ui/dialogs.py

Summary

Maintainability
F
5 days
Test Coverage

File dialogs.py has 603 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
"""
LEGION (https://gotham-security.com)
Copyright (c) 2023 Gotham Security

Severity: Major
Found in ui/dialogs.py - About 1 day to fix

Function setupLayout has 189 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def setupLayout(self):
        self.HostStatusLabel = QtWidgets.QLabel()

        self.HostStateLabel = QtWidgets.QLabel()
        self.HostStateText = QtWidgets.QLabel()
Severity: Major
Found in ui/dialogs.py - About 7 hrs to fix

Function buildHydraCommand has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def buildHydraCommand(self, runningfolder, userlistPath, passlistPath):
        
        self.ip = self.ipTextinput.text()
        self.port = self.portTextinput.text()
        self.service = str(self.serviceComboBox.currentText())
Severity: Minor
Found in ui/dialogs.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 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 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 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 setCurrentFilters has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def setCurrentFilters(self, filters):
        if not self.hostsUp.isChecked() == filters[0]:
            self.hostsUp.toggle()
            
        if not self.hostsDown.isChecked() == filters[1]:
Severity: Minor
Found in ui/dialogs.py - About 45 mins 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 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, ip, port, service, settings, parent=None):
Severity: Minor
Found in ui/dialogs.py - About 35 mins to fix

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

            if self.singleUserRadio.isChecked():
                self.command += " -l " + self.usersTextinput.text()
            elif self.foundUsersRadio.isChecked():
                self.command += " -L \"" + userlistPath+"\""
            else:
Severity: Major
Found in ui/dialogs.py and 1 other location - About 2 hrs to fix
ui/dialogs.py on lines 358..365

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

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.singlePassRadio.isChecked():
                escaped_password = self.passwordsTextinput.text().replace('"', '\"\"\"')
                self.command += " -p \"" + escaped_password + "\""

            elif self.foundPasswordsRadio.isChecked():
Severity: Major
Found in ui/dialogs.py and 1 other location - About 2 hrs to fix
ui/dialogs.py on lines 350..355

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

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 8 locations. Consider refactoring.
Open

        if not self.portsClosed.isChecked() == filters[5]:
            self.portsClosed.toggle()
Severity: Major
Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
ui/dialogs.py on lines 486..487
ui/dialogs.py on lines 489..490
ui/dialogs.py on lines 492..493
ui/dialogs.py on lines 495..496
ui/dialogs.py on lines 498..499
ui/dialogs.py on lines 504..505
ui/dialogs.py on lines 507..508

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

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 8 locations. Consider refactoring.
Open

        if not self.portsTcp.isChecked() == filters[6]:
            self.portsTcp.toggle()
Severity: Major
Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
ui/dialogs.py on lines 486..487
ui/dialogs.py on lines 489..490
ui/dialogs.py on lines 492..493
ui/dialogs.py on lines 495..496
ui/dialogs.py on lines 498..499
ui/dialogs.py on lines 501..502
ui/dialogs.py on lines 507..508

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

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 8 locations. Consider refactoring.
Open

        if not self.portsFiltered.isChecked() == filters[4]:
            self.portsFiltered.toggle()
Severity: Major
Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
ui/dialogs.py on lines 486..487
ui/dialogs.py on lines 489..490
ui/dialogs.py on lines 492..493
ui/dialogs.py on lines 495..496
ui/dialogs.py on lines 501..502
ui/dialogs.py on lines 504..505
ui/dialogs.py on lines 507..508

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

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 8 locations. Consider refactoring.
Open

        if not self.hostsChecked.isChecked() == filters[2]:
            self.hostsChecked.toggle()
Severity: Major
Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
ui/dialogs.py on lines 486..487
ui/dialogs.py on lines 489..490
ui/dialogs.py on lines 495..496
ui/dialogs.py on lines 498..499
ui/dialogs.py on lines 501..502
ui/dialogs.py on lines 504..505
ui/dialogs.py on lines 507..508

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

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 8 locations. Consider refactoring.
Open

        if not self.portsUdp.isChecked() == filters[7]:
            self.portsUdp.toggle()
Severity: Major
Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
ui/dialogs.py on lines 486..487
ui/dialogs.py on lines 489..490
ui/dialogs.py on lines 492..493
ui/dialogs.py on lines 495..496
ui/dialogs.py on lines 498..499
ui/dialogs.py on lines 501..502
ui/dialogs.py on lines 504..505

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

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 8 locations. Consider refactoring.
Open

        if not self.hostsDown.isChecked() == filters[1]:
            self.hostsDown.toggle()
Severity: Major
Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
ui/dialogs.py on lines 486..487
ui/dialogs.py on lines 492..493
ui/dialogs.py on lines 495..496
ui/dialogs.py on lines 498..499
ui/dialogs.py on lines 501..502
ui/dialogs.py on lines 504..505
ui/dialogs.py on lines 507..508

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

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 8 locations. Consider refactoring.
Open

        if not self.hostsUp.isChecked() == filters[0]:
            self.hostsUp.toggle()
Severity: Major
Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
ui/dialogs.py on lines 489..490
ui/dialogs.py on lines 492..493
ui/dialogs.py on lines 495..496
ui/dialogs.py on lines 498..499
ui/dialogs.py on lines 501..502
ui/dialogs.py on lines 504..505
ui/dialogs.py on lines 507..508

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

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 8 locations. Consider refactoring.
Open

        if not self.portsOpen.isChecked() == filters[3]:
            self.portsOpen.toggle()
Severity: Major
Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
ui/dialogs.py on lines 486..487
ui/dialogs.py on lines 489..490
ui/dialogs.py on lines 492..493
ui/dialogs.py on lines 498..499
ui/dialogs.py on lines 501..502
ui/dialogs.py on lines 504..505
ui/dialogs.py on lines 507..508

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

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

There are no issues that match your filters.

Category
Status