rapid7/metasploit-framework

View on GitHub
lib/msf/ui/console/command_dispatcher/core.rb

Summary

Maintainability
F
1 mo
Test Coverage

File core.rb has 2165 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'msf/core/opt_condition'
require 'optparse'

module Msf
module Ui
Severity: Major
Found in lib/msf/ui/console/command_dispatcher/core.rb - About 5 days to fix

    Method cmd_sessions has a Cognitive Complexity of 222 (exceeds 5 allowed). Consider refactoring.
    Open

      def cmd_sessions(*args)
        begin
        method   = nil
        quiet    = false
        show_active = false
    Severity: Minor
    Found in lib/msf/ui/console/command_dispatcher/core.rb - About 4 days 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_sessions has 361 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def cmd_sessions(*args)
        begin
        method   = nil
        quiet    = false
        show_active = false
    Severity: Major
    Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 day to fix

      Class Core has 88 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Core
      
        include Msf::Ui::Console::CommandDispatcher
        include Msf::Ui::Console::CommandDispatcher::Common
        include Msf::Ui::Console::ModuleOptionTabCompletion
      Severity: Major
      Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 day to fix

        Method cmd_set has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
        Open

          def cmd_set(*args)
            # Figure out if these are global variables
            global = false
            append = false
            clear = false
        Severity: Minor
        Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_connect has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
        Open

          def cmd_connect(*args)
            if args.length < 2 or args.include?("-h") or args.include?("--help")
              cmd_connect_help
              return false
            end
        Severity: Minor
        Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_route has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
        Open

          def cmd_route(*args)
            begin
              args << 'print' if args.length == 0
        
              action = args.shift
        Severity: Minor
        Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_connect has 150 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def cmd_connect(*args)
            if args.length < 2 or args.include?("-h") or args.include?("--help")
              cmd_connect_help
              return false
            end
        Severity: Major
        Found in lib/msf/ui/console/command_dispatcher/core.rb - About 6 hrs to fix

          Method cmd_threads has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
          Open

            def cmd_threads(*args)
              # Make the default behavior listing all jobs if there were no options
              # or the only option is the verbose flag
              if (args.length == 0 or args == ["-v"])
                args.unshift("-l")
          Severity: Minor
          Found in lib/msf/ui/console/command_dispatcher/core.rb - About 5 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_route has 118 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def cmd_route(*args)
              begin
                args << 'print' if args.length == 0
          
                action = args.shift
          Severity: Major
          Found in lib/msf/ui/console/command_dispatcher/core.rb - About 4 hrs to fix

            Method cmd_unset_with_fallbacks has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

              def cmd_unset_with_fallbacks(*args)
                if args.include?('-h') || args.include?('--help')
                  cmd_unset_help
                  return
                end
            Severity: Minor
            Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_set has 106 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def cmd_set(*args)
                # Figure out if these are global variables
                global = false
                append = false
                clear = false
            Severity: Major
            Found in lib/msf/ui/console/command_dispatcher/core.rb - About 4 hrs to fix

              Method cmd_features has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                def cmd_features(*args)
                  args << 'print' if args.empty?
              
                  action, *rest = args
                  case action
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_threads has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def cmd_threads(*args)
                  # Make the default behavior listing all jobs if there were no options
                  # or the only option is the verbose flag
                  if (args.length == 0 or args == ["-v"])
                    args.unshift("-l")
              Severity: Major
              Found in lib/msf/ui/console/command_dispatcher/core.rb - About 3 hrs to fix

                Method cmd_grep has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def cmd_grep(*args)
                    match_mods = {:insensitive => false}
                    output_mods = {:count => false, :invert => false}
                
                    opts = OptionParser.new do |opts|
                Severity: Major
                Found in lib/msf/ui/console/command_dispatcher/core.rb - About 2 hrs to fix

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

                    def validate_checkin_searches(checkin_searches)
                      checkin_searches.each do |search_term|
                        unless search_term.split(':').length == 3
                          print_error('Please only specify last_checkin, before or after, and a time. Ex: last_checkin:before:1m30s')
                          return false
                  Severity: Minor
                  Found in lib/msf/ui/console/command_dispatcher/core.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_history has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def cmd_history(*args)
                      length = Readline::HISTORY.length
                  
                      if length < @history_limit
                        limit = length
                  Severity: Minor
                  Found in lib/msf/ui/console/command_dispatcher/core.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_route_tabs has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def cmd_route_tabs(str, words)
                      if words.length == 1
                        return %w{add remove get flush print}
                      end
                  
                  
                  Severity: Minor
                  Found in lib/msf/ui/console/command_dispatcher/core.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_save has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def cmd_save(*args)
                      if args.include?('-h') || args.include?('--help')
                        cmd_save_help
                        return false
                      end
                  Severity: Minor
                  Found in lib/msf/ui/console/command_dispatcher/core.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 get_matching_sessions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def get_matching_sessions(search_term)
                      matching_sessions = {}
                      terms = search_term.split
                      id_searches = []
                      type_searches = []
                  Severity: Minor
                  Found in lib/msf/ui/console/command_dispatcher/core.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_unset_with_fallbacks has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def cmd_unset_with_fallbacks(*args)
                      if args.include?('-h') || args.include?('--help')
                        cmd_unset_help
                        return
                      end
                  Severity: Major
                  Found in lib/msf/ui/console/command_dispatcher/core.rb - About 2 hrs to fix

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

                      def cmd_grep(*args)
                        match_mods = {:insensitive => false}
                        output_mods = {:count => false, :invert => false}
                    
                        opts = OptionParser.new do |opts|
                    Severity: Minor
                    Found in lib/msf/ui/console/command_dispatcher/core.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_features has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def cmd_features(*args)
                        args << 'print' if args.empty?
                    
                        action, *rest = args
                        case action
                    Severity: Major
                    Found in lib/msf/ui/console/command_dispatcher/core.rb - About 2 hrs to fix

                      Method cmd_save has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def cmd_save(*args)
                          if args.include?('-h') || args.include?('--help')
                            cmd_save_help
                            return false
                          end
                      Severity: Major
                      Found in lib/msf/ui/console/command_dispatcher/core.rb - About 2 hrs to fix

                        Method get_matching_sessions has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def get_matching_sessions(search_term)
                            matching_sessions = {}
                            terms = search_term.split
                            id_searches = []
                            type_searches = []
                        Severity: Minor
                        Found in lib/msf/ui/console/command_dispatcher/core.rb - About 2 hrs to fix

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

                            def cmd_unset(*args)
                              if framework.features.enabled?(Msf::FeatureManager::DATASTORE_FALLBACKS)
                                return cmd_unset_with_fallbacks(*args)
                              end
                          
                          
                          Severity: Minor
                          Found in lib/msf/ui/console/command_dispatcher/core.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 filter_sessions_by_search has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def filter_sessions_by_search(search_term)
                              matching_sessions = {}
                              field, = search_term.split(':')
                              framework.sessions.each do |session_id, session|
                                if !session.respond_to?(:last_checkin) && (field == LAST_CHECKIN)
                          Severity: Minor
                          Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_history has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def cmd_history(*args)
                              length = Readline::HISTORY.length
                          
                              if length < @history_limit
                                limit = length
                          Severity: Minor
                          Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 hr to fix

                            Method cmd_repeat has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def cmd_repeat(*args)
                                looper = method :loop
                            
                                opts = OptionParser.new do |opts|
                                  opts.banner = 'Usage: repeat [OPTIONS] COMMAND...'
                            Severity: Minor
                            Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 hr to fix

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

                                def validate_checkin_searches(checkin_searches)
                                  checkin_searches.each do |search_term|
                                    unless search_term.split(':').length == 3
                                      print_error('Please only specify last_checkin, before or after, and a time. Ex: last_checkin:before:1m30s')
                                      return false
                              Severity: Minor
                              Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 hr to fix

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

                                  def verify_session(session_id, quiet = false)
                                    session = framework.sessions.get(session_id)
                                    if session
                                      if session.interactive?
                                        session
                                Severity: Minor
                                Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_unset has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def cmd_unset(*args)
                                    if framework.features.enabled?(Msf::FeatureManager::DATASTORE_FALLBACKS)
                                      return cmd_unset_with_fallbacks(*args)
                                    end
                                
                                
                                Severity: Minor
                                Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 hr to fix

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

                                    def cmd_debug(*args)
                                      if args.empty?
                                        print_line Debug.all(framework, driver)
                                        return
                                      end
                                  Severity: Minor
                                  Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 hr to fix

                                    Method commands has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def commands
                                        {
                                          "?"          => "Help menu",
                                          "banner"     => "Display an awesome metasploit banner",
                                          "cd"         => "Change the current working directory",
                                    Severity: Minor
                                    Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 hr to fix

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

                                        def cmd_route_help
                                          print_line "Route traffic destined to a given subnet through a supplied session."
                                          print_line
                                          print_line "Usage:"
                                          print_line "  route [add/remove] subnet netmask [comm/sid]"
                                      Severity: Minor
                                      Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 hr to fix

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

                                          def cmd_load_tabs(str, words)
                                            tabs = []
                                        
                                            if (not words[1] or not words[1].match(/^\//))
                                              # then let's start tab completion in the scripts/resource directories
                                        Severity: Minor
                                        Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_debug has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                          def cmd_debug(*args)
                                            if args.empty?
                                              print_line Debug.all(framework, driver)
                                              return
                                            end
                                        Severity: Minor
                                        Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_route_tabs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          def cmd_route_tabs(str, words)
                                            if words.length == 1
                                              return %w{add remove get flush print}
                                            end
                                        
                                        
                                        Severity: Minor
                                        Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 hr to fix

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

                                            def cmd_exit(*args)
                                              forced = false
                                              forced = true if (args[0] and args[0] =~ /-y/i)
                                          
                                              if(framework.sessions.length > 0 and not forced)
                                          Severity: Minor
                                          Found in lib/msf/ui/console/command_dispatcher/core.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 cmd_spool has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            def cmd_spool(*args)
                                              if args.include?('-h') or args.empty?
                                                cmd_spool_help
                                                return
                                              end
                                          Severity: Minor
                                          Found in lib/msf/ui/console/command_dispatcher/core.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 load_plugin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            def load_plugin(args)
                                              path = args[0]
                                          
                                              opts  = {
                                                'LocalInput'    => driver.input,
                                          Severity: Minor
                                          Found in lib/msf/ui/console/command_dispatcher/core.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

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

                                            def cmd_get(*args)
                                          
                                              # Figure out if these are global variables
                                              global = false
                                          
                                          
                                          Severity: Minor
                                          Found in lib/msf/ui/console/command_dispatcher/core.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

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

                                            def cmd_repeat(*args)
                                              looper = method :loop
                                          
                                              opts = OptionParser.new do |opts|
                                                opts.banner = 'Usage: repeat [OPTIONS] COMMAND...'
                                          Severity: Minor
                                          Found in lib/msf/ui/console/command_dispatcher/core.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

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

                                            def cmd_set_tabs(str, words)
                                              # A value has already been specified
                                              if words.length > 3
                                                return []
                                              elsif words.length == 3 and words[1] != '-g' and words[1] != '--global'
                                          Severity: Minor
                                          Found in lib/msf/ui/console/command_dispatcher/core.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 false
                                          Severity: Major
                                          Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                    return false
                                            Severity: Major
                                            Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                  return print_status(count.to_s) if output_mods[:count]
                                              Severity: Major
                                              Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                      return true
                                                Severity: Major
                                                Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                            return false
                                                  Severity: Major
                                                  Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                            return false
                                                    Severity: Major
                                                    Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                              return false
                                                      Severity: Major
                                                      Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                  return false
                                                        Severity: Major
                                                        Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                    return false
                                                          Severity: Major
                                                          Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                    return false
                                                            Severity: Major
                                                            Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                      return false
                                                              Severity: Major
                                                              Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                        return false
                                                                Severity: Major
                                                                Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                          return false
                                                                  Severity: Major
                                                                  Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                          return session.type.casecmp?(operator)
                                                                    Severity: Major
                                                                    Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                            return false
                                                                      Severity: Major
                                                                      Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                  return false
                                                                        Severity: Major
                                                                        Found in lib/msf/ui/console/command_dispatcher/core.rb - About 30 mins to fix

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

                                                                            def evaluate_search_criteria(session, search_term)
                                                                              field, operator, value = search_term.split(':')
                                                                          
                                                                              case field
                                                                              when LAST_CHECKIN
                                                                          Severity: Minor
                                                                          Found in lib/msf/ui/console/command_dispatcher/core.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