Fix TP-Link Archer C7 long passwords (#3225)
* Fix tplink C7 long passwords Fixes an issue where passwords longer than 15 chars could not log in to Archer C7 routers. * Truncate in correct place * Add comment about TP-Link C7 pass truncation * Fix lint error * Truncate comment at 79 chars not 80pull/3304/head
parent
de150ecbc9
commit
8438001942
|
@ -277,8 +277,10 @@ class Tplink4DeviceScanner(TplinkDeviceScanner):
|
|||
_LOGGER.info("Retrieving auth tokens...")
|
||||
url = 'http://{}/userRpm/LoginRpm.htm?Save=Save'.format(self.host)
|
||||
|
||||
# Generate md5 hash of password
|
||||
password = hashlib.md5(self.password.encode('utf')).hexdigest()
|
||||
# Generate md5 hash of password. The C7 appears to use the first 15
|
||||
# characters of the password only, so we truncate to remove additional
|
||||
# characters from being hashed.
|
||||
password = hashlib.md5(self.password.encode('utf')[:15]).hexdigest()
|
||||
credentials = '{}:{}'.format(self.username, password).encode('utf')
|
||||
|
||||
# Encode the credentials to be sent as a cookie.
|
||||
|
|
Loading…
Reference in New Issue