File struts_default_action_mapper.rb
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer
Method initialize
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Apache Struts 2 DefaultActionMapper Prefixes OGNL Code Execution',
Method exploit_linux
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit_linux
downfile = rand_text_alpha(8 + rand(8))
@pl = @exe
@pl_sent = false
Method on_new_session
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def on_new_session(session)
if session.type == "meterpreter"
session.core.use("stdapi") unless session.ext.aliases.include?("stdapi")
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 build_hta
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_hta
var_shellobj = rand_text_alpha(rand(5) + 5);
var_fsobj = rand_text_alpha(rand(5) + 5);
var_fsobj_file = rand_text_alpha(rand(5) + 5);
var_vbsname = rand_text_alpha(rand(5) + 5);
Method exploit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def exploit
if target.name =~ /Automatic/
print_status("#{rhost}:#{rport} - Target autodetection...")
my_target = auto_target
print_good("#{rhost}:#{rport} - #{my_target.name} target found!")
- 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 auto_target
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def auto_target
uri = normalize_uri(target_uri.path)
res = send_request_cgi({
'uri' => uri,
'method' => 'GET'
- 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 exploit_linux
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def exploit_linux
downfile = rand_text_alpha(8 + rand(8))
@pl = @exe
@pl_sent = 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"