Skip to content

Commit

Permalink
Update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyKh committed May 5, 2020
1 parent 16b92f5 commit 687ee47
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions custom_components/tplink_router/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
import hashlib
import logging
import re
from Crypto.PublicKey.RSA import construct
from Crypto.Cipher import PKCS1_v1_5
import binascii
import string, random
import time
import requests


from aiohttp.hdrs import (
ACCEPT,
Expand Down Expand Up @@ -549,12 +556,12 @@ def _get_jsession_id(self):
username = self.username.encode('utf-8')
password = self.password.encode('utf-8')

b64pass = b64encode(password)
b64pass = base64.b64encode(password)
encryptedUsername = self.pubkey.encrypt(username)
encryptedPassword = self.pubkey.encrypt(b64pass)

base16username = b16encode(encryptedUsername).decode('utf-8').lower()
base16password = b16encode(encryptedPassword).decode('utf-8').lower()
base16username = base64.b16encode(encryptedUsername).decode('utf-8').lower()
base16password = base64.b16encode(encryptedPassword).decode('utf-8').lower()

referer = 'http:https://{}'.format(self.host)
url = 'http:https://{}/cgi/login?UserName={}&Passwd={}&Action=1&LoginStatus=0'.format(self.host, base16username, base16password)
Expand Down

0 comments on commit 687ee47

Please sign in to comment.