-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmadfut22.py
executable file
·141 lines (120 loc) · 4.9 KB
/
madfut22.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
#! /usr/bin/env python3
import numpy as np
import sys
import re
import base64
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def xor(a, b):
xored = []
for i in range(len(a)):
xored_value = a[i%len(a)] ^ b[i%len(b)]
xored.append(chr(xored_value))
return ''.join(xored)
def get_ids_cracked():
try:
ids = np.loadtxt('ids/ids.txt', dtype=str)
except FileNotFoundError:
eprint('ERROR: File ids.txt does not exist')
sys.exit(1)
try:
ids_totw = np.loadtxt('ids/ids_totw.txt', dtype=str)
except FileNotFoundError:
eprint('ERROR: File ids_totw.txt does not exist')
sys.exit(1)
# 1: valencia, 2: buffon, 3: motta, 4: vardy86, 5: vardy92, 6: vardy95, 7: batistuta, 8: silva92, 9: silva93, 10: silva95
# 11-13: robben, 14: alonso, 15-17: modric, 18-20: rivellino
extra = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
# Strange IDs (they are not fetched from .txt):
# Wijnaldum OTW
# Taarabt Winter Wildcard
# Barella TOTW 87
# Pereyra Versus ice
# Everton Versus fire
# Galeno UEL TOTT
# Nkunku
# Simeone
# Ramsdale
# Theate
# Payet
# Orsolini
# Alexander-Arnold POTM
# Laborde POTM
# Mbappe headliner
# Salah headliner
# Rafa TOTW
# Kokcu TOTW
# Song Wenjie TOTW Silver
# Brobbey TOTW Silver
ids = np.append(ids, [50512939, 67288469, 100887528, 67301925, 100886012, 84125562, 184781787, 100880112, 100897230, 100920574, 67286252, 67342420, 100894577, 134427247, 117672259, 151204275, 84102627, 67352109, 50563906, 67360674])
# Add TOTW to ids_totw to get FUTCHAMP TOTW too
ids_totw = np.append(ids_totw, [100887528])
id_str = '{'
for id in extra:
id_str += '"id' + str(id).zfill(3) + '":100,'
for i, line in np.ndenumerate(ids):
id_str += '"id' + line + '":100,'
# In MADFUT22, FUTCHAMP TOTW always end in 00
for i, line in np.ndenumerate(ids_totw):
id_str += '"id' + line + '00' + '":100,'
id_str = id_str[:-1]
id_str += '}'
return id_str
def crack_players():
ids = get_ids_cracked()
sys.stdout.write(' <string name="LwA4">')
sys.stdout.write(base64.b64encode(str.encode(xor(str.encode(ids), xor_key))).decode("utf-8"))
sys.stdout.write('</string>\n')
def crack_coins():
coins = '100000000'
sys.stdout.write(' <string name="JQsiKBc=">')
sys.stdout.write(base64.b64encode(str.encode(xor(str.encode(coins), xor_key))).decode("utf-8"))
sys.stdout.write('</string>\n')
def crack_ltm():
ltm_points = '100000'
sys.stdout.write(' <string name="KhAmFgsiKBA4">')
sys.stdout.write(base64.b64encode(str.encode(xor(str.encode(ltm_points), xor_key))).decode("utf-8"))
sys.stdout.write('</string>\n')
def crack_picks():
hacker_pick = '[{"id":"pp_new_special","name":"HACKER PICK","descriptionText":"5 Guaranteed new special cards (no rating range). Courtesy of DrNoob","cover":"pp_cover_new_special","price":200000,"type":"new","logic":{"numCards":5,"newProb":100.0,"newSpecialProb":100.0,"newSpecialRatings":[{"maxRating":99,"minRating":64,"prob":100.0}],"newStandardRatings":[{"maxRating":99,"minRating":64,"prob":100.0}],"oldSpecialProb":75.0,"oldSpecialRatings":[{"maxRating":99,"minRating":64,"prob":100.0}],"oldStandardRatings":[{"maxRating":99,"minRating":64,"prob":100.0}],"packableOnly":false,"color":"rare_gold","colorNewRatings":[],"colorOldRatings":[],"ids":[]},"startTime":-1,"expireTime":-1,"numAvailable":100,"orderPriority":24,"isTradable2":true}]'
sys.stdout.write(' <string name="NQU9IwAbKgUyIxYbLwcgNQ==">')
sys.stdout.write(base64.b64encode(str.encode(xor(str.encode(hacker_pick), xor_key))).decode("utf-8"))
sys.stdout.write('</string>\n')
if(len(sys.argv) != 2):
eprint("ERROR: Need one arg")
eprint("Use:",sys.argv[0],"file")
sys.exit(1)
try:
input_f = open(sys.argv[1],'r')
except FileNotFoundError:
eprint("ERROR: File '",sys.argv[1],"' does not exist")
sys.exit(1)
regex_ids = re.compile(r'\s*<string\s+name="LwA4">.*')
regex_coins = re.compile(r'\s*<string\s+name="JQsiKBc=">.*')
regex_ltm = re.compile(r'\s*<string\s+name="KhAmFgsiKBA4">.*')
regex_picks = re.compile(r'\s*<string\s+name="NQU9IwAbKgUyIxYbLwcgNQ==">.*')
regex_end = re.compile(r'</map>')
foundp = False
foundl = False
# XOR key is 0x46644b
xor_key = bytearray([0x46, 0x64, 0x4b])
for line in input_f:
if regex_ids.match(line):
foundp = True
crack_players()
elif regex_coins.match(line):
crack_coins()
elif regex_ltm.match(line):
foundl = True
crack_ltm()
#elif regex_picks.match(line):
# crack_picks()
elif regex_end.match(line):
if not foundp:
crack_players()
sys.stdout.write(line)
if not foundl:
crack_ltm()
sys.stdout.write(line)
else:
sys.stdout.write(line)