File browser_exploit_server.rb
has 477 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'erb'
require 'cgi'
require 'date'
require 'set'
require 'rex/exploitation/js'
Method get_detection_html
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_detection_html(user_agent)
ua_info = fingerprint_user_agent(user_agent)
os = ua_info[:os_name]
client = ua_info[:ua_name]
Method on_request_uri
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def on_request_uri(cli, request)
case request.uri
when '/', get_resource.chomp("/")
#
# This is the information gathering stage
- 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_bad_requirements
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def get_bad_requirements(profile)
bad_reqs = []
@requirements.each do |rk, v|
k = rk.to_sym
expected = k != :vuln_test ? v : 'true'
- 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 on_request_uri
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_request_uri(cli, request)
case request.uri
when '/', get_resource.chomp("/")
#
# This is the information gathering stage
Method try_set_target
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def try_set_target(profile)
return unless self.respond_to?(:targets)
match_counts = []
target_requirements = {}
targets.each do |t|
- 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 process_browser_info
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_browser_info(source, cli, request)
tag = retrieve_tag(cli, request)
browser_profile[tag] ||= {}
profile = browser_profile[tag]
Avoid deeply nested control flow statements. Open
bad_reqs << k unless v.call(profile[k])
Avoid deeply nested control flow statements. Open
bad_reqs << k if profile[k] != v
Avoid deeply nested control flow statements. Open
if error_string.present?
print_warning(error_string)
end
Method process_browser_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_browser_info(source, cli, request)
tag = retrieve_tag(cli, request)
browser_profile[tag] ||= {}
profile = browser_profile[tag]
- 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"