rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

  def run
    if !have_powershell?
      fail_with(Failure::Unknown, 'PowerShell is not installed')
    end

Severity: Major
Found in modules/post/windows/gather/bloodhound.rb - About 2 hrs to fix

    Method request_service_ticket has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def request_service_ticket(session_key, tgt_ticket, realm, client_name, etypes, expiry_time, now, sname, options = {})
        etypes = etypes.is_a?(::Enumerable) ? etypes : [etypes]
    
        flags = Set.new([
          Rex::Proto::Kerberos::Model::KdcOptionFlags::FORWARDABLE,
    Severity: Major
    Found in lib/msf/core/exploit/remote/kerberos/service_authenticator/base.rb - About 2 hrs to fix

      Method asm_reverse_udp has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def asm_reverse_udp(opts={})
      
          retry_count  = [opts[:retry_count].to_i, 1].max
          encoded_port = "0x%.8x" % [opts[:port].to_i,2].pack("vn").unpack("N").first
          encoded_host = "0x%.8x" % Rex::Socket.addr_aton(opts[:host]||"127.127.127.127").unpack("V").first
      Severity: Major
      Found in lib/msf/core/payload/windows/reverse_udp.rb - About 2 hrs to fix

        Method get_current_data_pids has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def get_current_data_pids(bus, src_id, dst_id, opt={})
            pids = []
            opt['MAXPKTS'] = 1
            packets = get_current_data(bus, src_id, dst_id, 0, opt)
            return pids if packets.nil?
        Severity: Major
        Found in lib/msf/core/post/hardware/automotive/uds.rb - About 2 hrs to fix

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            def report_auth
              service_data = {
                  address: ::Rex::Socket.getaddress(datastore['RHOST'],true),
                  port: datastore['RPORT'],
                  service_name: 'smb',
          Severity: Major
          Found in modules/exploits/windows/smb/webexec.rb and 1 other location - About 2 hrs to fix
          modules/exploits/windows/smb/psexec.rb on lines 154..195

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 103.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              while count < datastore['COUNT']
          
                domain.each do |name|
                  query = @res.query(name, "A")
                  time = Time.new
          Severity: Major
          Found in modules/auxiliary/vsploit/malware/dns/dns_zeus.rb and 1 other location - About 2 hrs to fix
          modules/auxiliary/vsploit/malware/dns/dns_mariposa.rb on lines 50..71

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 103.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              while count < datastore['COUNT']
          
                domain.each do |name|
                  query = @res.query(name, "A")
                  time = Time.new
          Severity: Major
          Found in modules/auxiliary/vsploit/malware/dns/dns_mariposa.rb and 1 other location - About 2 hrs to fix
          modules/auxiliary/vsploit/malware/dns/dns_zeus.rb on lines 55..76

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 103.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            def report_auth
              service_data = {
                  address: ::Rex::Socket.getaddress(datastore['RHOST'],true),
                  port: datastore['RPORT'],
                  service_name: 'smb',
          Severity: Major
          Found in modules/exploits/windows/smb/psexec.rb and 1 other location - About 2 hrs to fix
          modules/exploits/windows/smb/webexec.rb on lines 144..185

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 103.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            def on_request_uri(cli, request)
          
              payload_url =  "http://"
              payload_url += (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']
              payload_url += ":" + datastore['SRVPORT'].to_s + get_resource() + "/payload"
          modules/exploits/windows/browser/zenturiprogramchecker_unsafe.rb on lines 54..84

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 103.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            def on_request_uri(cli, request)
          
              payload_url =  "http://"
              payload_url += (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']
              payload_url += ":" + datastore['SRVPORT'].to_s + get_resource() + "/payload"
          modules/exploits/windows/browser/enjoysapgui_comp_download.rb on lines 58..92

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 103.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          module Rex
            module Post
              module PostgreSQL
                module Ui
                  ###
          Severity: Major
          Found in lib/rex/post/postgresql/ui/console.rb and 1 other location - About 2 hrs to fix
          lib/rex/post/mysql/ui/console.rb on lines 5..57

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 103.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          module Rex
            module Post
              module MySQL
                module Ui
          
          
          Severity: Major
          Found in lib/rex/post/mysql/ui/console.rb and 1 other location - About 2 hrs to fix
          lib/rex/post/postgresql/ui/console.rb on lines 5..61

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 103.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method cmd_nessus_connect has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def cmd_nessus_connect(*args)
                  # Check if config file exists and load it
                  if !args[0]
                    if File.exist?(nessus_yaml)
                      lconfig = YAML.load_file(nessus_yaml)
          Severity: Major
          Found in plugins/nessus.rb - About 2 hrs to fix

            Method isotp_send_and_wait has 71 lines of code (exceeds 25 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: Major
            Found in modules/auxiliary/server/local_hwbridge.rb - About 2 hrs to fix

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

                def run_host(_ip)
                  to = datastore['TIMEOUT'].zero? ? 30 : datastore['TIMEOUT']
                  vprint_status("Using a timeout of #{to}...")
                  begin
                    ::Timeout.timeout(to) do
              Severity: Major
              Found in modules/auxiliary/gather/zookeeper_info_disclosure.rb - About 2 hrs to fix

                Method crypto_attack has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def crypto_attack(exploit_string)
                    getsin_msg = fetch_getsin
                    if getsin_msg.nil?
                      return nil
                    end
                Severity: Major
                Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 2 hrs to fix

                  Method grab has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def grab
                      logins = Rex::Text::Table.new(
                        'Header'    =>    "Schneider Modicon Quantum services, usernames, and passwords",
                        'Indent'    =>    1,
                        'Columns'    =>    ["Service", "User Name", "Password"]
                  Severity: Major
                  Found in modules/auxiliary/admin/scada/modicon_password_recovery.rb - About 2 hrs to fix

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

                      def initialize(info = {})
                        super(
                          update_info(
                            info,
                            'Name' => 'Active Directory Certificate Services (ADCS) privilege escalation (Certifried)',
                    Severity: Major
                    Found in modules/auxiliary/admin/dcerpc/cve_2022_26923_certifried.rb - About 2 hrs to fix

                      Method listfiles has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def listfiles(rhost)
                          print_status("[SAP] Connecting to SAP Management Console SOAP Interface on #{rhost}:#{rport}")
                          success = false
                          soapenv = 'http://schemas.xmlsoap.org/soap/envelope/'
                          xsi = 'http://www.w3.org/2001/XMLSchema-instance'
                      Severity: Major
                      Found in modules/auxiliary/scanner/sap/sap_mgmt_con_getlogfiles.rb - About 2 hrs to fix

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

                          def run_host(rhost)
                        
                            vprint_status("#{rhost}:#{rport} - Connecting to SAP Host Control service")
                        
                            data = '<?xml version="1.0" encoding="utf-8"?>'
                        Severity: Major
                        Found in modules/auxiliary/scanner/sap/sap_hostctrl_getcomputersystem.rb - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language