rapid7/metasploit-framework

View on GitHub
modules/post/windows/gather/credentials/gpp.rb

Summary

Maintainability
D
2 days
Test Coverage

Method run has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    group_path = 'MACHINE\\Preferences\\Groups\\Groups.xml'
    group_path_user = 'USER\\Preferences\\Groups\\Groups.xml'
    service_path = 'MACHINE\\Preferences\\Services\\Services.xml'
    printer_path = 'USER\\Preferences\\Printers\\Printers.xml'
Severity: Minor
Found in modules/post/windows/gather/credentials/gpp.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

File gpp.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Post
  include Msf::Auxiliary::Report
  include Msf::Post::File
  include Msf::Post::Windows::ExtAPI
  include Msf::Post::Windows::Priv
Severity: Minor
Found in modules/post/windows/gather/credentials/gpp.rb - About 3 hrs to fix

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

      def run
        group_path = 'MACHINE\\Preferences\\Groups\\Groups.xml'
        group_path_user = 'USER\\Preferences\\Groups\\Groups.xml'
        service_path = 'MACHINE\\Preferences\\Services\\Services.xml'
        printer_path = 'USER\\Preferences\\Printers\\Printers.xml'
    Severity: Major
    Found in modules/post/windows/gather/credentials/gpp.rb - About 3 hrs to fix

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

        def get_basepaths(base, cached = false)
          locals = []
          begin
            session.fs.dir.foreach(base) do |sub|
              next if sub =~ /^(\.|\.\.)$/
      Severity: Minor
      Found in modules/post/windows/gather/credentials/gpp.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 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize(info = {})
          super(
            update_info(
              info,
              'Name' => 'Windows Gather Group Policy Preference Saved Passwords',
      Severity: Minor
      Found in modules/post/windows/gather/credentials/gpp.rb - About 1 hr to fix

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

          def gpp_xml_file(path)
            data = read_file(path)
        
            spath = path.split('\\')
            retobj = {
        Severity: Minor
        Found in modules/post/windows/gather/credentials/gpp.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 get_domain_reg has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_domain_reg
            locations = []
            # Lots of redundancy but hey this is quick!
            locations << ['HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\', 'Domain']
            locations << ['HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\', 'DefaultDomainName']
        Severity: Minor
        Found in modules/post/windows/gather/credentials/gpp.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

        There are no issues that match your filters.

        Category
        Status