rapid7/metasploit-framework

View on GitHub

Showing 15,730 of 21,757 total issues

File kiwi.rb has 512 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rex/post/meterpreter'

module Rex
module Post
module Meterpreter
Severity: Major
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb - About 1 day to fix

    File syscall_inject.rb has 511 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'metasploit/framework/compiler/mingw'
    require 'metasploit/framework/compiler/windows'
    class MetasploitModule < Msf::Evasion
      RC4 = File.join(Msf::Config.data_directory, 'headers', 'windows', 'rc4.h')
      BASE64 = File.join(Msf::Config.data_directory, 'headers', 'windows', 'base64.h')
    Severity: Major
    Found in modules/evasion/windows/syscall_inject.rb - About 1 day to fix

      Method isotp_send_and_wait has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

        def isotp_send_and_wait(bus, srcid, dstid, data, opt = {})
          result = {}
          result["Success"] = false
          srcid = srcid.to_i(16).to_s(16)
          dstid = dstid.to_i(16).to_s(16)
      Severity: Minor
      Found in modules/auxiliary/server/local_hwbridge.rb - About 1 day 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 53 (exceeds 5 allowed). Consider refactoring.
      Open

        def run
          vprint_status("#{peer} - Checking ")
          # since we will check res to see if auth was a success, make sure to capture the return
          res = send_request_cgi(
            'uri' => normalize_uri(target_uri.path),
      Severity: Minor
      Found in modules/auxiliary/gather/prometheus_node_exporter_gather.rb - About 1 day 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_host has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

        def run_host(ip)
          conn = true
          ecode = nil
          emesg = nil
      
      
      Severity: Minor
      Found in modules/auxiliary/scanner/http/dir_scanner.rb - About 1 day 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 53 (exceeds 5 allowed). Consider refactoring.
      Open

        def run
          case session.platform
          when 'windows'
            if command_exists?('wmic') == false
              print_error("The 'wmic' command doesn't exist on this host!") # wmic is technically marked as depreciated so this command could very well be removed in future releases.
      Severity: Minor
      Found in modules/post/multi/gather/enum_software_versions.rb - About 1 day 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 53 (exceeds 5 allowed). Consider refactoring.
      Open

        def run
          # docker install, and default path according to https://ranchermanager.docs.rancher.com/how-to-guides/advanced-user-guides/enable-api-audit-log#api-audit-log-options
          fail_with Failure::BadConfig, "#{datastore['LOGFILE']} is not readable or not found" unless readable?(datastore['LOGFILE'])
      
          log = read_file(datastore['LOGFILE'])
      Severity: Minor
      Found in modules/post/linux/gather/rancher_audit_log_leak.rb - About 1 day 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 process_setting has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

            def process_setting(lines, credential_data)
              lines.each do |line|
                case line['key']
                when 'snmp'
                  if framework.db.active
      Severity: Minor
      Found in lib/msf/core/auxiliary/ubiquiti.rb - About 1 day 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 net.rb has 510 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'rex/post/meterpreter'
      require 'rex/post/meterpreter/extensions/stdapi/command_ids'
      
      module Rex
      module Post
      Severity: Major
      Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb - About 1 day to fix

        File client.rb has 509 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'rex/socket'
        
        require 'rex/text'
        require 'digest'
        
        
        Severity: Major
        Found in lib/rex/proto/http/client.rb - About 1 day to fix

          Method mikrotik_routeros_config_eater has 205 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def mikrotik_routeros_config_eater(thost, tport, config)
                if framework.db.active
                  credential_data = {
                    address: thost,
                    port: tport,
          Severity: Major
          Found in lib/msf/core/auxiliary/mikrotik.rb - About 1 day to fix

            File iec104.rb has 507 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class MetasploitModule < Msf::Auxiliary
              #
              # this module sends IEC104 commands
              #
            
            
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb - About 1 day to fix

              File rftransceiver.rb has 507 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Rex
              module Post
              module HWBridge
              module Ui
              ###
              Severity: Major
              Found in lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb - About 1 day to fix

                Method t3_send has 203 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def t3_send(payload_obj)
                    print_status('Sending object...')
                
                    request_obj = '000009f3' # Original packet length
                    request_obj << '016501' # CMD_IDENTIFY_REQUEST, flags
                Severity: Major
                Found in modules/exploits/multi/misc/weblogic_deserialize_badattrval.rb - About 1 day to fix

                  Method t3_send has 203 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def t3_send(payload_obj)
                      print_status('Sending object...')
                  
                      request_obj = '000009f3' # Original packet length
                      request_obj << '016501' # CMD_IDENTIFY_REQUEST, flags
                  Severity: Major
                  Found in modules/exploits/multi/misc/weblogic_deserialize_badattr_extcomp.rb - About 1 day to fix

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

                      def run
                        vprint_status("#{peer} - Checking build info")
                        res = send_request_cgi(
                          'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'status', 'buildinfo'),
                          'method' => 'GET'
                    Severity: Minor
                    Found in modules/auxiliary/gather/prometheus_api_gather.rb - About 1 day 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 check_results has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def check_results(passwords, results, hash_type, method)
                          passwords.each do |password_line|
                            password_line.chomp!
                            next if password_line.blank?
                    
                    
                    Severity: Minor
                    Found in modules/auxiliary/analyze/crack_windows.rb - About 1 day 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 try_user_pass has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def try_user_pass(opts)
                        user = opts[:user]
                        pass = opts[:pass]
                        auth_path = opts[:auth_path]
                        inbox_path = opts[:inbox_path]
                    Severity: Minor
                    Found in modules/auxiliary/scanner/http/owa_login.rb - About 1 day 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_host has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def run_host(ip)
                    
                        startstage = datastore['STARTATSTAGE']
                    
                        @nr_errors = datastore['STOPAFTER']
                    Severity: Minor
                    Found in modules/auxiliary/fuzzers/ftp/ftp_pre_post.rb - About 1 day 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 exploit has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def exploit
                        # Get node_id for requests
                        node_id = get_node
                        fail_with(Failure::Unknown, 'Could not get a valid node id for the vBulletin install.') unless node_id
                    
                    
                    Severity: Minor
                    Found in modules/exploits/multi/http/vbulletin_getindexablecontent.rb - About 1 day 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