修复登录失效 #168

This commit is contained in:
Jalin
2019-09-03 13:44:35 +08:00
parent 8f984cd751
commit 6e8cd9f902

View File

@@ -181,34 +181,9 @@ class UserJob:
获取加密后的浏览器特征 ID
:return:
"""
# params = {"algID": self.request_alg_id(), "timestamp": int(time.time() * 1000)}
# params = dict(params, **self._get_hash_code_params())
params = {"algID": "DSMUHpqg2c",
"hashCode": "7D2olfNltplDRYYVR5GfyPVdYWm_PQvOWVmvaWUpOJI",
"FMQw": "0",
"q4f3": "zh-CN",
"VySQ": "FGE8-ztrZHjoQKFkw9FzanJmGHUMxCjZ",
"VPIf": "1",
"custID": "133",
"VEek": "unknown",
"dzuS": "29.0 r0",
"yD16": "0",
"EOQP": "eea1c671b27b7f53fb4ed098696f3560",
"lEnu": "3232235939",
"jp76": "a5b2ffe86c07bdcd9a3445c81d946c92",
"hAqN": "Win32",
"platform": "WEB",
"ks0Q": "d82d0dd98d93e709d91f86348e2a0e86",
"TeRS": "1042x1920",
"tOHY": "24xx1080x1920",
"Fvje": "i1l1o1s1",
"q5aJ": "-8",
"wNLf": "99115dfb07133750ba677d055874de87",
"0aew": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36",
"E3gR": "c55529c990fcaabc078c4304eadf4ccb",
"timestamp": int(time.time() * 1000)}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"}
params = {"algID": self.request_alg_id(), "timestamp": int(time.time() * 1000)}
params = dict(params, **self._get_hash_code_params())
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"}
self.session.headers.update(headers)
response = self.session.get(API_GET_BROWSER_DEVICE_ID, params=params)
if response.text.find('callbackFunction') >= 0:
@@ -302,26 +277,25 @@ class UserJob:
'scrColorDepth': "qmyu"
}
data = OrderedDict(data)
data_str = ''
d = ''
params = {}
for key, item in data.items():
data_str += key + item
d += key + item
key = data_trans[key] if key in data_trans else key
params[key] = item
data_str = self._encode_data_str(data_str)
data_str_len = len(data_str)
data_str_f = int(data_str_len / 3) if data_str_len % 3 == 0 else int(data_str_len / 3) + 1
if data_str_len >= 3:
data_str = data_str[data_str_f:2 * data_str_f] + data_str[2 * data_str_f:data_str_len] + data_str[
0: data_str_f]
data_str = data_str[::-1]
data_str_tmp = ""
for e in range(0, len(data_str)):
data_str_code = ord(data_str[e])
data_str_tmp += chr(0) if data_str_code == 127 else chr(data_str_code + 1)
d_len = len(d)
d_f = int(d_len / 3) if d_len % 3 == 0 else int(d_len / 3) + 1
if d_len >= 3:
d = d[d_f:2 * d_f] + d[2 * d_f:d_len] + d[0: d_f]
d_len = len(d)
d_f = int(d_len / 3) if d_len % 3 == 0 else int(d_len / 3) + 1
if d_len >= 3:
d = d[2 * d_f:d_len] + d[0: d_f] + d[1 * d_f: 2 * d_f]
data_str = self._encode_data_str(data_str_tmp)
data_str = self._encode_string(data_str)
d = self._encode_data_str_v2(d)
d = self._encode_data_str_v2(d)
d = self._encode_data_str_v2(d)
data_str = self._encode_string(d)
params['hashCode'] = data_str
return params
@@ -334,6 +308,13 @@ class UserJob:
return data_str[2 * data_str_len_tmp:data_str_len] + data_str_e + data_str_f
return data_str
def _encode_data_str_v2(self, d):
b = len(d)
if b % 2 == 0:
return d[b // 2: b] + d[0:b // 2]
else:
return d[b // 2 + 1:b] + d[b // 2] + d[0:b // 2]
def _encode_string(self, str):
import hashlib
import base64