rapid7/metasploit-framework

View on GitHub
modules/exploits/linux/http/xplico_exec.rb

Summary

Maintainability
C
1 day
Test Coverage

File xplico_exec.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient

Severity: Minor
Found in modules/exploits/linux/http/xplico_exec.rb - About 2 hrs to fix

    Method register_user has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def register_user(username, password)
        # First thing first, we need to get csrf token from registration form.
        print_status('Registering a new user')
    
        res = send_request_cgi(
    Severity: Major
    Found in modules/exploits/linux/http/xplico_exec.rb - About 2 hrs to fix

      Method initialize has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize(info={})
          super(update_info(info,
            'Name'           => 'Xplico Remote Code Execution',
            'Description'    => %q{
              This module exploits command injection vulnerability. Unauthenticated users can register a new account and then execute a terminal
      Severity: Minor
      Found in modules/exploits/linux/http/xplico_exec.rb - About 1 hr to fix

        Method upload_pcap has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def upload_pcap(sol_id)
            print_status('Uploading malformed PCAP file')
            # We are hitting this end-point so we can access sol_id through session on server-side.
            send_request_cgi!(
              'method' => 'GET',
        Severity: Minor
        Found in modules/exploits/linux/http/xplico_exec.rb - About 1 hr to fix

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

            def upload_pcap(sol_id)
              print_status('Uploading malformed PCAP file')
              # We are hitting this end-point so we can access sol_id through session on server-side.
              send_request_cgi!(
                'method' => 'GET',
          Severity: Minor
          Found in modules/exploits/linux/http/xplico_exec.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 login has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def login(username, password)
              # yet another csrf token gathering.
              print_status('Authenticating with our activated new user')
              res = send_request_cgi(
                'method' => 'GET',
          Severity: Minor
          Found in modules/exploits/linux/http/xplico_exec.rb - About 1 hr to fix

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

              def register_user(username, password)
                # First thing first, we need to get csrf token from registration form.
                print_status('Registering a new user')
            
                res = send_request_cgi(
            Severity: Minor
            Found in modules/exploits/linux/http/xplico_exec.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

            Method login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def login(username, password)
                # yet another csrf token gathering.
                print_status('Authenticating with our activated new user')
                res = send_request_cgi(
                  'method' => 'GET',
            Severity: Minor
            Found in modules/exploits/linux/http/xplico_exec.rb - About 35 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