rapid7/metasploit-framework

View on GitHub
modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.rb

Summary

Maintainability
D
2 days
Test Coverage

File tplink_archer_a7_c7_lan_rce.rb has 347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'openssl'

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

Severity: Minor
Found in modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.rb - About 4 hrs to fix

    Method calc_checksum has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def calc_checksum(packet)
        # reference table used to calculate the packet checksum
        # used by tdpd_pkt_calc_checksum (0x4037f0)
        # located at offset 0x0416e90 in the binary
        reference_tbl = [
    Severity: Major
    Found in modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.rb - About 3 hrs to fix

      Method exploit has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def exploit
          if ((datastore['SRVHOST'] == '0.0.0.0') || (datastore['SRVHOST'] == '::'))
            fail_with(Failure::Unreachable, "#{peer} - Please specify the LAN IP address of this computer in SRVHOST")
          end
      
      
      Severity: Major
      Found in modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.rb - About 2 hrs to fix

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

          def initialize(info = {})
            super(
              update_info(
                info,
                'Name' => 'TP-Link Archer A7/C7 Unauthenticated LAN Remote Code Execution',
        Severity: Major
        Found in modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.rb - About 2 hrs to fix

          Method exploit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def exploit
              if ((datastore['SRVHOST'] == '0.0.0.0') || (datastore['SRVHOST'] == '::'))
                fail_with(Failure::Unreachable, "#{peer} - Please specify the LAN IP address of this computer in SRVHOST")
              end
          
          
          Severity: Minor
          Found in modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.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 check has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def check
              vuln_versions = [
                # older versions not listed here are also vulnerable
                'app.1575358240615.manifest',   # A7 191203
                'app.1582117229115.manifest',   # A7 200220
          Severity: Minor
          Found in modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.rb - About 1 hr to fix

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

              def check
                vuln_versions = [
                  # older versions not listed here are also vulnerable
                  'app.1575358240615.manifest',   # A7 191203
                  'app.1582117229115.manifest',   # A7 200220
            Severity: Minor
            Found in modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.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