Skip to content

Instantly share code, notes, and snippets.

@an0ndev
Last active September 23, 2021 18:11
Show Gist options
  • Select an option

  • Save an0ndev/0fde3b6a7b4c07e42c9a1584d6d73a71 to your computer and use it in GitHub Desktop.

Select an option

Save an0ndev/0fde3b6a7b4c07e42c9a1584d6d73a71 to your computer and use it in GitHub Desktop.
Discord token dumper
# dump discord token script by an0ndev 06/11/21, revised 08/23/21
# discord must be completely closed first! (check for tray icon)
import os, pathlib, sys, tkinter.messagebox # stdlib
try:
import leveldb # pip install leveldb
except ModuleNotFoundError:
os.system ("pip install leveldb")
import leveldb
def show_copyable (title, text):
root = tkinter.Tk ()
root.wm_title (title)
copy_box = tkinter.Text ()
copy_box.insert ("1.0", text)
copy_box.pack (expand = True, fill = tkinter.BOTH)
ok_button = tkinter.Button (root, text = "OK", command = root.destroy)
ok_button.pack (expand = True, fill = tkinter.BOTH)
root.mainloop ()
if sys.platform == "win32":
base_path = pathlib.Path.home () / "AppData" / "Roaming"
elif sys.platform == "darwin":
base_path = pathlib.Path.home () / "Library" / "Application Support"
else:
base_path = pathlib.Path.home () / ".config"
try:
key = {key.decode (): value for key, value in leveldb.LevelDB (str (base_path / "discord" / "Local Storage" / "leveldb")).RangeIter ()} ["_https://discordapp.com\x00\x01token"].decode () [2:-1]
print (key)
show_copyable ("the token", key)
except leveldb.LevelDBError as leveldb_error:
show_copyable ("shit went down", f"Got an error, maybe you need to close Discord first? (error is {leveldb_error})")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment