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
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
- Read upRead up
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
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
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
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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
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")
- Read upRead up
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
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
- Read upRead up
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
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
- Read upRead up
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")
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|
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
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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 = []
- Read upRead up
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
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|
- Read upRead up
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
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
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 = []
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
- Read upRead up
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)
- Read upRead up
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
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...'
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
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
- Read upRead up
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
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
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",
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]"
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
- Read upRead up
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
- Read upRead up
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
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)
- Read upRead up
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
- Read upRead up
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,
- Read upRead up
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
- Read upRead up
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...'
- Read upRead up
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'
- Read upRead up
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
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return print_status(count.to_s) if output_mods[:count]
Avoid too many return
statements within this method. Open
return true
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return session.type.casecmp?(operator)
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
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
- Read upRead up
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"