rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

Method keycap has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def keycap(session, keytime, logfile)
    rec = 1
    # Creating DB for captured keystrokes
    print_status("Keystrokes being saved in to #{logfile}")
    # Inserting keystrokes every number of seconds specified
Severity: Major
Found in modules/post/windows/capture/lockout_keylogger.rb - About 2 hrs to fix

    Method steal_token has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def steal_token(domain_user, domain)
        if (session.sys.config.getuid == domain_user) || (domain_user == '')
          return true
        end
    
    
    Severity: Major
    Found in modules/post/windows/manage/add_user.rb - About 2 hrs to fix

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

        def initialize(info = {})
          super(
            update_info(
              info,
              'Name' => 'VMware vCenter Secrets Dump',
      Severity: Major
      Found in modules/post/linux/gather/vcenter_secrets_dump.rb - About 2 hrs to fix

        Method negotiate has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def negotiate(smb_extended_security=true, do_recv = true)
        
            dialects = ['LANMAN1.0', 'LM1.2X002' ]
        
            if (self.encrypt_passwords)
        Severity: Major
        Found in lib/rex/proto/smb/client.rb - About 2 hrs to fix

          Method cmd_shell has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def cmd_shell(*args)
              use_pty = false
              raw = false
              sh_path = '/bin/bash'
          
          
          Severity: Major
          Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb - About 2 hrs to fix

            Method cmd_golden_ticket_create has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def cmd_golden_ticket_create(*args)
            
                if args.include?("-h")
                  golden_ticket_create_usage
                  return
            Severity: Major
            Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb - About 2 hrs to fix

              Method cmd_search_help has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def cmd_search_help
                          print_line "Usage: search [<options>] [<keywords>:<value>]"
                          print_line
                          print_line "Prepending a value with '-' will exclude any matching results."
                          print_line "If no options or keywords are provided, cached results are displayed."
              Severity: Major
              Found in lib/msf/ui/console/command_dispatcher/modules.rb - About 2 hrs to fix

                Method store_cred has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def store_cred(opts={})
                    if [opts[:port],opts[:sname]].compact.empty?
                      raise ArgumentError, "Missing option: :sname or :port"
                    end
                    cred_opts = opts
                Severity: Major
                Found in lib/msf/core/auxiliary/report.rb - About 2 hrs to fix

                  Method import_nessus_nbe has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def import_nessus_nbe(args={}, &block)
                      nbe_data = args[:data]
                      wspace = Msf::Util::DBManager.process_opts_workspace(args, framework).name
                      bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
                  
                  
                  Severity: Major
                  Found in lib/msf/core/db_manager/import/nessus/nbe.rb - About 2 hrs to fix

                    Method typo3_backend_login has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def typo3_backend_login(user, pass)
                        # get login page for RSA modulus and exponent
                        res_main = send_request_cgi({
                          'method' => 'GET',
                          'uri' => typo3_url_login
                    Severity: Major
                    Found in lib/msf/core/exploit/remote/http/typo3/login.rb - About 2 hrs to fix

                      Method smb_srvsvc_netshareenumall has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def smb_srvsvc_netshareenumall
                              shares = []
                              simple.connect("\\\\#{rhost}\\IPC$")
                              handle = dcerpc_handle('4b324fc8-1670-01d3-1278-5a47bf6ee188', '3.0', 'ncacn_np', ["\\srvsvc"])
                              begin
                      Severity: Major
                      Found in lib/msf/core/exploit/remote/smb/client.rb - About 2 hrs to fix

                        Method extract_user_and_realm has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    def extract_user_and_realm(certificate, username, realm)
                                      raise ArgumentError, 'Must provide username if providing realm' if username.nil? && !realm.nil?
                                      raise ArgumentError, 'Must provide realm if providing username' if realm.nil? && !username.nil?
                        
                                      results = []
                        Severity: Major
                        Found in lib/msf/core/exploit/remote/kerberos/client/pkinit.rb - About 2 hrs to fix

                          Method native_upload has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def native_upload(smb_share, filename, service_encoder)
                              # Upload the shellcode to a file
                              print_status("Uploading payload... #{filename}")
                              smbshare = smb_share
                              fileprefix = ""
                          Severity: Major
                          Found in lib/msf/core/exploit/remote/smb/client/psexec.rb - About 2 hrs to fix

                            Method dump_table_fields has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def dump_table_fields(table, columns, condition = '', limit = '')
                                  return '' if columns.empty?
                            
                                  one_column = columns.length == 1
                                  if one_column
                            Severity: Major
                            Found in lib/msf/core/exploit/sqli/sqlitei/common.rb - About 2 hrs to fix

                              Method process_report has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def process_report(m, mod)
                                  data = m.params['data']
                              
                                  case m.params['type']
                                  when 'host'
                              Severity: Major
                              Found in lib/msf/core/module/external.rb - About 2 hrs to fix

                                Method generate_reverse_tcp has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def generate_reverse_tcp(opts={})
                                    ipf = "AF_INET";
                                    if Rex::Socket.is_ipv6?(opts[:host])
                                      ipf << "6"
                                      opts[:host] = "[#{opts[:host]}]"
                                Severity: Major
                                Found in lib/msf/core/payload/php/reverse_tcp.rb - About 2 hrs to fix

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

                                          def initialize(info = {})
                                            super
                                  
                                            register_advanced_options(
                                              [
                                  Severity: Major
                                  Found in lib/msf/core/post/windows/task_scheduler.rb - About 2 hrs to fix

                                    Method scan! has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            def scan!
                                              valid!
                                    
                                              # Keep track of connection errors.
                                              # If we encounter too many, we will stop.
                                    Severity: Major
                                    Found in lib/metasploit/framework/login_scanner/snmp.rb - About 2 hrs to fix

                                      Method get_platform_info has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              def self.get_platform_info(ssh_socket, timeout: 10)
                                                info = ''
                                                begin
                                                  Timeout.timeout(timeout) do
                                                    info = ssh_socket.exec!("id\n").to_s
                                      Severity: Major
                                      Found in lib/metasploit/framework/ssh/platform.rb - About 2 hrs to fix

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

                                          def validate_cookie(decoded_cookie, secret_key)
                                            print_status("#{peer} - Attempting to resign with key: #{secret_key}")
                                            encoded_cookie = Msf::Exploit::Remote::HTTP::FlaskUnsign::Session.sign(decoded_cookie, secret_key)
                                        
                                            print_status("#{peer} - New signed cookie: #{encoded_cookie}")
                                        modules/exploits/linux/http/apache_superset_cookie_sig_rce.rb on lines 114..132

                                        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 85.

                                        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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language