Closed swwgames closed 7 months ago
Thank you very much! I have one comment for encrypted password only
Does this steps works for you to get the hashedPassword ?
document.getElementById("login-password").value;
or document.getElementById("pcPassword").value;
, depending on your firmware version.yes that worked, document.getElementById("login-password").value; gave me the value. What do I need to do now?
@swwgames Hi. Could you test please v3.4.0?
no that version doesn't work. what i needed to change for it to work was:
class TplinkC1200Router(TplinkBaseRouter):
def supports(self) -> bool:
return True
def authorize(self) -> None:
if len(self.password) < 200:
raise Exception('You need to use web encrypted password instead. Check the documentation!')
url = '{}/cgi-bin/luci/;stok=/login?form=login'.format(self.host)
response = requests.post(
url,
params={'operation': 'login', 'username': self.username, 'password': self.password},
#headers={'Referer': self._login_referer, 'Content-Type': 'application/x-www-form-urlencoded'},
timeout=self.timeout,
verify=self._verify_ssl,
)
Here i removed the headers. the _login_referer is empty so it did not work.
And Here i removed the &operation=read
class TplinkBaseRouter(AbstractRouter, TplinkRequest):
def __init__(self, host: str, password: str, username: str = 'admin', logger: Logger = None,
verify_ssl: bool = True, timeout: int = 10) -> None:
super().__init__(host, password, username, logger, verify_ssl, timeout)
self._url_firmware = 'admin/firmware?form=upgrade&operation=read'
self._url_wireless_stats = 'admin/wireless?form=statistics'
self._url_ipv4_reservations = 'admin/dhcps?form=reservation&operation=load'
self._url_ipv4_dhcp_leases = 'admin/dhcps?form=client&operation=load'
i also needed to change in the baserouter class in the get_status the operation from read to load.
for item in self.request(self._url_wireless_stats, 'operation=load'):
if item['mac'] not in devices:
status.wifi_clients_total += 1
type = self._map_wire_type(item.get('type'))
devices[item['mac']] = Device(type, macaddress.EUI48(item['mac']), ipaddress.IPv4Address('0.0.0.0'), '')
devices[item['mac']].packets_sent = item.get('txpkts')
devices[item['mac']].packets_received = item.get('rxpkts')
first it was sending twice operation read, now it only sends operation load. and i get the data.
feel free to ask further questions.
@swwgames Thank you! I have fixed it. Could you try v3.4.3 and let me know please?
Yes it works!
@swwgames Thank you!
Added Support for TP-link C1200 The main difference is the login process, the C1200 doesn't expose its encryption keys.