-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserialQuery.py
More file actions
43 lines (39 loc) · 1.22 KB
/
serialQuery.py
File metadata and controls
43 lines (39 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Serial query script to check TNFlash serial status via official API
# Written by MeowIce
import requests
import json
import hashlib
import hmac
def queryApi():
apiUrl = "https://vkhojreqmombazfazhup.supabase.co/functions/v1/check_tnflash"
secretKey = "ThangNguyen_AntiReplay_Key_9999"
serialNumber = input("-> ")
requestPayload = {"serial": serialNumber}
payloadStr = json.dumps(requestPayload, separators=(',', ':'))
signature = hmac.new(
secretKey.encode("utf-8"),
payloadStr.encode("utf-8"),
hashlib.sha256
).hexdigest()
requestHeaders = {
"User-Agent": "HyperTN-FlashTool/3.2",
"Content-Type": "application/json",
"x-api-key": "PBUGPAkQCjU=",
"x-signature": signature,
"Accept": "*/*"
}
try:
apiResponse = requests.post(
apiUrl,
headers=requestHeaders,
data=payloadStr
)
if apiResponse.status_code == 200:
print(apiResponse.text)
else:
print(f"Lỗi : {apiResponse.status_code}")
print(apiResponse.text)
except Exception as e:
print(f"Lỗi kết nối : {e}")
if __name__ == "__main__":
queryApi()