rapid7/metasploit-framework

View on GitHub
modules/auxiliary/gather/android_htmlfileprovider.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method on_request_uri has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def on_request_uri(cli, request)
    print_status("Request '#{request.method} #{request.uri}'")
    selected_headers = [ 'user-agent', 'origin', 'referer' ]
    request.headers.each_key { |k|
      next if not selected_headers.include? k.downcase
Severity: Major
Found in modules/auxiliary/gather/android_htmlfileprovider.rb - About 3 hrs to fix

    Method process_post has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def process_post(cli, request)
    
        results = {}
    
        if request and request.body
    Severity: Minor
    Found in modules/auxiliary/gather/android_htmlfileprovider.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 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def initialize(info = {})
        super(update_info(info,
          'Name'        => 'Android Content Provider File Disclosure',
          'Description' => %q{
              This module exploits a cross-domain issue within the Android web browser to
    Severity: Minor
    Found in modules/auxiliary/gather/android_htmlfileprovider.rb - About 1 hr to fix

      Method process_post has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def process_post(cli, request)
      
          results = {}
      
          if request and request.body
      Severity: Minor
      Found in modules/auxiliary/gather/android_htmlfileprovider.rb - About 1 hr to fix

        Method on_request_uri has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def on_request_uri(cli, request)
            print_status("Request '#{request.method} #{request.uri}'")
            selected_headers = [ 'user-agent', 'origin', 'referer' ]
            request.headers.each_key { |k|
              next if not selected_headers.include? k.downcase
        Severity: Minor
        Found in modules/auxiliary/gather/android_htmlfileprovider.rb - About 45 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