rapid7/metasploit-framework

View on GitHub
modules/auxiliary/scanner/http/rdp_web_login.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def run(args):
    """Run the module, gathering the domain if desired and verifying usernames and passwords"""
    module.LogHandler.setup(msg_prefix='{} - '.format(args['rhost']))
    if DEPENDENCIES_MISSING:
        module.log('Module dependencies are missing, cannot continue', level='error')
Severity: Minor
Found in modules/auxiliary/scanner/http/rdp_web_login.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 check_logins has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def check_logins(rhost, rport, targeturi, domain, usernames, passwords, timeout, user_agent):
Severity: Major
Found in modules/auxiliary/scanner/http/rdp_web_login.py - About 1 hr to fix

    Function check_login has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def check_login(rhost, rport, targeturi, domain, username, password, timeout, user_agent):
    Severity: Major
    Found in modules/auxiliary/scanner/http/rdp_web_login.py - About 1 hr to fix

      Function verify_service has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def verify_service(rhost, rport, targeturi, timeout, user_agent):
      Severity: Minor
      Found in modules/auxiliary/scanner/http/rdp_web_login.py - About 35 mins to fix

        Avoid too many return statements within this function.
        Open

            return properties
        Severity: Major
        Found in modules/auxiliary/scanner/http/rdp_web_login.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return None
          Severity: Major
          Found in modules/auxiliary/scanner/http/rdp_web_login.py - About 30 mins to fix

            Function get_ad_domain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_ad_domain(rhost, rport, user_agent):
                """Retrieve the NTLM domain out of a specific challenge/response"""
                domain_urls = ['aspnet_client', 'Autodiscover', 'ecp', 'EWS', 'OAB',
                               'Microsoft-Server-ActiveSync', 'PowerShell', 'rpc']
                headers = {'Authorization': 'NTLM TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw==',
            Severity: Minor
            Found in modules/auxiliary/scanner/http/rdp_web_login.py - About 25 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

            There are no issues that match your filters.

            Category
            Status