rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Method do_decrypt has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def do_decrypt
    unless datastore['DISCLAIMER']
      decrypt_disclaimer
      return
    end
Severity: Minor
Found in modules/post/multi/gather/firefox_creds.rb - About 5 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 gathernix has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def gathernix
    print_status('Unix OS detected')
    user_files = cmd_exec('locate tomcat-users.xml').split("\n")
    if !user_files.empty?
      user_files.each do |path|
Severity: Minor
Found in modules/post/multi/gather/tomcat_gather.rb - About 5 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 38 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    current_action = action.name.downcase
    if current_action == 'decrypt' && !datastore['VBR_CSV_FILE'] && !datastore['VOM_CSV_FILE']
      fail_with(Msf::Exploit::Failure::BadConfig, 'You must set either the VBR_CSV_FILE or VOM_CSV_FILE advanced options')
    end
Severity: Minor
Found in modules/post/windows/gather/credentials/veeam_credential_dump.rb - About 5 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 validate_directive has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

        def validate_directive(pack_directive)
          # current pointer value
          p = 0

          # end of pointer range
Severity: Minor
Found in lib/rubocop/cop/lint/detect_invalid_pack_directives.rb - About 5 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 send_tcp has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

      def send_tcp(packet,packet_data, nameservers)

        ans = nil
        length = [packet_data.size].pack("n")

Severity: Minor
Found in lib/net/dns/resolver.rb - About 5 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 relay has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def relay(relay_client, relay_sock)
      @relay_client = relay_client
      @relay_sock   = relay_sock
      # start the relay thread (modified from Rex::IO::StreamAbstraction)
      @relay_thread = Rex::ThreadFactory.spawn("SOCKS5ProxyServerTcpRelay", false) do
Severity: Minor
Found in lib/rex/proto/proxy/socks5/server_client.rb - About 5 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 cmd_threads has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def cmd_threads(*args)
    # Make the default behavior listing all jobs if there were no options
    # or the only option is the verbose flag
    if (args.length == 0 or args == ["-v"])
      args.unshift("-l")
Severity: Minor
Found in lib/msf/ui/console/command_dispatcher/core.rb - About 5 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 report_service has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def report_service(opts)
    return if !active
  ::ApplicationRecord.connection_pool.with_connection { |conn|
    opts = opts.clone() # protect the original caller's opts
    addr  = opts.delete(:host) || return
Severity: Minor
Found in lib/msf/core/db_manager/service.rb - About 5 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 do_request_cert has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def do_request_cert(icpr, opts)
    private_key = OpenSSL::PKey::RSA.new(2048)
    user = opts[:username] || datastore['SMBUser']
    status_msg = "Requesting a certificate for user #{user}"
    alt_dns = opts[:alt_dns] || (datastore['ALT_DNS'].blank? ? nil : datastore['ALT_DNS'])
Severity: Minor
Found in lib/msf/core/exploit/remote/ms_icpr.rb - About 5 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 dcerpc_endpoint_list has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def dcerpc_endpoint_list
    res = []

    print_status("Connecting to the endpoint mapper service...")
    begin
Severity: Minor
Found in lib/msf/core/exploit/remote/dcerpc_epm.rb - About 5 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 send_message has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def send_message(data)
    mailfrom = datastore['MAILFROM'].strip
    if bad_address(mailfrom)
      print_error "Bad from address, not sending: #{mailfrom}"
      return nil
Severity: Minor
Found in lib/msf/core/exploit/remote/smtp_deliver.rb - About 5 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 parse has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(value, datastore)
      Enumerator.new do |results|
        # extract the individual elements from the rhost string, ensuring that
        # whitespace, strings, escape characters, etc are handled correctly.
        values = Rex::Parser::Arguments.from_s(value)
Severity: Minor
Found in lib/msf/core/rhosts_walker.rb - About 5 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 Int64 has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Int64(v) {
    // The underlying byte array.
    var bytes = new Uint8Array(8);

    switch (typeof v) {
Severity: Major
Found in data/exploits/javascript_utils/int64.js - About 5 hrs to fix

    Method create_library has 143 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    def self.create_library(constant_manager, library_path = 'ntdll')
                      dll = Library.new(library_path, constant_manager)
    
                      dll.add_function('NtAllocateVirtualMemory', 'DWORD', [
                        ['DWORD', 'ProcessHandle', 'in'],

      Method vyos_config_eater has 143 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def vyos_config_eater(thost, tport, config, store = true)
      
            credential_data = {
              address: thost,
              port: tport,
      Severity: Major
      Found in lib/msf/core/auxiliary/vyos.rb - About 5 hrs to fix

        File nmap_document.rb has 404 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "rex/parser/nokogiri_doc_mixin"
        
        module Rex
          module Parser
        
        
        Severity: Minor
        Found in lib/rex/parser/nmap_document.rb - About 5 hrs to fix

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

            def run
              def check_results(passwords, results, hash_type, method)
                passwords.each do |password_line|
                  password_line.chomp!
                  next if password_line.blank?
          Severity: Major
          Found in modules/auxiliary/analyze/crack_mobile.rb - About 5 hrs to fix

            Method run_host has 142 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def run_host(ip)
            
                path = datastore['PATH']
                check1 = [
                  'iNotes/Forms5.nsf',
            Severity: Major
            Found in modules/auxiliary/scanner/lotus/lotus_domino_version.rb - About 5 hrs to fix

              Method exploit has 142 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def exploit
                  # Display start time
                  time1 = Time.new
                  print_status("-------------------------------------------------")
                  print_status("Start time : #{time1.inspect}")
              Severity: Major
              Found in modules/exploits/windows/mssql/mssql_linkcrawler.rb - About 5 hrs to fix

                Method query_current_connection has 142 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def query_current_connection(wlan_handle, guid)
                    connection = {}
                    conn_info = @wlanapi.WlanQueryInterface(wlan_handle, guid, 7, nil, 4, 4, nil)
                
                    # Grab the pointer to our data structure. We skip voer the Interface State since we already have it
                Severity: Major
                Found in modules/post/windows/wlan/wlan_disconnect.rb - About 5 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language