rapid7/metasploit-framework

View on GitHub
lib/msf/core/rpc/v10/rpc_db.rb

Summary

Maintainability
F
2 wks
Test Coverage

File rpc_db.rb has 1013 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Msf
module RPC
class RPC_Db < RPC_Base

private
Severity: Major
Found in lib/msf/core/rpc/v10/rpc_db.rb - About 2 days to fix

    Method rpc_del_vuln has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
    Open

      def rpc_del_vuln(xopts)
      ::ApplicationRecord.connection_pool.with_connection {
        opts, wspace = init_db_opts_workspace(xopts)
        opts[:workspace] = opts[:workspace].name
        hosts  = []
    Severity: Minor
    Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method rpc_del_service has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
    Open

      def rpc_del_service(xopts)
      ::ApplicationRecord.connection_pool.with_connection {
        opts, wspace = init_db_opts_workspace(xopts)
        hosts  = []
        services = []
    Severity: Minor
    Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method opts_to_services has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

      def opts_to_services(hosts,opts)
      ::ApplicationRecord.connection_pool.with_connection {
        wspace = find_workspace(opts[:workspace])
        services = []
        if opts[:host] or opts[:address] or opts[:addresses]
    Severity: Minor
    Found in lib/msf/core/rpc/v10/rpc_db.rb - About 7 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Class RPC_Db has 51 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class RPC_Db < RPC_Base
    
    private
    
      include Metasploit::Credential::Creation
    Severity: Major
    Found in lib/msf/core/rpc/v10/rpc_db.rb - About 7 hrs to fix

      Method get_notes has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_notes(xopts)
        ::ApplicationRecord.connection_pool.with_connection {
          opts, wspace = init_db_opts_workspace(xopts)
          notes = []
      
      
      Severity: Minor
      Found in lib/msf/core/rpc/v10/rpc_db.rb - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method rpc_del_client has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        def rpc_del_client(xopts)
        ::ApplicationRecord.connection_pool.with_connection {
          db_check
          opts = fix_options(xopts)
          wspace = find_workspace(opts[:workspace])
      Severity: Minor
      Found in lib/msf/core/rpc/v10/rpc_db.rb - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method rpc_get_service has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

        def rpc_get_service(xopts)
        ::ApplicationRecord.connection_pool.with_connection {
          opts, wspace = init_db_opts_workspace(xopts)
      
          ret = {}
      Severity: Minor
      Found in lib/msf/core/rpc/v10/rpc_db.rb - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method rpc_get_vuln has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

        def rpc_get_vuln(xopts)
        ::ApplicationRecord.connection_pool.with_connection {
          opts, wspace = init_db_opts_workspace(xopts)
      
          ret = {}
      Severity: Minor
      Found in lib/msf/core/rpc/v10/rpc_db.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method rpc_del_host has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        def rpc_del_host(xopts)
        ::ApplicationRecord.connection_pool.with_connection {
          db_check
          opts = fix_options(xopts)
          wspace = find_workspace(opts[:workspace])
      Severity: Minor
      Found in lib/msf/core/rpc/v10/rpc_db.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method opts_to_hosts has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        def opts_to_hosts(opts)
        ::ApplicationRecord.connection_pool.with_connection {
          wspace = find_workspace(opts[:workspace])
          hosts  = []
          if opts[:host] or opts[:address]
      Severity: Minor
      Found in lib/msf/core/rpc/v10/rpc_db.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method rpc_del_vuln has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def rpc_del_vuln(xopts)
        ::ApplicationRecord.connection_pool.with_connection {
          opts, wspace = init_db_opts_workspace(xopts)
          opts[:workspace] = opts[:workspace].name
          hosts  = []
      Severity: Major
      Found in lib/msf/core/rpc/v10/rpc_db.rb - About 2 hrs to fix

        Method rpc_notes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def rpc_notes(xopts)
          ::ApplicationRecord.connection_pool.with_connection {
            opts, wspace = init_db_opts_workspace(xopts)
            limit = opts.delete(:limit) || 100
            offset = opts.delete(:offset) || 0
        Severity: Minor
        Found in lib/msf/core/rpc/v10/rpc_db.rb - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method rpc_del_service has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def rpc_del_service(xopts)
          ::ApplicationRecord.connection_pool.with_connection {
            opts, wspace = init_db_opts_workspace(xopts)
            hosts  = []
            services = []
        Severity: Major
        Found in lib/msf/core/rpc/v10/rpc_db.rb - About 2 hrs to fix

          Method rpc_report_note has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def rpc_report_note(xopts)
            ::ApplicationRecord.connection_pool.with_connection {
              opts, wspace = init_db_opts_workspace(xopts)
              if (opts[:host] or opts[:address]) and opts[:port] and opts[:proto]
                addr = opts[:host] || opts[:address]
          Severity: Minor
          Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method rpc_creds has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def rpc_creds(xopts)
              ::ApplicationRecord.connection_pool.with_connection {
                ret = {}
                ret[:creds] = []
                opts, wspace = init_db_opts_workspace(xopts)
          Severity: Minor
          Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

            Method rpc_get_vuln has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def rpc_get_vuln(xopts)
              ::ApplicationRecord.connection_pool.with_connection {
                opts, wspace = init_db_opts_workspace(xopts)
            
                ret = {}
            Severity: Minor
            Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

              Method rpc_vulns has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                def rpc_vulns(xopts)
                ::ApplicationRecord.connection_pool.with_connection {
                  opts, wspace = init_db_opts_workspace(xopts)
                  limit = opts.delete(:limit) || 100
                  offset = opts.delete(:offset) || 0
              Severity: Minor
              Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method rpc_creds has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                def rpc_creds(xopts)
                  ::ApplicationRecord.connection_pool.with_connection {
                    ret = {}
                    ret[:creds] = []
                    opts, wspace = init_db_opts_workspace(xopts)
              Severity: Minor
              Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method rpc_get_service has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def rpc_get_service(xopts)
                ::ApplicationRecord.connection_pool.with_connection {
                  opts, wspace = init_db_opts_workspace(xopts)
              
                  ret = {}
              Severity: Minor
              Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                Method rpc_del_creds has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def rpc_del_creds(xopts)
                    ::ApplicationRecord.connection_pool.with_connection {
                      deleted = []
                      ret = {}
                      ret[:creds] = []
                Severity: Minor
                Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                  Method rpc_del_client has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def rpc_del_client(xopts)
                    ::ApplicationRecord.connection_pool.with_connection {
                      db_check
                      opts = fix_options(xopts)
                      wspace = find_workspace(opts[:workspace])
                  Severity: Minor
                  Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                    Method rpc_analyze_host has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    def rpc_analyze_host(xopts)
                      ::ApplicationRecord.connection_pool.with_connection {
                        _opts, _wspace = init_db_opts_workspace(xopts)
                        ret = {
                          host: {}
                    Severity: Minor
                    Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                      Method rpc_services has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def rpc_services( xopts)
                        ::ApplicationRecord.connection_pool.with_connection {
                          opts, wspace = init_db_opts_workspace(xopts)
                          limit = opts.delete(:limit) || 100
                          offset = opts.delete(:offset) || 0
                      Severity: Minor
                      Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Method rpc_vulns has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def rpc_vulns(xopts)
                        ::ApplicationRecord.connection_pool.with_connection {
                          opts, wspace = init_db_opts_workspace(xopts)
                          limit = opts.delete(:limit) || 100
                          offset = opts.delete(:offset) || 0
                      Severity: Minor
                      Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                        Method opts_to_services has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def opts_to_services(hosts,opts)
                          ::ApplicationRecord.connection_pool.with_connection {
                            wspace = find_workspace(opts[:workspace])
                            services = []
                            if opts[:host] or opts[:address] or opts[:addresses]
                        Severity: Minor
                        Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                          Method rpc_clients has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def rpc_clients(xopts)
                            ::ApplicationRecord.connection_pool.with_connection {
                              opts, wspace = init_db_opts_workspace(xopts)
                              limit = opts.delete(:limit) || 100
                              offset = opts.delete(:offset) || 0
                          Severity: Minor
                          Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Method rpc_events has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def rpc_events(xopts)
                            ::ApplicationRecord.connection_pool.with_connection {
                              opts, wspace = init_db_opts_workspace(xopts)
                              limit = opts.delete(:limit) || 100
                              offset = opts.delete(:offset) || 0
                          Severity: Minor
                          Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Method rpc_hosts has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def rpc_hosts(xopts)
                            ::ApplicationRecord.connection_pool.with_connection {
                              opts, wspace = init_db_opts_workspace(xopts)
                          
                              conditions = {}
                          Severity: Minor
                          Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                            Method get_notes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def get_notes(xopts)
                              ::ApplicationRecord.connection_pool.with_connection {
                                opts, wspace = init_db_opts_workspace(xopts)
                                notes = []
                            
                            
                            Severity: Minor
                            Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                              Method rpc_services has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def rpc_services( xopts)
                                ::ApplicationRecord.connection_pool.with_connection {
                                  opts, wspace = init_db_opts_workspace(xopts)
                                  limit = opts.delete(:limit) || 100
                                  offset = opts.delete(:offset) || 0
                              Severity: Minor
                              Found in lib/msf/core/rpc/v10/rpc_db.rb - About 1 hr to fix

                                Method rpc_del_creds has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def rpc_del_creds(xopts)
                                    ::ApplicationRecord.connection_pool.with_connection {
                                      deleted = []
                                      ret = {}
                                      ret[:creds] = []
                                Severity: Minor
                                Found in lib/msf/core/rpc/v10/rpc_db.rb - About 55 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Method rpc_connect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def rpc_connect(xopts)
                                    opts = fix_options(xopts)
                                    if not self.framework.db.driver and not opts[:driver]
                                      return { :result => 'failed' }
                                    end
                                Severity: Minor
                                Found in lib/msf/core/rpc/v10/rpc_db.rb - About 45 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Consider simplifying this complex logical expression.
                                Open

                                    if (opts[:host] or opts[:address]) and opts[:port] and opts[:proto]
                                      addr = opts[:host] || opts[:address]
                                      wspace = opts[:workspace] || self.framework.db.workspace
                                      host = wspace.hosts.find_by_address(addr)
                                      if host && host.services.count > 0
                                Severity: Major
                                Found in lib/msf/core/rpc/v10/rpc_db.rb - About 40 mins to fix

                                  Method rpc_loots has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def rpc_loots(xopts)
                                    ::ApplicationRecord.connection_pool.with_connection {
                                      opts, wspace = init_db_opts_workspace(xopts)
                                      limit = opts.delete(:limit) || 100
                                      offset = opts.delete(:offset) || 0
                                  Severity: Minor
                                  Found in lib/msf/core/rpc/v10/rpc_db.rb - About 35 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Method rpc_del_workspace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def rpc_del_workspace(wspace)
                                    ::ApplicationRecord.connection_pool.with_connection {
                                      db_check
                                      # Delete workspace
                                      workspace = find_workspace(wspace)
                                  Severity: Minor
                                  Found in lib/msf/core/rpc/v10/rpc_db.rb - About 35 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Method rpc_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def rpc_status
                                      if (not self.framework.db.driver)
                                        return {:driver => 'None' }
                                      end
                                  
                                  
                                  Severity: Minor
                                  Found in lib/msf/core/rpc/v10/rpc_db.rb - About 35 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Avoid too many return statements within this method.
                                  Open

                                      return { :result => 'success' }
                                  Severity: Major
                                  Found in lib/msf/core/rpc/v10/rpc_db.rb - About 30 mins to fix

                                    Method rpc_del_note has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def rpc_del_note(xopts)
                                        notes = get_notes(xopts)
                                    
                                        deleted = []
                                        notes.each do |n|
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb - About 25 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

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

                                        if opts[:host] or opts[:address]
                                          host = opts[:host] || opts[:address]
                                          hent = wspace.hosts.find_by_address(host)
                                          return { :result => 'failed' } if hent == nil or hent.class != ::Mdm::Host
                                          hosts << hent
                                    Severity: Major
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 2 hrs to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 1419..1431

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

                                    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

                                        if opts[:host] or opts[:address]
                                          host = opts[:host] || opts[:address]
                                          hent = wspace.hosts.find_by_address(host)
                                          return { :result => 'failed' } if hent == nil or hent.class != ::Mdm::Host
                                          hosts << hent
                                    Severity: Major
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 2 hrs to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 1345..1357

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

                                    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

                                          host = {}
                                          host[:created_at] = h.created_at.to_i
                                          host[:address] = h.address.to_s
                                          host[:mac] = h.mac.to_s
                                          host[:name] = h.name.to_s
                                    Severity: Major
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 2 hrs to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 408..421

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

                                    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

                                          host = {}
                                          host[:created_at] = h.created_at.to_i
                                          host[:address] = h.address.to_s
                                          host[:mac] = h.mac.to_s
                                          host[:name] = h.name.to_s
                                    Severity: Major
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 2 hrs to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 734..747

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

                                    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

                                          service = {}
                                          host = s.host
                                          service[:host] = host.address || "unknown"
                                          service[:created_at] = s[:created_at].to_i
                                          service[:updated_at] = s[:updated_at].to_i
                                    Severity: Major
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 1 hr to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 928..938

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

                                    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

                                          service = {}
                                          host = s.host
                                          service[:host] = host.address || "unknown"
                                          service[:created_at] = s[:created_at].to_i
                                          service[:updated_at] = s[:updated_at].to_i
                                    Severity: Major
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 1 hr to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 471..481

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

                                    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

                                          hosts.each do |h|
                                            vret = nil
                                            if opts[:name]
                                              vret = h.vulns.find_by_name(opts[:name])
                                            else
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 55 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 1227..1236

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

                                    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

                                        vulns.each do |v|
                                          dent = {}
                                          dent[:address] = v.host.address.to_s if v.host
                                          dent[:port] = v.service.port if v.service
                                          dent[:proto] = v.service.proto if v.service
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 55 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 1304..1311

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

                                    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

                                        notes.each do |n|
                                          dent = {}
                                          dent[:address] = n.host.address.to_s if n.host
                                          dent[:port] = n.service.port if n.service
                                          dent[:proto] = n.service.proto if n.service
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 55 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 1262..1269

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

                                    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

                                          services.each do |s|
                                            vret = nil
                                            if opts[:name]
                                              vret = s.vulns.find_by_name(opts[:name])
                                            else
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 55 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 1239..1248

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

                                    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

                                            unless cred.logins.empty?
                                              login = cred.logins.first
                                              host = login.service.host.address.to_s
                                              sname = login.service.name.to_s if login.service.name.present?
                                              port = login.service.port.to_i
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 35 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 346..351

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

                                    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

                                            unless cred.logins.empty?
                                              login = cred.logins.first
                                              host = login.service.host.address.to_s
                                              sname = login.service.name.to_s if login.service.name.present?
                                              port = login.service.port.to_i
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 35 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 273..278

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

                                    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

                                          ws = {}
                                          ws[:id] = j.id
                                          ws[:name] = j.name
                                          ws[:created_at] = j.created_at.to_i
                                          ws[:updated_at] = j.updated_at.to_i
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 25 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 608..613

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

                                    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

                                          w = {}
                                          w[:name] = wspace.name
                                          w[:id] = wspace.id
                                          w[:created_at] = wspace.created_at.to_i
                                          w[:updated_at] = wspace.updated_at.to_i
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 1 other location - About 25 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 563..568

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

                                    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 rpc_report_host(xopts)
                                      ::ApplicationRecord.connection_pool.with_connection {
                                        opts, wspace = init_db_opts_workspace(xopts)
                                    
                                        res = self.framework.db.report_host(opts)
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 2 other locations - About 25 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 866..871
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 1057..1062

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

                                    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 rpc_report_client(xopts)
                                      ::ApplicationRecord.connection_pool.with_connection {
                                        opts, wspace = init_db_opts_workspace(xopts)
                                        res = self.framework.db.report_client(opts)
                                        return { :result => 'success' } if res
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 2 other locations - About 25 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 838..844
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 866..871

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

                                    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 rpc_report_service(xopts)
                                      ::ApplicationRecord.connection_pool.with_connection {
                                        opts, wspace = init_db_opts_workspace(xopts)
                                        res = self.framework.db.report_service(opts)
                                        return { :result => 'success' } if res
                                    Severity: Minor
                                    Found in lib/msf/core/rpc/v10/rpc_db.rb and 2 other locations - About 25 mins to fix
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 838..844
                                    lib/msf/core/rpc/v10/rpc_db.rb on lines 1057..1062

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

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status