-
Notifications
You must be signed in to change notification settings - Fork 3
/
solve.py
141 lines (135 loc) · 5.18 KB
/
solve.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import tls_client
import uuid
import time
import json
import re
import base64
from fingerprint import fingerprint_1, fingerprint_2
from mods import encrypt_payload, generate_pc
import urllib.parse
class PX:
def __init__(self, app_id: str, ft: int, collector_uri: str, host: str, sid: str, vid: str, cts: str, pxhd: str=None, proxy: str=None):
self.session = tls_client.Session(client_identifier="chrome_127", random_tls_extension_order=True)
if proxy != None:
self.session.proxies = {
'https': f'http://{proxy}',
'http': f'http://{proxy}'
}
self.collector_url = collector_uri
self.app_id = app_id
self.vid = vid
self.cts = cts
self.pxhd = pxhd
self.host = host
self.sid = sid
self.ft = ft
self.session.headers = {
'accept': '*/*',
'accept-language': 'en-US,en;q=0.9',
'content-type': 'application/x-www-form-urlencoded',
'origin': host,
'priority': 'u=1, i',
'sec-ch-ua': '"Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',
}
self.custom_padding = list('G^S}DNK8DNa>D`K}GK77')
self.st = int(time.time()) * 1000
self.site_uuids = {
"sid": sid,
"vid": vid,
"cts": cts
}
self.uuid = str(uuid.uuid4())
self.cu = str(uuid.uuid4())
self.pc_key = f"{self.uuid}:v8.9.6:{ft}"
self.rsc = 1
@staticmethod
def parse_for_cookie(response: str) -> str:
try:
return response.split("330|")[1].split("|")[0]
except:
return None
def request_1(self):
self.raw_payload = fingerprint_1(self.host, self.uuid, self.st)
payload_key = {
"vid": self.site_uuids['vid'],
"tag": "v8.9.6",
"appID": self.app_id,
"cu": self.cu,
"pc": str(generate_pc(self.pc_key, self.raw_payload))
}
payload = {
"payload": encrypt_payload(self.raw_payload),
"appId": self.app_id,
"tag": "v8.9.6",
"uuid": self.uuid,
"ft": self.ft,
"seq": (self.rsc - 1),
"en": "NTA",
"pc": generate_pc(self.pc_key, self.raw_payload),
"sid": self.sid,
"rsc": self.rsc
}
if self.pxhd == None:
i = 0
for site_key in self.site_uuids:
if self.site_uuids[site_key] != None:
payload[site_key] = self.site_uuids[site_key]
i += 1
else:
payload['pxhd'] = self.pxhd
self.rsc += 1
self.resp_1 = self.session.post(self.collector_url, data=urllib.parse.urlencode(payload, safe="=")).json()['ob']
self.resp_1 = base64.b64decode(str(self.resp_1).encode()).decode()
return
def solve_request(self):
self.fp_2 = fingerprint_2(json.loads(self.raw_payload), self.resp_1, self.site_uuids)
payload_data = {
"payload": encrypt_payload(self.fp_2),
"appId": self.app_id,
"tag": "v8.9.6",
"uuid": self.uuid,
"ft": self.ft,
"seq": self.rsc,
"en": "NTA",
"cs": f"{self.resp_1.split("1ooo11|")[1].split("~")[0]}",
"pc": generate_pc(self.pc_key, self.fp_2),
"sid": self.site_uuids['sid'],
"vid": self.site_uuids['vid'],
"cts": self.site_uuids['cts'],
"rsc": self.rsc
}
if self.pxhd != None:
payload_data['pxhd'] = self.pxhd
self.resp_2 = self.session.post(self.collector_url, data=urllib.parse.urlencode(payload_data, safe="=")).json()['ob']
self.resp_2 = base64.b64decode(str(self.resp_2).encode()).decode()
input(self.resp_2)
return
def solve(self):
self.request_1()
self.solve_request()
token = PX.parse_for_cookie(self.resp_2)
return token
if __name__ == "__main__":
t1 = int(time.time())
token = PX(
app_id="PX943r4Fb8",
ft=330,
collector_uri="https://collector-px943r4fb8.px-cloud.net/api/v2/collector",
host="https://arcteryx.com/",
sid="0396fb2e-5f0f-11ef-ae7c-f857124857d2󠄱󠄷󠄲󠄴󠄱󠄷󠄰󠄳󠄷󠄹󠄹󠄵󠄶",
vid="0bc41189-5ec3-11ef-ba8c-eaab7bc900b7",
cts="0c3f5439-5ec3-11ef-83dc-88da46c325fa",
# proxy="",
# pxhd="30f6d7ff246f451ceb1d4d5cd54297ff3d0a27d627974b5d92f23949a768da70:0bc41189-5ec3-11ef-ba8c-eaab7bc900b7"
).solve()
endtime = time.time()-t1
if token != None:
print(f"Solved PX: {token}")
else:
print('Failed to solve PX')