rapid7/metasploit-framework

View on GitHub
lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb

Summary

Maintainability
F
3 days
Test Coverage

File kiwi.rb has 512 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rex/post/meterpreter'

module Rex
module Post
module Meterpreter
Severity: Major
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb - About 1 day to fix

    Class Kiwi has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Console::CommandDispatcher::Kiwi
    
      Klass = Console::CommandDispatcher::Kiwi
    
      include Console::CommandDispatcher
    Severity: Minor
    Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb - About 4 hrs to fix

      Method scrape_passwords has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

        def scrape_passwords(provider, method, args)
          if args.include?('-h')
            cmd_creds_usage(provider)
            return
          end
      Severity: Minor
      Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.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 cmd_password_change has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

        def cmd_password_change(*args)
          if args.length == 0 || args.include?('-h')
            cmd_password_change_usage
            return
          end
      Severity: Minor
      Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.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 scrape_passwords has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def scrape_passwords(provider, method, args)
          if args.include?('-h')
            cmd_creds_usage(provider)
            return
          end
      Severity: Major
      Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb - About 2 hrs to fix

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

          def cmd_golden_ticket_create(*args)
        
            if args.include?("-h")
              golden_ticket_create_usage
              return
        Severity: Major
        Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb - About 2 hrs to fix

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

            def cmd_golden_ticket_create(*args)
          
              if args.include?("-h")
                golden_ticket_create_usage
                return
          Severity: Minor
          Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.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 cmd_password_change has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def cmd_password_change(*args)
              if args.length == 0 || args.include?('-h')
                cmd_password_change_usage
                return
              end
          Severity: Major
          Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb - About 2 hrs to fix

            Method report_creds has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def report_creds(type, user, domain, secret)
                if client&.db_record&.id.nil?
                  wlog('The session is not stored correctly in the database. Something went wrong.')
                  return
                end
            Severity: Minor
            Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb - About 1 hr to fix

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

                def report_creds(type, user, domain, secret)
                  if client&.db_record&.id.nil?
                    wlog('The session is not stored correctly in the database. Something went wrong.')
                    return
                  end
              Severity: Minor
              Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.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

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

                def cmd_wifi_list_shared(*args)
                  interfaces_dir = client.sys.config.getenv('AllUsersProfile') + '\Microsoft\Wlansvc\Profiles\Interfaces'
                  files = client.fs.file.search(interfaces_dir, '*.xml', true)
              
                  if files.length == 0
              Severity: Minor
              Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.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

              There are no issues that match your filters.

              Category
              Status