File chaos_rat_xss_to_rce.rb
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
prepend Msf::Exploit::Remote::AutoCheck
include Msf::Exploit::Remote::HttpClient
Method exploit
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def exploit
unless (datastore['USERNAME'] && datastore['PASSWORD']) ||
datastore['JWT'] ||
datastore['AGENT']
fail_with(Failure::BadConfig, 'Username and password, or JWT, or AGENT path required')
- 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 initialize
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Chaos RAT XSS to RCE',
Method exploit
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
unless (datastore['USERNAME'] && datastore['PASSWORD']) ||
datastore['JWT'] ||
datastore['AGENT']
fail_with(Failure::BadConfig, 'Username and password, or JWT, or AGENT path required')
Method start_http_service
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_http_service(opts = {})
# Start a new HTTP server
@http_service = Rex::ServiceManager.start(
Rex::Proto::Http::Server,
(opts['ServerPort'] || bindport).to_i,
Method agent_callback_checkin
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def agent_callback_checkin(cookie)
start_time = Time.now.to_i
while Time.now.to_i < start_time + datastore['WfsDelay']
print_status('Performing Callback Checkin')
res = send_request_cgi(
Method agent_callback_checkin
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def agent_callback_checkin(cookie)
start_time = Time.now.to_i
while Time.now.to_i < start_time + datastore['WfsDelay']
print_status('Performing Callback Checkin')
res = send_request_cgi(
- 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 list_agents
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_agents(cookie)
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, 'devices'),
'headers' => {
'cookie' => "jwt=#{cookie}"
Method agent_command_handler
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def agent_command_handler(cookie)
vprint_status('WebSocket connecting to receive commands')
headers = {
'Cookie' => "jwt=#{cookie}",
'X-Client' => mac_address
Method start_http_service
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def start_http_service(opts = {})
# Start a new HTTP server
@http_service = Rex::ServiceManager.start(
Rex::Proto::Http::Server,
(opts['ServerPort'] || bindport).to_i,
- 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 agent_command_handler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def agent_command_handler(cookie)
vprint_status('WebSocket connecting to receive commands')
headers = {
'Cookie' => "jwt=#{cookie}",
'X-Client' => mac_address
- 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"