rapid7/metasploit-framework

View on GitHub
modules/exploits/windows/smb/smb_relay.rb

Summary

Maintainability
C
1 day
Test Coverage

Method initialize has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'MS08-068 Microsoft Windows SMB Relay Code Execution',
Severity: Major
Found in modules/exploits/windows/smb/smb_relay.rb - About 4 hrs to fix

    File smb_relay.rb has 328 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = ExcellentRanking
      include ::Msf::Exploit::Remote::SocketServer
    
      include ::Msf::Exploit::Remote::SMB::Server::HashCapture
    Severity: Minor
    Found in modules/exploits/windows/smb/smb_relay.rb - About 3 hrs to fix

      Method start_service has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def start_service(_opts = {})
          ntlm_provider = Msf::Exploit::Remote::SMB::Relay::Provider::AlwaysGrantAccess.new(
            default_domain: datastore['SMBDomain']
          )
      
      
      Severity: Minor
      Found in modules/exploits/windows/smb/smb_relay.rb - About 1 hr to fix

        Method exploit_smb_target has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def exploit_smb_target
            # automatically select an SMB share unless one is explicitly specified
            if datastore['SMBSHARE'] && !datastore['SMBSHARE'].blank?
              smbshare = datastore['SMBSHARE']
            elsif target.name == 'Command'
        Severity: Minor
        Found in modules/exploits/windows/smb/smb_relay.rb - About 1 hr to fix

          Method exploit_smb_target has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def exploit_smb_target
              # automatically select an SMB share unless one is explicitly specified
              if datastore['SMBSHARE'] && !datastore['SMBSHARE'].blank?
                smbshare = datastore['SMBSHARE']
              elsif target.name == 'Command'
          Severity: Minor
          Found in modules/exploits/windows/smb/smb_relay.rb - About 55 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

          Method stop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def stop
                begin
                  @listener_server.close if @server && !@server.closed?
                  @listener_thread.kill if @listener_thread
                rescue StandardError => e
          Severity: Minor
          Found in modules/exploits/windows/smb/smb_relay.rb - 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