rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

  swagger_path '/api/v1/vuln-attempts/{id}' do
    # Swagger documentation for api/v1/vuln-attempts/:id GET
    operation :get do
      key :description, 'Return a specific vuln attempt that is stored in the database.'
      key :tags, [ 'vuln_attempt' ]
lib/msf/core/web_services/documentation/api/v1/event_api_doc.rb on lines 138..173
lib/msf/core/web_services/documentation/api/v1/session_api_doc.rb on lines 88..123
lib/msf/core/web_services/documentation/api/v1/session_event_api_doc.rb on lines 136..171

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

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 4 locations. Consider refactoring.
Open

  swagger_path '/api/v1/session-events/{id}' do
    # Swagger documentation for /api/v1/session-events/:id GET
    operation :get do
      key :description, 'Return a specific session event that is stored in the database.'
      key :tags, [ 'session_event' ]
lib/msf/core/web_services/documentation/api/v1/event_api_doc.rb on lines 138..173
lib/msf/core/web_services/documentation/api/v1/session_api_doc.rb on lines 88..123
lib/msf/core/web_services/documentation/api/v1/vuln_attempt_api_doc.rb on lines 115..150

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

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 3 locations. Consider refactoring.
Open

  def exploit
    connect

    print_status("#{rhost}:#{rport} - Registering with the IRC Server...")
    res = register(sock)
Severity: Major
Found in modules/exploits/multi/misc/w3tw0rk_exec.rb and 2 other locations - About 2 hrs to fix
modules/exploits/multi/misc/legend_bot_exec.rb on lines 146..167
modules/exploits/multi/misc/xdh_x_exec.rb on lines 148..169

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

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 3 locations. Consider refactoring.
Open

  def exploit
    connect

    print_status("#{rhost}:#{rport} - Registering with the IRC Server...")
    res = register(sock)
Severity: Major
Found in modules/exploits/multi/misc/xdh_x_exec.rb and 2 other locations - About 2 hrs to fix
modules/exploits/multi/misc/legend_bot_exec.rb on lines 146..167
modules/exploits/multi/misc/w3tw0rk_exec.rb on lines 136..157

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

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 3 locations. Consider refactoring.
Open

  def exploit
    connect

    print_status("#{rhost}:#{rport} - Registering with the IRC Server...")
    res = register(sock)
Severity: Major
Found in modules/exploits/multi/misc/legend_bot_exec.rb and 2 other locations - About 2 hrs to fix
modules/exploits/multi/misc/w3tw0rk_exec.rb on lines 136..157
modules/exploits/multi/misc/xdh_x_exec.rb on lines 148..169

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

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

    begin
      ssh_socket = nil
      ::Timeout.timeout(datastore['SSH_TIMEOUT']) do
        ssh_socket = Net::SSH.start(rhost, 'root', ssh_options)
      end
Severity: Major
Found in modules/exploits/linux/ssh/exagrid_known_privkey.rb and 1 other location - About 2 hrs to fix
modules/exploits/linux/ssh/vmware_vdp_known_privkey.rb on lines 84..102

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

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

    begin
      ssh = nil
      ::Timeout.timeout(datastore['SSH_TIMEOUT']) do
        ssh = Net::SSH.start(rhost, username, opts)
      end
Severity: Major
Found in modules/exploits/linux/ssh/solarwinds_lem_exec.rb and 1 other location - About 2 hrs to fix
modules/exploits/linux/ssh/mercurial_ssh_exec.rb on lines 90..108

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

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 get_members_from_group(groupname, server_name = nil)
          unless session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_RAILGUN_API)
            raise "Session doesn't support Railgun!"
          end

Severity: Major
Found in lib/msf/core/post/windows/accounts.rb and 1 other location - About 2 hrs to fix
lib/msf/core/post/windows/accounts.rb on lines 626..649

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

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

    begin
      ssh_socket = nil
      ::Timeout.timeout(datastore['SSH_TIMEOUT']) do
        ssh_socket = Net::SSH.start(rhost, 'admin', opt_hash)
      end
Severity: Major
Found in modules/exploits/linux/ssh/vmware_vdp_known_privkey.rb and 1 other location - About 2 hrs to fix
modules/exploits/linux/ssh/exagrid_known_privkey.rb on lines 83..101

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

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 get_members_from_localgroup(localgroupname, server_name = nil)
          unless session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_RAILGUN_API)
            raise "Session doesn't support Railgun!"
          end

Severity: Major
Found in lib/msf/core/post/windows/accounts.rb and 1 other location - About 2 hrs to fix
lib/msf/core/post/windows/accounts.rb on lines 589..615

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

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

    begin
      ssh = nil
      ::Timeout.timeout(datastore['SSH_TIMEOUT']) do
        ssh = Net::SSH.start(rhost, username, ssh_options)
      end
Severity: Major
Found in modules/exploits/linux/ssh/mercurial_ssh_exec.rb and 1 other location - About 2 hrs to fix
modules/exploits/linux/ssh/solarwinds_lem_exec.rb on lines 91..109

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

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 initialize has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info={})
    super(update_info(info,
      'Name'           => "HTTP Client Automatic Exploiter 2 (Browser Autopwn)",
      'Description'    => %q{
        This module will automatically serve browser exploits. Here are the options you can
Severity: Major
Found in modules/auxiliary/server/browser_autopwn2.rb - About 2 hrs to fix

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

      def handle_auth(cli,hash)
        # authorization string is base64 encoded message
        message = Rex::Text.decode_base64(hash)
    
        if(message[8,1] == "\x01")
    Severity: Major
    Found in modules/auxiliary/server/capture/http_ntlm.rb - About 2 hrs to fix

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

        def run
      
          print_status("Get a valid session cookie...")
          res = send_request_cgi({
            'uri' => normalize_uri(target_uri.path, 'ossim', 'session', 'login.php')
      Severity: Major
      Found in modules/auxiliary/gather/alienvault_iso27001_sqli.rb - About 2 hrs to fix

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

          def run
            proto  = datastore['PROTOCOL']
            client = datastore['CLIENT']
        
            begin
        Severity: Major
        Found in modules/auxiliary/gather/nis_bootparamd_domain.rb - About 2 hrs to fix

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

            def run
          
              # There is a fixed size buffer in use, so make sure we don't exceed it..
              # (NOTE: 24 bytes are reserved for traversal string)
              path = datastore['PATH']
          Severity: Major
          Found in modules/auxiliary/admin/sunrpc/solaris_kcms_readfile.rb - About 2 hrs to fix

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

              def run_host(ip)
                un_list = []
                if datastore['GET_USERNAMES_FROM_CONFIG']
                    connect()
                    get_username_from_config(un_list,ip)
            Severity: Major
            Found in modules/auxiliary/scanner/telnet/brocade_enable_login.rb - About 2 hrs to fix

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

                def run_host(ip)
                    output_data = {}
                  begin
                    snmp = connect_snmp
              
              
              Severity: Major
              Found in modules/auxiliary/scanner/snmp/netopia_enum.rb - About 2 hrs to fix

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

                  def run_host(ip)
                    print_status("Verifying that login page exists at #{ip}")
                    server_response = false
                    @blockingtime = 0
                    begin
                Severity: Major
                Found in modules/auxiliary/scanner/http/dell_idrac.rb - About 2 hrs to fix

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

                    def run_host(ip)
                      # Get the available SSL/TLS versions that that Metasploit host supports
                      versions = get_metasploit_ssl_versions
                  
                      certs_found = {}
                  Severity: Major
                  Found in modules/auxiliary/scanner/ssl/ssl_version.rb - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language