rapid7/metasploit-framework

View on GitHub
lib/msf/core/exploit.rb

Summary

Maintainability
F
6 days
Test Coverage

File exploit.rb has 785 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Msf



###
Severity: Major
Found in lib/msf/core/exploit.rb - About 1 day to fix

    Class Exploit has 77 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Exploit < Msf::Module
    
    ##
      # Exceptions
      ##
    Severity: Major
    Found in lib/msf/core/exploit.rb - About 1 day to fix

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

        def self.mixins
          mixins  = []
          wl      = [ Msf::Exploit ]
          visited = {}
      
      
      Severity: Minor
      Found in lib/msf/core/exploit.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 handle_exception has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def handle_exception e
          msg = setup_fail_detail_from_exception e
      
          case e
            when Msf::Exploit::Complete
      Severity: Major
      Found in lib/msf/core/exploit.rb - About 2 hrs to fix

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

          def initialize(info = {})
        
            # Ghetto compat mirroring for payload compatibilities.  This mirrors
            #
            # Payload => Compat => xyz
        Severity: Minor
        Found in lib/msf/core/exploit.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 generate_single_payload has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def generate_single_payload(pinst = nil, platform = nil, arch = nil, explicit_target = nil)
            explicit_target ||= target
        
            if (explicit_target == nil)
              raise MissingTargetError, "No target has been specified.",
        Severity: Minor
        Found in lib/msf/core/exploit.rb - About 1 hr to fix

          Method generate_single_payload has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            def generate_single_payload(pinst = nil, platform = nil, arch = nil, explicit_target = nil)
              explicit_target ||= target
          
              if (explicit_target == nil)
                raise MissingTargetError, "No target has been specified.",
          Severity: Minor
          Found in lib/msf/core/exploit.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 initialize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def initialize(info = {})
          
              # Ghetto compat mirroring for payload compatibilities.  This mirrors
              #
              # Payload => Compat => xyz
          Severity: Minor
          Found in lib/msf/core/exploit.rb - About 1 hr to fix

            Method make_nops has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def make_nops(count)
                # If we're debugging, then make_nops will return a safe sled.  We
                # currently assume x86.
                if debugging?
                  return "\x90" * count
            Severity: Minor
            Found in lib/msf/core/exploit.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 stack_adjustment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def stack_adjustment
                if target && target.payload_stack_adjustment
                  adj = target.payload_stack_adjustment
                else
                  adj = payload_info['StackAdjustment']
            Severity: Minor
            Found in lib/msf/core/exploit.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 handle_exception has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def handle_exception e
                msg = setup_fail_detail_from_exception e
            
                case e
                  when Msf::Exploit::Complete
            Severity: Minor
            Found in lib/msf/core/exploit.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 make_nops has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def make_nops(count)
                # If we're debugging, then make_nops will return a safe sled.  We
                # currently assume x86.
                if debugging?
                  return "\x90" * count
            Severity: Minor
            Found in lib/msf/core/exploit.rb - About 1 hr to fix

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

                def target
                  if self.respond_to?(:auto_targeted_index)
                    if auto_target?
                      auto_idx = auto_targeted_index
                      if auto_idx.present?
              Severity: Minor
              Found in lib/msf/core/exploit.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 report_failure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def report_failure
                  return unless framework.db and framework.db.active
              
                  info = {
                    :timestamp   => Time.now.utc,
              Severity: Minor
              Found in lib/msf/core/exploit.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 target_index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def target_index
                  target_idx =
                    begin
                      Integer(datastore['TARGET'])
                    rescue TypeError, ArgumentError
              Severity: Minor
              Found in lib/msf/core/exploit.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 is_payload_compatible? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def is_payload_compatible?(name)
                  p = framework.payloads[name]
                  return false unless p
              
                  # Skip over payloads that are too big
              Severity: Minor
              Found in lib/msf/core/exploit.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 normalize_platform_arch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def normalize_platform_arch
                  c_platform = (target && target.platform) ? target.platform : platform
                  c_arch     = (target && target.arch)     ? target.arch     : (arch == []) ? nil : arch
                  c_arch   ||= [ ARCH_X86 ]
                  return c_platform, c_arch
              Severity: Minor
              Found in lib/msf/core/exploit.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 true
              Severity: Major
              Found in lib/msf/core/exploit.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return false if !self.privileged && pi.privileged
                Severity: Major
                Found in lib/msf/core/exploit.rb - About 30 mins to fix

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

                      if info.key? 'DefaultTarget'
                        self.default_target = info['DefaultTarget']
                      else
                        self.default_target = 0
                        # Add an auto-target to the exploit if it doesn't have one
                  Severity: Major
                  Found in lib/msf/core/exploit.rb and 1 other location - About 1 hr to fix
                  lib/msf/core/evasion.rb on lines 23..34

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

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                    def compatible_payloads(excluded_platforms: [], excluded_archs: [])
                      payloads = []
                  
                      c_platform, c_arch = normalize_platform_arch
                  
                  
                  Severity: Major
                  Found in lib/msf/core/exploit.rb and 1 other location - About 1 hr to fix
                  lib/msf/core/evasion.rb on lines 126..144

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

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                    def target_index
                      target_idx =
                        begin
                          Integer(datastore['TARGET'])
                        rescue TypeError, ArgumentError
                  Severity: Major
                  Found in lib/msf/core/exploit.rb and 1 other location - About 1 hr to fix
                  lib/msf/core/evasion.rb on lines 301..318

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

                  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 (info['Payload'] and info['Payload']['Compat'])
                        info['Compat'] = Hash.new if (info['Compat'] == nil)
                        info['Compat']['Payload'] = Hash.new if (info['Compat']['Payload'] == nil)
                        info['Compat']['Payload'].update(info['Payload']['Compat'])
                      end
                  Severity: Major
                  Found in lib/msf/core/exploit.rb and 1 other location - About 1 hr to fix
                  lib/msf/core/evasion.rb on lines 12..16

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

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                    def normalize_platform_arch
                      c_platform = (target && target.platform) ? target.platform : platform
                      c_arch     = (target && target.arch)     ? target.arch     : (arch == []) ? nil : arch
                      c_arch   ||= [ ARCH_X86 ]
                      return c_platform, c_arch
                  Severity: Minor
                  Found in lib/msf/core/exploit.rb and 1 other location - About 35 mins to fix
                  lib/msf/core/evasion.rb on lines 90..94

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

                  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 real_payload.kind_of?(Msf::Payload::Generic)
                        # Convert the architecture specified into an array.
                        if arch and arch.kind_of?(String)
                          arch = [ arch ]
                        end
                  Severity: Minor
                  Found in lib/msf/core/exploit.rb and 1 other location - About 30 mins to fix
                  lib/msf/core/evasion.rb on lines 203..220

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

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                    def define_context_encoding_reqs(reqs)
                      return unless datastore['EnableContextEncoding']
                  
                      # At present, we don't support any automatic methods of obtaining
                      # context information.  In the future, we might support obtaining
                  Severity: Minor
                  Found in lib/msf/core/exploit.rb and 1 other location - About 30 mins to fix
                  lib/msf/core/evasion.rb on lines 262..273

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

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                    def target
                      if self.respond_to?(:auto_targeted_index)
                        if auto_target?
                          auto_idx = auto_targeted_index
                          if auto_idx.present?
                  Severity: Minor
                  Found in lib/msf/core/exploit.rb and 1 other location - About 30 mins to fix
                  lib/msf/core/evasion.rb on lines 283..299

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

                  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

                        when Rex::ConnectionError
                          self.fail_reason = Msf::Exploit::Failure::Unreachable
                          self.print_error("Exploit failed [#{self.fail_reason}]: #{msg}")
                          elog("Exploit failed (#{self.refname}): #{msg}", error: e)
                  Severity: Minor
                  Found in lib/msf/core/exploit.rb and 2 other locations - About 25 mins to fix
                  lib/msf/core/exploit.rb on lines 1406..1409
                  lib/msf/core/exploit.rb on lines 1411..1414

                  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

                        when Rex::BindFailed
                          self.fail_reason = Msf::Exploit::Failure::BadConfig
                          self.print_error("Exploit failed [#{self.fail_reason}]: #{msg}")
                          elog("Exploit failed (#{self.refname}): #{msg}", error: e)
                  Severity: Minor
                  Found in lib/msf/core/exploit.rb and 2 other locations - About 25 mins to fix
                  lib/msf/core/exploit.rb on lines 1401..1404
                  lib/msf/core/exploit.rb on lines 1411..1414

                  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

                        when Timeout::Error
                          self.fail_reason = Msf::Exploit::Failure::TimeoutExpired
                          self.print_error("Exploit failed [#{self.fail_reason}]: #{msg}")
                          elog("Exploit failed (#{self.refname}): #{msg}", error: e)
                  Severity: Minor
                  Found in lib/msf/core/exploit.rb and 2 other locations - About 25 mins to fix
                  lib/msf/core/exploit.rb on lines 1401..1404
                  lib/msf/core/exploit.rb on lines 1406..1409

                  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

                  There are no issues that match your filters.

                  Category
                  Status