File readable_text.rb
has 731 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Msf
module Serializer
# This class formats information in a plain-text format that
# is meant to be displayed on a console or some other non-GUI
Method dump_jobs
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def self.dump_jobs(framework, verbose = false, indent = DefaultIndent, col = DefaultColumnWrap)
columns = [ 'Id', 'Name', "Payload", "Payload opts"]
if (verbose)
columns += [ "URIPATH", "Start Time", "Handler opts", "Persist" ]
- 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 dump_sessions
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def self.dump_sessions(framework, opts={})
output = ""
verbose = opts[:verbose] || false
sessions = opts[:sessions] || framework.sessions
show_active = opts[: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
Class ReadableText
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class ReadableText
#Default number of characters to wrap at.
DefaultColumnWrap = 70
#Default number of characters to indent.
Method options_table
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def self.options_table(missing, mod, options, indent)
tbl = Rex::Text::Table.new(
'Indent' => indent.length,
'Columns' =>
[
- 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 dump_sessions_verbose
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def self.dump_sessions_verbose(framework, opts={})
out = "Active sessions\n" +
"===============\n\n"
if framework.sessions.length == 0
- 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 dump_jobs
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.dump_jobs(framework, verbose = false, indent = DefaultIndent, col = DefaultColumnWrap)
columns = [ 'Id', 'Name', "Payload", "Payload opts"]
if (verbose)
columns += [ "URIPATH", "Start Time", "Handler opts", "Persist" ]
Method dump_sessions
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.dump_sessions(framework, opts={})
output = ""
verbose = opts[:verbose] || false
sessions = opts[:sessions] || framework.sessions
show_active = opts[:show_active] || false
Method dump_sessions_verbose
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.dump_sessions_verbose(framework, opts={})
out = "Active sessions\n" +
"===============\n\n"
if framework.sessions.length == 0
Method create_msf_session_row
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.create_msf_session_row(session, show_extended)
row = []
row << session.sid.to_s
row << session.sname.to_s
row << session.type.to_s
- 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 dump_exploit_module
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.dump_exploit_module(mod, indent = '')
output = "\n"
output << " Name: #{mod.name}\n"
output << " Module: #{mod.fullname}\n"
output << " Platform: #{mod.platform_to_s}\n"
Method dump_post_module
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.dump_post_module(mod, indent = '')
output = "\n"
output << " Name: #{mod.name}\n"
output << " Module: #{mod.fullname}\n"
output << " Platform: #{mod.platform_to_s}\n"
Method options_table
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.options_table(missing, mod, options, indent)
tbl = Rex::Text::Table.new(
'Indent' => indent.length,
'Columns' =>
[
Method create_msf_session_row
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_msf_session_row(session, show_extended)
row = []
row << session.sid.to_s
row << session.sname.to_s
row << session.type.to_s
Method dump_exploit_module
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.dump_exploit_module(mod, indent = '')
output = "\n"
output << " Name: #{mod.name}\n"
output << " Module: #{mod.fullname}\n"
output << " Platform: #{mod.platform_to_s}\n"
- 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 word_wrap_description
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.word_wrap_description(str, indent = '')
return '' if str.blank?
str_lines = str.strip.lines(chomp: true)
# Calculate the preceding whitespace length of each line
- 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 dump_notes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.dump_notes(mod, indent = '')
output = ''
mod.notes.each do |name, val|
next unless val.present?
Method dump_auxiliary_module
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.dump_auxiliary_module(mod, indent = '')
output = "\n"
output << " Name: #{mod.name}\n"
output << " Module: #{mod.fullname}\n"
output << " License: #{mod.license}\n"
Method dump_notes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.dump_notes(mod, indent = '')
output = ''
mod.notes.each do |name, val|
next unless val.present?
- 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 dump_references
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.dump_references(mod, indent = '')
output = ''
if (mod.respond_to?(:references) && mod.references && mod.references.length > 0)
output << "References:\n"
- 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 dump_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.dump_options(mod, indent = '', missing = false, advanced: false, evasion: false)
filtered_options = mod.options.values.select { |opt| opt.advanced? == advanced && opt.evasion? == evasion }
option_groups = mod.options.groups.map { |_name, group| group }.sort_by(&:name)
options_by_group = option_groups.map do |group|
- 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 dump_post_module(mod, indent)
Avoid too many return
statements within this method. Open
return dump_auxiliary_module(mod, indent)
Avoid too many return
statements within this method. Open
return dump_evasion_module(mod, indent)
Avoid too many return
statements within this method. Open
return dump_generic_module(mod, indent)
Method dump_traits
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.dump_traits(mod, indent=' ')
output = ''
unless mod.side_effects.empty?
output << "Module side effects:\n"
- 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 dump_evasion_module
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.dump_evasion_module(mod, indent = '')
output = "\n"
output << " Name: #{mod.name}\n"
output << " Module: #{mod.fullname}\n"
output << " Platform: #{mod.platform_to_s}\n"
- 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"