modules/exploits/linux/http/axis_app_install.rb
Method initialize
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Axis IP Camera Application Upload',
Method create_eap
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_eap(payload, appname)
print_status("Creating an application package named: #{appname}")
script_name = "#{Rex::Text.rand_text_alpha_lower(3..8)}.sh"
package_conf = "PACKAGENAME='#{Rex::Text.rand_text_alpha(4..14)}'\n" \
Method exploit
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def exploit
appname = Rex::Text.rand_text_alpha_lower(3)
eap = create_eap(payload.encoded, appname)
# Instruct the application to install the constructed EAP
Method exploit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def exploit
appname = Rex::Text.rand_text_alpha_lower(3)
eap = create_eap(payload.encoded, appname)
# Instruct the application to install the constructed EAP
- 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 check
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def check
# grab the brand/model. Shouldn't require authentication.
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, '/axis-cgi/prod_brand_info/getbrand.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
Avoid too many return
statements within this method. Open
Open
return CheckCode::Safe(check_comment) if res.code != 200
Avoid too many return
statements within this method. Open
Open
return CheckCode::Safe(check_comment) unless res.body.include?('<reply result="ok">') != 200