rapid7/metasploit-framework

View on GitHub
modules/exploits/multi/http/atutor_sqli.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method generate_sql_and_test has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def generate_sql_and_test(do_true=false, do_test=false, sql=nil)
    if do_test
      if do_true
        result = perform_request("1=1")
        if result =~ /There are \d+ entries\./
Severity: Minor
Found in modules/exploits/multi/http/atutor_sqli.rb - About 1 hr to fix

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 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info={})
    super(update_info(info,
      'Name'           => 'ATutor 2.2.1 SQL Injection / Remote Code Execution',
      'Description'    => %q{
         This module exploits a SQL Injection vulnerability and an authentication weakness
Severity: Minor
Found in modules/exploits/multi/http/atutor_sqli.rb - About 1 hr to fix

    Method upload_shell has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def upload_shell(cookie)
        post_data = Rex::MIME::Message.new
        post_data.add_part(create_zip_file, 'archive/zip', nil, "form-data; name=\"modulefile\"; filename=\"#{@plugin_name}.zip\"")
        post_data.add_part("#{Rex::Text.rand_text_alpha_upper(4)}", nil, nil, "form-data; name=\"install_upload\"")
        data = post_data.to_s
    Severity: Minor
    Found in modules/exploits/multi/http/atutor_sqli.rb - About 1 hr to fix

      Method get_ascii_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_ascii_value(sql)
          lower = 0
          upper = 126
          while lower < upper
             mid = (lower + upper) / 2
      Severity: Minor
      Found in modules/exploits/multi/http/atutor_sqli.rb - About 55 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status