-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMCli.py
242 lines (227 loc) · 7.27 KB
/
MCli.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
import requests
import json
import os, fnmatch; os.system('clear')
from multiprocessing import Process, cpu_count, Manager
from collections import defaultdict
from os.path import abspath, dirname
from requests.exceptions import ReadTimeout, Timeout, ConnectionError, ChunkedEncodingError, TooManyRedirects, InvalidURL
switch = { 'dir': '0', 'func': '0' }
playfabapi = 'https://20ca2.playfabapi.com/Catalog/GetPublishedItem'
playfab = '20ca2.playfabapi.com'
token = 'NHxFWHdDWUxnZlBld2FhL3VGNElrZlZMMkVVTHdSeUFCNExLbWswMkVPL1ZBPXx7ImkiOiIyMDIyLTA3LTIyVDA0OjI2OjU5LjkyNzkyMzdaIiwiaWRwIjoiQ3VzdG9tIiwiZSI6IjIwMjItMDctMjNUMDQ6MjY6NTkuOTI3OTIzN1oiLCJ0aWQiOiJjYzczODk0YmJmMzc0Nzc0YmIwMDBiY2Q5YTY3ZmNkOCIsImlkaSI6Ik1DUEY2MTUzMEMzREQyMzg0NzA2Qjk4NTlCODVDREI4NzZCOCIsImgiOiIyNEI5ODFFRjA2RDczMjk5IiwiZWMiOiJtYXN0ZXJfcGxheWVyX2FjY291bnQhQjYzQTA4MDNEMzY1MzY0My82NzhFM0Y1QzZFREZCNDhBLyIsImVpIjoiNjc4RTNGNUM2RURGQjQ4QSIsImV0IjoibWFzdGVyX3BsYXllcl9hY2NvdW50In0='
headers = { 'Host': playfab, 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'Keep-Alive', 'Accept-Language': 'en-US', 'Cache-Control': 'public', 'Content-Type': 'application/json', 'User-Agent': 'cpprestsdk/2.9.0', 'x-entitytoken': token }
gettor = {'User-Agent': 'cpprestsdk/2.9.0'}
body = {'ItemId':UUID}
Resultee=[]
Faily=[]
columns = defaultdict(list)
txtfiles= []
class colors:
RED_BG = '\033[41m\033[1m'
GREEN_BG = '\033[42m'
ENDC = '\033[m'
def ICustom():
global UUID
print('')
print(colors.RED_BG + ' First Use! ' + colors.ENDC )
print('1. Custom Token')
print('2. Default Token')
print('')
ansi=input(' Choose Option : ').lower()
print('')
if str(ansi)=='1':
tokenize=input(' Input your Token : ')
headers['x-entitytoken']=f'{tokenize}'
elif str(ansi)=='2':
headers['x-entitytoken']=f'{token}'
return
def uinput():
print('')
print('Scanning Finished!')
print('1. Go Back to Menu')
print('2. Scanning Again')
print('3. Quit Instead')
print('')
ans=input('Choose Option: ')
if ans=='2':
return
elif ans=='3':
exit()
else:
Mainlist()
def filet():
global IDlist, fileselector
num_file = 1
print('1. Check Files in Input Folder')
print('2. Check Files in Current Folder')
print('q to Quit')
print('m to Menu')
print('')
ans=input(' Choose : ').lower()
if ans=='1':
files = os.listdir('input')
switch['dir']='0'
elif ans=='2':
files = [f for f in os.listdir('.') if os.path.isfile(f)]
switch['dir']='1'
elif ans=='q':
exit()
elif ans=='m':
Mainlist()
else:
filet()
print(' [' + colors.RED_BG + ' Files Found ' + colors.ENDC + '] ')
for f in files:
if fnmatch.fnmatch(f, '*.txt'):
print( str(num_file),str(f))
num_file=num_file+1
txtfiles.append(str(f))
print('')
print(' M back to Menu ')
fileselector = input(' Choose Target Files : ')
if fileselector.isdigit():
print('')
print(' Target Chosen : ' + colors.RED_BG + ' '+txtfiles[int(fileselector)-1]+' '+colors.ENDC)
direct = str(switch['dir'])
if direct == '0':
file_hosts = str('input') +'/'+ str(txtfiles[int(fileselector)-1])
else:
file_hosts = str(txtfiles[int(fileselector)-1])
else:
Mainlist()
with open(file_hosts) as f:
parseddom = f.read().split()
IDlist = list(set(parseddom))
IDlist = list(filter(None, parseddom))
print(' Total of Domains Loaded: ' + colors.RED_BG + ' ' +str(len(IDlist)) + ' '+colors.ENDC )
print('')
return
def executor(switch):
with Manager() as manager:
global Resultee, Faily
num_cpus = cpu_count()
processes = []
Resultee = manager.list()
Faily = manager.list()
for process_num in range(num_cpus):
section = IDlist[process_num::num_cpus]
if switch['func'] == '0':
p = Process(target=Meta, args=(section,))
p.start()
processes.append(p)
elif switch['func'] == '1':
p = Process(target=Gettor, args=(section,))
p.start()
processes.append(p)
for p in processes:
p.join()
Resultee = list(Resultee)
Faily = list(Faily)
print('')
print(' Failed Result : ' + colors.RED_BG + ' '+str(len(Faily)) +' '+ colors.ENDC )
print(' Successfull Result : ' + colors.GREEN_BG + ' '+str(len(Resultee))+ ' '+colors.ENDC)
def Engine(IDlist):
for UUID in IDlist:
try:
r = requests.post(playfabapi, headers=headers, json=body, allow_redirects=False)
if switch['func']=='0':
datas = r.json()["data"]["Item"]["Contents"]
with open(f'output/metadata/{UUID}.txt', 'a') as f:
json.dump(r.json(), f, indent = 4)
for i in datas:
print("\n\n" + i["Url"], file=f)
else:
with open(f'output/assets/{UUID}.txt', 'a') as f:
f.write(r.content)
print(i["Url"], file=open(f"output/{nametag}-[Hit].txt"))
print(' ['+colors.GREEN_BG+' HIT '+colors.ENDC+'] ' + UUID)
Resultee.append(str(UUID))
except (Timeout, ReadTimeout, ConnectionError):
print(' ['+colors.RED_BG+' FAIL '+colors.ENDC+'] ' + UUID + ' [' + colors.RED_BG +' TIMEOUT '+colors.ENDC+']')
print(UUID, file=open(f'output/{nametag}-[Fail].txt', 'a'))
Faily.append(str(UUID))
pass
except(ChunkedEncodingError):
print(' ['+colors.RED_BG+' FAIL '+colors.ENDC+'] ' + UUID + ' [' + colors.RED_BG+' Invalid Length '+colors.ENDC + ']')
print(UUID, file=open(f'output/{nametag}-[Fail].txt', 'a'))
Faily.append(str(UUID))
pass
except(TooManyRedirects):
print(' ['+colors.RED_BG+' FAIL '+colors.ENDC+'] ' + UUID + ' [' +colors.RED_BG+' Redirects Loop '+colors.ENDC+']')
print(UUID, file=open(f'output/{nametag}-[Fail].txt', 'a'))
Faily.append(str(UUID))
pass
except(InvalidURL):
print(' ['+colors.RED_BG+' FAIL '+colors.ENDC+'] ' + UUID + ' [' +colors.RED_BG+' Invalid URL '+colors.ENDC+']')
print(UUID, file=open(f'output/{nametag}-[Fail].txt', 'a'))
Faily.append(str(UUID))
pass
def Mainlist():
print('''
___
/ /\
/ /:/
/ /:/
/ /:/ ___
/__/:/ / /\
\ \:\ / /:/
\ \:\ /:/
\ \:\/:/
\ \::/
\__\/
''')
print(' [' + colors.RED_BG + ' MarketPlace : Extractor ' + colors.ENDC + ']')
print(' ['+colors.RED_BG+' Author ' + colors.ENDC + ':' + colors.GREEN_BG + ' Kiynox ' + colors.ENDC + ']')
print('')
print('1. Marketplace Metadata')
print('2. Marketplace Assets')
print('3. Marketplace Decryptor')
print('Q to Quit')
print('')
ans=input(' Choose Option: ').lower()
print('')
if str(ans)=='1':
def Meta():
global headers, body, nametag
headers=headers
body=body
nametag='[Meta]'
switch['func']='0'
ICustom()
filet()
executor()
uinput()
Meta()
elif str(ans)=='2':
def Gettor():
global headers, datas, nametag
headers=gettor
body={}
nametag='[Assets]'
switch['func']='1'
filet()
downloader()
executor()
uinput()
Gettor()
elif str(ans)=='3':
def Unlock():
filet()
executor()
uinput()
Unlock()
else:
exit()
def Checks():
if not os.path.exists('input'):
os.makedirs('input')
if not os.path.exists('output'):
os.makedirs('output')
if not os.path.exists('output/metadata'):
os.makedirs('output/metadata')
if not os.path.exists('output/assets'):
os.makedirs('output/assets')
Mainlist()
if __name__ == '__main__':
os.chdir(dirname(abspath(__file__)))
Checks()