-
Notifications
You must be signed in to change notification settings - Fork 3
/
stripe.py
152 lines (77 loc) · 2.91 KB
/
stripe.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
142
143
144
145
146
147
148
149
150
151
152
# Decrypt Keys
import base64
# Get the checkout link from the user
checkoutlink = input("\nEnter the checkout link: ")
# Decode the value after the '#' character
plain_ck = checkoutlink.split("#")[0].replace("https://checkout.stripe.com/c/pay/", "")
obfuscated_pk = checkoutlink.split("#")[1]
# Decrypted ck value
ck = f"{plain_ck}"
# Obfuscated PK value
obfuscated_pk = f"{obfuscated_pk}"
obfuscated_pk = obfuscated_pk.replace("%2F", "/")
# Add padding characters to the end of the obfuscated_pk value
while len(obfuscated_pk) % 4 != 0:
obfuscated_pk += "="
# Decode the obfuscated_pk value from base64
decoded_pk = base64.b64decode(obfuscated_pk.encode("utf-8"))
print("Decoded PK value:", decoded_pk)
dry = ""
for c in decoded_pk:
dry += chr(5 ^ c)
print("Decrypted ck value:", ck)
print("Decrypted PK value:", dry)
# Encrypt Keys
import base64
import json
# decrypt_pk
start = "fidkdWxOYHwnPyd1blppbHNgWkBLPTNJV1ZSc39paVYxakBhPF99REI0ajU1bXF9RGhvYmQnKSdjd2poVmB3c2B3Jz9xd3BgKSdpZHxqcHFRfHVgJz8ndmxrYmlgWmxxYGgnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
encods = base64.b64decode(start.encode('utf-8'))
print(encods)
pit = ""
while len(pit) % 4 != 0:
pit += "="
for p in encods:
n = chr( 5 ^ p)
pit += n
print(pit)
# encrypt_pk
encrypt_pk = ""
# pit = json.dumps(pit)
for i in pit:
i = chr( 5 ^ ord(i))
encrypt_pk += i
endecodee = base64.b64encode(encrypt_pk.encode('utf-8'))
checkout_link = f"https://checkout.stripe.com/c/pay/#{endecodee}"
print(checkout_link)
# encode checkout details
import json
import base64
import requests as r
cs = input("Enter the checkout session: ")
pk = input("Enter the pk: ")
dic_load = {"apiKey":f"{pk}","fromServer":True,"layoutType":"single_item","enablePlaceholders":True}
url = f"https://api.stripe.com/v1/payment_pages/{cs}/init"
header = {
"authority": "api.stripe.com",
"accept": "application/json",
"accept-language": "en-US,en;q=0.9",
"content-type":"application/x-www-form-urlencoded",
"origin":"https://checkout.stripe.com",
"referer":"https://checkout.stripe.com/",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.68"
}
data = (f"key={pk}&eid=NA&browser_locale=en-US&redirect_type=stripe_js")
res = r.post(url=url,headers=header,data=data)
print(res.text)
# data = json.dumps(dic_load)
obs = "="
for c in data:
obs += chr(ord(c) ^ 5 )
obs = obs.replace('%','').replace('x','x%%%')
unicode_escape_obs = obs.encode("utf-8")
unicode_escape_obs = base64.b64encode(unicode_escape_obs)
print(unicode_escape_obs)