Skip to content

Instantly share code, notes, and snippets.

@adamaharony
Created November 30, 2017 18:22
Show Gist options
  • Save adamaharony/6bd6aeae836e5a492f5672227a95556b to your computer and use it in GitHub Desktop.
Save adamaharony/6bd6aeae836e5a492f5672227a95556b to your computer and use it in GitHub Desktop.
Discord get token from local DB
import shutil
import os
import sqlite3
IsCanary = False
if IsCanary:
shutil.copy(os.getenv('APPDATA') + '\discordcanary\Local Storage\https_canary.discordapp.com_0.localstorage', 'localstorage.db')
else:
shutil.copy(os.getenv('APPDATA') + '\discord\Local Storage\https_discordapp.com_0.localstorage', 'localstorage.db')
db = sqlite3.connect('localstorage.db')
cursor = db.cursor()
cursor.execute("SELECT * FROM ItemTable WHERE key = 'token'")
token = str(cursor.fetchone()[1]).lstrip("b'").rstrip("'").replace(r'\x00','').lstrip('"').rstrip('"')
db.close()
os.remove("localstorage.db")
@adamaharony
Copy link
Author

BTW, that works only on Windows PCs.

@adamaharony
Copy link
Author

doesnt work

Please, I urge you to look at when I posted this gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment