-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmark.py
More file actions
53 lines (49 loc) · 2.34 KB
/
Copy pathmark.py
File metadata and controls
53 lines (49 loc) · 2.34 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
44
45
46
47
48
49
50
51
52
53
# warning never share your .roblosecurity cookie with anyone
# this script is for educational purposes only
# using your cookie in this script gives full access to your roblox account
# use at your own risk you are responsible for your own account security
import requests,json,time
cookie = "placeholdercookie"
max_iterations = 10
iteration = 0
while iteration < max_iterations:
iteration += 1
with requests.session() as session:
session.cookies[".ROBLOSECURITY"] = cookie
response = session.post("https://catalog.roblox.com/")
if response.status_code == 403 and "X-CSRF-TOKEN" in response.headers:
session.headers["X-CSRF-TOKEN"] = response.headers["X-CSRF-TOKEN"]
elif "X-CSRF-TOKEN" in response.headers:
session.headers["X-CSRF-TOKEN"] = response.headers["X-CSRF-TOKEN"]
session.headers["Origin"] = "https://www.roblox.com/"
session.headers["Referer"] = "https://www.roblox.com/"
user_response = session.get("https://users.roblox.com/v1/users/authenticated")
if user_response.status_code != 200:
print("failed to get user info:", user_response.status_code)
print(user_response.text)
break
user = user_response.json()
friends = session.get(f"https://friends.roblox.com/v1/users/{user['id']}/friends").json()
if len(friends["data"]) > 0:
unfriended_any = False
for friend in friends["data"]:
unfriend_url = f"https://friends.roblox.com/v1/users/{friend['id']}/unfriend"
print(f"unfriending {friend['name']} (id: {friend['id']})...")
response = session.post(unfriend_url)
if response.status_code == 403 and "x-csrf-token" in response.headers:
session.headers["x-csrf-token"] = response.headers["x-csrf-token"]
response = session.post(unfriend_url)
try:
print(response.json())
except Exception:
print("non-json response:", response.text)
unfriended_any = True
time.sleep(1)
if not unfriended_any:
print("no friends to unfriend this round.")
break
else:
print("everyone has been unfriended")
break
else:
print("reached max iterations, stopping to avoid infinite loop.")