rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

Method unwanted_modules_table has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def unwanted_modules_table(unwanted_modules)
    arch_styler = ::Msf::Ui::Console::TablePrint::CustomColorStyler.new
    platform_styler = ::Msf::Ui::Console::TablePrint::CustomColorStyler.new
    session_type_styler = ::Msf::Ui::Console::TablePrint::CustomColorStyler.new

Severity: Major
Found in modules/post/multi/recon/local_exploit_suggester.rb - About 2 hrs to fix

    Method parse_old_config_file has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def parse_old_config_file(raw_xml)
        db_table = Rex::Text::Table.new(
          'Header' => 'DbVisualizer Databases',
          'Indent' => 2,
          'Columns' =>
    Severity: Major
    Found in modules/post/multi/gather/dbvis_enum.rb - About 2 hrs to fix

      Method configure_for_platform has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def configure_for_platform
          vprint_status('Determining session platform')
          vprint_status("Platform: #{session.platform}")
          vprint_status("Type: #{session.type}")
      
      
      Severity: Major
      Found in modules/post/multi/gather/chrome_cookies.rb - About 2 hrs to fix

        Method domain_mode has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def domain_mode
            ## check domain
            server_name = get_domain('DomainControllerName')
            if server_name
              print_good("Found Domain : #{server_name}")
        Severity: Major
        Found in modules/post/windows/manage/add_user.rb - About 2 hrs to fix

          Method table has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def table
                sorted_sessions = @data.fetch(:sessions, []).sort_by { |session| session[:session_type] }
          
                # Group into buckets, and prioritize sort order
                extension_names = [
          Severity: Major
          Found in tools/dev/report_generation/support_matrix/generate.rb - About 2 hrs to fix

            Method process_type1_message has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.process_type1_message(message, nonce = "\x11\x22\x33\x44\x55\x66\x77\x88", win_domain = 'DOMAIN',
                      win_name = 'SERVER', dns_name = 'server', dns_domain = 'example.com', downgrade = true)
            
                dns_name = Rex::Text.to_unicode(dns_name + "." + dns_domain)
                win_domain = Rex::Text.to_unicode(win_domain)
            Severity: Major
            Found in lib/rex/proto/ntlm/message.rb - About 2 hrs to fix

              Method find_first has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def find_first(path)
                  sid = nil
                  files = { }
                  parm = [
                    26,  # Search for ALL files
              Severity: Major
              Found in lib/rex/proto/smb/client.rb - About 2 hrs to fix

                Method commands has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def commands
                    cmds = {
                      '?'                        => 'Help menu',
                      'background'               => 'Backgrounds the current session',
                      'bg'                       => 'Alias for background',
                Severity: Major
                Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb - About 2 hrs to fix

                  Method parse_opts has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def parse_opts(opts, args, help_cmd:, action: nil)
                      result = {
                        jobify: false,
                        quiet: false,
                        datastore_options: {},
                  Severity: Major
                  Found in lib/msf/ui/console/module_argument_parsing.rb - About 2 hrs to fix

                    Method each_user_pass has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def each_user_pass(noconn=false,&block)
                        this_service = [datastore['RHOST'],datastore['RPORT']].join(":")
                        fq_rest = [this_service,"all remaining users"].join(":")
                    
                        # This should kinda halfway be in setup, halfway in run... need to
                    Severity: Major
                    Found in lib/msf/core/auxiliary/auth_brute.rb - About 2 hrs to fix

                      Method inspect_single_packet_http has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def inspect_single_packet_http(pkt,wspace,args)
                          task = args.fetch(:task, nil)
                          # First, check the server side (data from port 80).
                          if pkt.is_tcp? and pkt.tcp_src == 80 and !pkt.payload.nil? and !pkt.payload.empty?
                            if pkt.payload =~ /^HTTP\x2f1\x2e[01]/n
                      Severity: Major
                      Found in lib/msf/core/db_manager/import/libpcap.rb - About 2 hrs to fix

                        Method build_html has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def build_html(cli, request)
                              exploit_list = get_exploit_urls(cli, request)
                        
                              if datastore['MaxSessionCount'] > -1 && session_count >= datastore['MaxSessionCount']
                                print_status("Exploits will not be served because you've reached the max session count of #{datastore['MaxSessionCount']}")
                        Severity: Major
                        Found in lib/msf/core/exploit/remote/browser_autopwn2.rb - About 2 hrs to fix

                          Method read_packfile has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def self.read_packfile(data)
                                return nil unless data
                                return nil if data.empty?
                          
                                pack_start = data.index('PACK')
                          Severity: Major
                          Found in lib/msf/core/exploit/git/packfile.rb - About 2 hrs to fix

                            Method generate_bind_tcp has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def generate_bind_tcp(opts={})
                                ipf = 'AF_INET'
                                ip = '0.0.0.0'
                                if use_ipv6
                                  ipf << "6"
                            Severity: Major
                            Found in lib/msf/core/payload/php/bind_tcp.rb - About 2 hrs to fix

                              Method option_parser has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def option_parser
                                  @option_parser ||= OptionParser.new { |option_parser|
                                    option_parser.separator ''
                                    option_parser.separator 'Common options:'
                              
                              
                              Severity: Major
                              Found in lib/metasploit/framework/parsed_options/base.rb - About 2 hrs to fix

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

                                  def upload_exec(cmd, filename, content)
                                    var_a = rand_text_alpha_lower(4)
                                    var_b = rand_text_alpha_lower(4)
                                    var_c = rand_text_alpha_lower(4)
                                    var_d = rand_text_alpha_lower(4)
                                Severity: Major
                                Found in modules/exploits/multi/http/struts_dmi_rest_exec.rb and 1 other location - About 2 hrs to fix
                                modules/exploits/multi/http/struts_dmi_exec.rb on lines 118..138

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

                                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 upload_exec(cmd, filename, content)
                                    var_a = rand_text_alpha_lower(4)
                                    var_b = rand_text_alpha_lower(4)
                                    var_c = rand_text_alpha_lower(4)
                                    var_d = rand_text_alpha_lower(4)
                                Severity: Major
                                Found in modules/exploits/multi/http/struts_dmi_exec.rb and 1 other location - About 2 hrs to fix
                                modules/exploits/multi/http/struts_dmi_rest_exec.rb on lines 119..139

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

                                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

                                  class Exploit
                                    class Remote
                                      module HTTP
                                        # This module provides a way of interacting with gitea installations
                                        module Gitea
                                Severity: Major
                                Found in lib/msf/core/exploit/remote/http/gitea.rb and 1 other location - About 2 hrs to fix
                                lib/msf/core/exploit/remote/http/moodle.rb on lines 4..31

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

                                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

                                  class Exploit
                                    class Remote
                                      module HTTP
                                        # This module provides a way of interacting with moodle installations
                                        module Moodle
                                Severity: Major
                                Found in lib/msf/core/exploit/remote/http/moodle.rb and 1 other location - About 2 hrs to fix
                                lib/msf/core/exploit/remote/http/gitea.rb on lines 4..31

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

                                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 vim_powerON_vm(vm_ref)
                                    soap_data = vim_soap_envelope(vim_soap_power_on_vm(vm_ref))
                                    res = vim_send_soap_request(soap_data)
                                    if res.class == Hash
                                      task_id = res['PowerOnVM_TaskResponse']['returnval']
                                Severity: Major
                                Found in lib/msf/core/exploit/remote/vim_soap.rb and 1 other location - About 2 hrs to fix
                                lib/msf/core/exploit/remote/vim_soap.rb on lines 544..571

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

                                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