-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
125 lines (108 loc) · 4.36 KB
/
main.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
import requests
import uuid
from time import sleep
import json
from pprint import pprint
from datetime import datetime
import os
tokenFile = open("token", "+w")
token = tokenFile.read()
sessionUUID = str(uuid.uuid4())
if token == "":
tokenFile.write(sessionUUID)
else:
sessionUUID = token
tokenFile.close()
session = requests.Session()
session.headers.update(
{
"session": sessionUUID,
"Content-Type": "application/json",
"Authorization": "mynotsosecrettoken",
"Update": "true",
"Shopuuid": "",
"Itemuuid": "",
}
)
currentAchievements = []
currentAchievementsName = []
hurtAcquired = False
session.cookies.update({"uuid": sessionUUID, "achievements": f"{currentAchievements}"})
def updateCookies(session, achievements):
for achievement in achievements:
if (
achievement["acquired"] == True
and achievement["slug"] not in currentAchievementsName
):
currentAchievementsName.append(achievement["slug"])
currentAchievements.append(
{
"slug": achievement["slug"],
"name": achievement["name"],
"description": achievement["description"],
"delay": datetime.now().strftime("%s"),
}
)
session.cookies.update({"achievements": f"{currentAchievements}"})
response = session.get("https://feedthisdragon4.chall.malicecyber.com/api/v1")
responseJson = response.json()
if __name__ == "__main__":
try:
while (
response.status_code == 200 and int(responseJson["health"]) > 0
) and "all" not in currentAchievementsName:
for item in responseJson["items"]:
if hurtAcquired:
if item["type"] != "trap" and item["type"] != "fox":
response = session.post(
"https://feedthisdragon4.chall.malicecyber.com/api/v1",
headers={"Itemuuid": item["uuid"]},
)
else:
if item["type"] != "fox":
response = session.post(
"https://feedthisdragon4.chall.malicecyber.com/api/v1",
headers={"Itemuuid": item["uuid"]},
)
if item["type"] == "trap":
hurtAcquired = True
for upgrade in responseJson["upgrades"]:
if "faster" not in currentAchievementsName:
if upgrade["name"] == "Greed":
if responseJson["coin"] >= upgrade["cost"]:
response = session.post(
"https://feedthisdragon4.chall.malicecyber.com/api/v1",
headers={"Shopuuid": upgrade["uuid"]},
)
if upgrade["name"] == "Feed":
if responseJson["coin"] >= upgrade["cost"]:
response = session.post(
"https://feedthisdragon4.chall.malicecyber.com/api/v1",
headers={"Shopuuid": upgrade["uuid"]},
)
if upgrade["name"] == "Bag" and responseJson["bag"] < 9999:
if responseJson["coin"] >= upgrade["cost"]:
response = session.post(
"https://feedthisdragon4.chall.malicecyber.com/api/v1",
headers={"Shopuuid": upgrade["uuid"]},
)
responseJson = response.json()
updateCookies(session, responseJson["achievements"])
os.system("clear")
print(
f"health : {responseJson['health']} / {responseJson['max_health']}",
flush=False,
)
print(f"level : {responseJson['level']}", flush=False)
print(
f"coins : {responseJson['coin']} / {responseJson['bag']}",
flush=False,
)
print(f"achivements : {currentAchievementsName}", flush=True)
response = session.get(
"https://feedthisdragon4.chall.malicecyber.com/api/v1"
)
responseJson = response.json()
finally:
pprint(responseJson)
exit()