modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.rb
File tplink_archer_a7_c7_lan_rce.rb
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'openssl'
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
Method calc_checksum
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 = [
Method exploit
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method initialize
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'TP-Link Archer A7/C7 Unauthenticated LAN Remote Code Execution',
Method exploit
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
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
- 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 check
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def check
vuln_versions = [
# older versions not listed here are also vulnerable
'app.1575358240615.manifest', # A7 191203
'app.1582117229115.manifest', # A7 200220
Method check
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def check
vuln_versions = [
# older versions not listed here are also vulnerable
'app.1575358240615.manifest', # A7 191203
'app.1582117229115.manifest', # A7 200220
- 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"