rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

  def run
    opt = {}
    opt['PADDING'] = datastore['PADDING'] unless datastore['PADDING'].nil?
    print_status('Gathering Data...')
    vin = read_data_by_id(datastore['CANBUS'], datastore['SRCID'], datastore['DSTID'], [0xF1, 0x90], opt)
Severity: Major
Found in modules/post/hardware/automotive/pdt.rb - About 2 hrs to fix

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

      def run
        pw_tbl = Rex::Text::Table.new(
          'Header' => 'MobaXterm Password',
          'Columns' => [
            'Protocol',
    Severity: Major
    Found in modules/post/windows/gather/credentials/moba_xterm.rb - About 2 hrs to fix

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

        def initialize(info = {})
          super(
            update_info(
              info,
              'Name' => 'SolarWinds Orion Secrets Dump',
      Severity: Major
      Found in modules/post/windows/gather/credentials/solarwinds_orion_dump.rb - About 2 hrs to fix

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

          def run
            credential_count = {}
            qcred = datastore['CRED'] || nil
            qpath = datastore['PATH'] || nil
        
        
        Severity: Major
        Found in modules/post/windows/gather/enum_services.rb - About 2 hrs to fix

          Method execute_assembly has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def execute_assembly(exe_path, clr_version)
              if datastore['TECHNIQUE'] == 'SPAWN_AND_INJECT'
                self.hprocess = launch_process
                self.terminate_process = datastore['KILL']
                check_process_suitability(hprocess.pid)
          Severity: Major
          Found in modules/post/windows/manage/execute_dotnet_assembly.rb - About 2 hrs to fix

            Method transport_prepare_request has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def transport_prepare_request(method, opts={})
                unless valid_transport?(opts[:transport]) && opts[:lport]
                  return nil
                end
            
            
            Severity: Major
            Found in lib/rex/post/meterpreter/client_core.rb - About 2 hrs to fix

              Method option_values_dispatch has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def option_values_dispatch(mod, o, str, words)
                        res = []
                        res << o.default.to_s if o.default
                        case o
                        when Msf::OptAddress
              Severity: Major
              Found in lib/msf/ui/console/module_option_tab_completion.rb - About 2 hrs to fix

                Method dump_jobs has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.dump_jobs(framework, verbose = false, indent = DefaultIndent, col = DefaultColumnWrap)
                    columns = [ 'Id', 'Name', "Payload", "Payload opts"]
                
                    if (verbose)
                      columns += [ "URIPATH", "Start Time", "Handler opts", "Persist" ]
                Severity: Major
                Found in lib/msf/base/serializer/readable_text.rb - About 2 hrs to fix

                  Method start_handler has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def start_handler
                      # Our HTTP client and URL for talking to the hop
                      uri = URI(full_uri)
                      self.control = "#{uri.request_uri}control"
                      self.mclient = Rex::Proto::Http::Client.new(
                  Severity: Major
                  Found in lib/msf/core/handler/reverse_hop_http.rb - About 2 hrs to fix

                    Method connect_dialup has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def connect_dialup(global = true, opts={})
                    
                        if (not @telephony_loaded)
                          print_status("The serialport module is not available: #{telephony_error}")
                          raise RuntimeError, "Telephony not available"
                    Severity: Major
                    Found in lib/msf/core/exploit/remote/dialup.rb - About 2 hrs to fix

                      Method process_data has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def process_data(data)
                          @inbuffer += data if data
                          case @state
                          when :id_state
                            if line?
                      Severity: Major
                      Found in lib/msf/core/exploit/remote/tincd_exploit_client.rb - About 2 hrs to fix

                        Method pdu_client_confirm_active has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def pdu_client_confirm_active
                            pdu =
                              "\xea\x03\x01\x00" + # shareId: 66538
                              "\xea\x03" + # originatorId
                              "\x06\x00" + # lengthSourceDescriptor: 6
                        Severity: Major
                        Found in lib/msf/core/exploit/remote/rdp.rb - About 2 hrs to fix

                          Method asm_block_recv_rc4 has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def asm_block_recv_rc4(opts={})
                              xorkey = Rex::Text.to_dword(opts[:xorkey]).chomp
                              asm = %Q^
                                recv:
                                ; Receive the size of the incoming second stage...
                          Severity: Major
                          Found in lib/msf/core/payload/windows/x64/bind_tcp_rc4_x64.rb - About 2 hrs to fix

                            Method asm_block_recv has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def asm_block_recv(opts={})
                                reliable     = opts[:reliable]
                                asm = %Q^
                                  recv:
                                    ; Receive the size of the incoming second stage...
                            Severity: Major
                            Found in lib/msf/core/payload/windows/bind_tcp.rb - About 2 hrs to fix

                              Method get_version_info_impl has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def get_version_info_impl
                                  if session.type == 'meterpreter'
                                    result = session.railgun.ntdll.RtlGetVersion(input_os_version_info_ex)
                                    os_version_info_ex = unpack_version_info(result['VersionInformation'])
                                    major = os_version_info_ex[1]
                              Severity: Major
                              Found in lib/msf/core/post/windows/version.rb - About 2 hrs to fix

                                Method mcp_parse has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        def mcp_parse(stream)
                                          # Reminder: this has to be an array, not a hash, because there are
                                          # often duplicate entries (like multiple userdb_entry results when a
                                          # query is performed).
                                          result = []
                                Severity: Major
                                Found in lib/msf/core/post/linux/f5_mcp.rb - About 2 hrs to fix

                                  Method parse has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def parse(pkt)
                                      # We want to return immediatly if we do not have a packet which is handled by us
                                      return unless pkt.is_tcp?
                                      return if (pkt.tcp_sport != 110 and pkt.tcp_dport != 110)
                                      s = find_session((pkt.tcp_sport == 110) ? get_session_src(pkt) : get_session_dst(pkt))
                                  Severity: Major
                                  Found in data/exploits/psnuffle/pop3.rb - About 2 hrs to fix

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

                                        this.assignXor = operation(function xor(a, b) {
                                            for (var i = 0; i < 8; i++) {
                                                bytes[i] = a.byteAt(i) ^ b.byteAt(i);
                                            }
                                            return this;
                                    Severity: Major
                                    Found in data/exploits/javascript_utils/int64.js and 1 other location - About 2 hrs to fix
                                    data/exploits/javascript_utils/int64.js on lines 173..178

                                    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

                                        this.assignAnd = operation(function and(a, b) {
                                            for (var i = 0; i < 8; i++) {
                                                bytes[i] = a.byteAt(i) & b.byteAt(i);
                                            }
                                            return this;
                                    Severity: Major
                                    Found in data/exploits/javascript_utils/int64.js and 1 other location - About 2 hrs to fix
                                    data/exploits/javascript_utils/int64.js on lines 165..170

                                    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 setup_handler
                                            if !datastore['Proxies'].blank? && !datastore['ReverseAllowProxy']
                                              raise RuntimeError, "TCP connect-back payloads cannot be used with Proxies. Use 'set ReverseAllowProxy true' to override this behaviour."
                                            end
                                    
                                    
                                    Severity: Major
                                    Found in lib/msf/core/handler/reverse.rb and 1 other location - About 2 hrs to fix
                                    lib/msf/core/handler/reverse_sctp.rb on lines 64..96

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

                                    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