import time
import random
import base64
import hashlib
import requests
from Crypto.Cipher import AES
def join_md5(string, token):
input_string = token + string
md5_obj = hashlib.md5()
md5_obj.update(input_string.encode('utf-8'))
md5_hash = md5_obj.hexdigest()
return "d" + md5_hash
def cxor(string, token):
string_array = bytearray(string.encode())
token_array = bytearray(token.encode())
results = ""
for i in range(len(token)):
results += chr((string_array[i] ^ token_array[i]) % 26 + 97)
return "c" + results
def unpad(s):
last_num = s[-1]
text = s[:-last_num]
return text
def aes_cbc_decrypt(ciphertext, key, iv):
cipher = AES.new(key, AES.MODE_CBC, iv)
plaintext = cipher.decrypt(base64.b64decode(ciphertext))
return unpad(plaintext).decode('utf-8')
def get_user_account_info_by_secret_new(_id):
token = "72ff8cfe6986a39a098b32a5130390c4"
key = join_md5("", token)[1:]
time_stamp = str(int(time.time() * 1000))
salt = str(random.randint(10, 80))
sign = cxor(time_stamp + salt + "getUserAccountInfoBySecretNew", token)
headers = {
"Host": "i.bicoin.com.cn",
"accept": "application/json,application/xml,application/xhtml+xml,text/html;q=0.9,image/webp,*/*;q=0.8",
"accept-encoding": "gzip, deflate",
"accept-language": "zh-CN,zh",
"appversion": "4.0.1",
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"from": "Android",
"fromandroid": "bicoin",
"mobilid": "dervice_id",
"mobilkey": "C9FF5A57CF0DCC68901C9BF69246E87E",
"redrisegreendown": "2",
"salt": salt,
"sign": sign,
"time": time_stamp,
"token": token,
"user-agent": "Mozilla/5.0 (Linux; U; Android 12; zh-cn; Pixel 4 XL Build/SQ3A.220605.009.A1) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1",
"usertempid": ""
}
params = {
"salt": salt,
"sign": sign,
"time": time_stamp,
"userId": _id
}
resp = requests.get("https://i.bicoin.com.cn/firmOffer/getUserAccountInfoBySecretNew", headers=headers, params=params)
ciphertext = resp.json()["data"]
results = aes_cbc_decrypt(ciphertext, key=bytes.fromhex(key), iv=bytes.fromhex(key))
return results.strip()
if __name__ == '__main__':
results = get_user_account_info_by_secret_new("693850")
print(results)
求大佬把这个段代码转成易语言 可以用精易模块得啦 |