rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Method create_session_key has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    def self.create_session_key(ntlmssp_flags, server_ntlmssp_flags, user, pass, domain, challenge_key,
            client_challenge = '', ntlm_cli_challenge = '' , opt = {} )

      usentlm2_session     = opt[:usentlm2_session]    != nil ? opt[:usentlm2_session] : true
      use_ntlmv2         = opt[:use_ntlmv2]         != nil ? opt[:use_ntlmv2] : false
Severity: Minor
Found in lib/rex/proto/ntlm/utils.rb - About 6 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

Method initialize has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(prompt = DefaultPrompt, prompt_char = DefaultPromptChar, opts = {})
    histfile = opts['HistFile'] || Msf::Config.history_file

    begin
      FeatureManager.instance.load_config
Severity: Minor
Found in lib/msf/ui/console/driver.rb - About 6 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

Method solicit_ipv6_mac has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

  def solicit_ipv6_mac(dhost, opts = {})
    check_pcaprub_loaded

    dhost_intf = dhost + '%' + ipv6_interface(opts)

Severity: Minor
Found in lib/msf/core/exploit/remote/ipv6.rb - About 6 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

File services.rb has 434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Msf
  class Post
    module Windows
      # @deprecated Use {Services} instead
      module WindowsServices
Severity: Minor
Found in lib/msf/core/post/windows/services.rb - About 6 hrs to fix

    Method create_sqlite_db has 160 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create_sqlite_db
        dbfile = Tempfile.new('ad_to_sqlite')
        db = SQLite3::Database.new(dbfile.path)
        db.type_translation = true
    
    
    Severity: Major
    Found in modules/post/windows/gather/ad_to_sqlite.rb - About 6 hrs to fix

      Method cmd_search has 160 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def cmd_search(*args)
                  match        = ''
                  row_filter  = nil
                  output_file  = nil
                  cached       = false
      Severity: Major
      Found in lib/msf/ui/console/command_dispatcher/modules.rb - About 6 hrs to fix

        Method run has 160 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def run
          @show_progress = datastore['ShowProgress']
          @show_percent  = datastore['ShowProgressPercent'].to_i
        
          if self.respond_to?(:session) && session
        Severity: Major
        Found in lib/msf/core/auxiliary/scanner.rb - About 6 hrs to fix

          File meterpreter.rb has 432 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'rex/post/meterpreter/client'
          require 'rex/post/meterpreter/ui/console'
          
          module Msf
          module Sessions
          Severity: Minor
          Found in lib/msf/base/sessions/meterpreter.rb - About 6 hrs to fix

            Method html_get_hash has 159 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def html_get_hash(arg = {})
                ntlm_ver = arg[:ntlm_ver]
                if ntlm_ver == NTLM_CONST::NTLM_V1_RESPONSE or ntlm_ver == NTLM_CONST::NTLM_2_SESSION_RESPONSE
                  lm_hash = arg[:lm_hash]
                  nt_hash = arg[:nt_hash]
            Severity: Major
            Found in modules/auxiliary/server/capture/http_ntlm.rb - About 6 hrs to fix

              Method on_request_uri has 159 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def on_request_uri(cli, request)
              
                  # Random JavaScript variable names
                  js_element_name      = rand_text_alpha(rand(10) + 5)
                  js_obj_addr_name     = rand_text_alpha(rand(10) + 5)
              Severity: Major
              Found in modules/exploits/windows/browser/mozilla_mchannel.rb - About 6 hrs to fix

                File ldap_esc_vulnerable_cert_finder.rb has 431 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class MetasploitModule < Msf::Auxiliary
                
                  include Msf::Exploit::Remote::LDAP
                  include Msf::OptionalSession::LDAP
                  include Rex::Proto::Secauthz
                Severity: Minor
                Found in modules/auxiliary/gather/ldap_esc_vulnerable_cert_finder.rb - About 6 hrs to fix

                  Method on_client_data has 158 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def on_client_data(client)
                      data = client.get_once
                      return if !data
                  
                      print_status("SMTP: #{@state[client][:name]} Command: #{data.strip}")
                  Severity: Major
                  Found in modules/auxiliary/server/capture/smtp.rb - About 6 hrs to fix

                    File solr_velocity_rce.rb has 429 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    class MetasploitModule < Msf::Exploit::Remote
                      Rank = ExcellentRanking
                    
                      include Msf::Exploit::CmdStager
                      include Msf::Exploit::Powershell
                    Severity: Minor
                    Found in modules/exploits/multi/http/solr_velocity_rce.rb - About 6 hrs to fix

                      File ad_to_sqlite.rb has 429 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'sqlite3'
                      require 'tempfile'
                      
                      class MetasploitModule < Msf::Post
                        include Msf::Post::Windows::LDAP
                      Severity: Minor
                      Found in modules/post/windows/gather/ad_to_sqlite.rb - About 6 hrs to fix

                        Method asm_reflective_pe_loader_x64 has 157 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def asm_reflective_pe_loader_x64(opts)
                        
                              prologue = ''
                              if opts[:is_dll] == true
                                prologue = %(
                        Severity: Major
                        Found in lib/msf/core/payload/windows/x64/reflective_pe_loader_x64.rb - About 6 hrs to fix

                          File core.rb has 428 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require 'set'
                          require 'rex/post/hwbridge'
                          
                          module Rex
                          module Post
                          Severity: Minor
                          Found in lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb - About 6 hrs to fix

                            Method run_host has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def run_host(ip)
                                conn = true
                                ecode = nil
                                emesg = nil
                            
                            
                            Severity: Minor
                            Found in modules/auxiliary/scanner/http/copy_of_file.rb - About 6 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

                            Method run has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def run
                                init_railgun_defs
                                @hostname_cache = {}
                                libgnome_keyring = session.railgun.libgnome_keyring
                            
                            
                            Severity: Minor
                            Found in modules/post/linux/gather/gnome_keyring_dump.rb - About 6 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

                            Method dispatch_request has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def dispatch_request(from, buf)
                                type = buf.unpack('C').first
                                if (type != Constants::Request)
                                  #dlog("Unknown DHCP request type: #{type}")
                                  return
                            Severity: Minor
                            Found in lib/rex/proto/dhcp/server.rb - About 6 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

                            Method run_single has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def run_single(line, propagate_errors: false)
                                arguments  = parse_line(line)
                                method     = arguments.shift
                                cmd_status = nil  # currently either nil or :handled, more statuses can be added in the future
                                error      = false
                            Severity: Minor
                            Found in lib/rex/ui/text/dispatcher_shell.rb - About 6 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

                            Severity
                            Category
                            Status
                            Source
                            Language