authorization Extractor(β)

Extract Discord Token and display it in a draggable and resizable box without popups

  1. // ==UserScript==
  2. // @name authorization Extractor(β)
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.9
  5. // @description Extract Discord Token and display it in a draggable and resizable box without popups
  6. // @author AARR
  7. // @match https://discord.com/*
  8. // @grant none
  9. // @license You can modify as long as you credit me
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. let initialBoxPosition = { x: 10, y: 10 };
  16.  
  17. function makeElementDraggable(el) {
  18. el.onmousedown = function(event) {
  19. event.preventDefault();
  20.  
  21. let shiftX = event.clientX - el.getBoundingClientRect().left;
  22. let shiftY = event.clientY - el.getBoundingClientRect().top;
  23.  
  24. function moveAt(pageX, pageY) {
  25. const newX = Math.min(Math.max(0, pageX - shiftX), window.innerWidth - el.offsetWidth);
  26. const newY = Math.min(Math.max(0, pageY - shiftY), window.innerHeight - el.offsetHeight);
  27. el.style.left = newX + 'px';
  28. el.style.top = newY + 'px';
  29.  
  30. const backgroundX = initialBoxPosition.x - newX;
  31. const backgroundY = initialBoxPosition.y - newY;
  32. el.style.backgroundPosition = `${backgroundX}px ${backgroundY}px`;
  33. }
  34.  
  35. function onMouseMove(event) {
  36. moveAt(event.pageX, event.pageY);
  37. }
  38.  
  39. document.addEventListener('mousemove', onMouseMove);
  40.  
  41. function onMouseUp() {
  42. document.removeEventListener('mousemove', onMouseMove);
  43. document.removeEventListener('mouseup', onMouseUp);
  44. }
  45.  
  46. document.addEventListener('mouseup', onMouseUp);
  47. };
  48.  
  49. el.ondragstart = function() {
  50. return false;
  51. };
  52. }
  53.  
  54. function addResizeButtons(el) {
  55. const buttonContainer = document.createElement('div');
  56. buttonContainer.style.position = 'absolute';
  57. buttonContainer.style.right = '10px';
  58. buttonContainer.style.top = '10px';
  59. buttonContainer.style.display = 'flex';
  60. buttonContainer.style.flexDirection = 'column';
  61. buttonContainer.style.gap = '10px';
  62. el.appendChild(buttonContainer);
  63. }
  64.  
  65. function createUI() {
  66. const initialWidth = '300px';
  67. const initialHeight = '200px';
  68.  
  69. const container = document.createElement('div');
  70. container.id = 'tokenContainer';
  71. container.style.position = 'fixed';
  72. container.style.top = initialBoxPosition.y + 'px';
  73. container.style.left = initialBoxPosition.x + 'px';
  74. container.style.backgroundColor = '#2f3136';
  75. container.style.color = '#ffffff';
  76. container.style.padding = '20px';
  77. container.style.borderRadius = '5px';
  78. container.style.zIndex = '1000';
  79. container.style.width = initialWidth;
  80. container.style.height = initialHeight;
  81. container.style.overflowY = 'auto';
  82. container.style.display = 'none';
  83.  
  84.  
  85. container.style.backgroundImage = 'url("https://i.imgur.com/UEcWaCc.png")';
  86. container.style.backgroundRepeat = 'repeat';
  87. container.style.backgroundSize = 'cover';
  88. container.style.backgroundAttachment = 'scroll';
  89. container.style.backgroundPosition = '0 0';
  90.  
  91. document.body.appendChild(container);
  92.  
  93. makeElementDraggable(container);
  94. addResizeButtons(container);
  95.  
  96. const title = document.createElement('h2');
  97. title.textContent = 'authorization Extractor β';
  98. title.style.margin = '0 0 10px 0';
  99. title.style.fontSize = '16px';
  100. title.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
  101. container.appendChild(title);
  102.  
  103. const toolsLink = document.createElement('a');
  104. toolsLink.href = 'https://aarr-homepage.github.io/page/aarrtool.html';
  105. toolsLink.target = '_blank';
  106. toolsLink.textContent = '🔗other tools';
  107. toolsLink.style.display = 'inline-block';
  108. toolsLink.style.marginBottom = '10px';
  109. toolsLink.style.fontSize = '12px';
  110. toolsLink.style.color = '#00BFFF';
  111. toolsLink.style.textDecoration = 'underline';
  112. toolsLink.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
  113. container.appendChild(toolsLink);
  114.  
  115. const tokenDisplay = document.createElement('code');
  116. tokenDisplay.style.whiteSpace = 'pre-wrap';
  117. tokenDisplay.style.wordBreak = 'break-word';
  118. tokenDisplay.style.display = 'block';
  119. tokenDisplay.style.marginBottom = '10px';
  120. tokenDisplay.style.backgroundColor = '#000000';
  121. tokenDisplay.style.color = '#00FF00';
  122. tokenDisplay.textContent = 'Failed acquisition Wait for a while and press the “Retry” button';
  123. container.appendChild(tokenDisplay);
  124.  
  125. const copyButton = document.createElement('button');
  126. copyButton.textContent = 'Copy';
  127. copyButton.style.padding = '10px';
  128. copyButton.style.backgroundColor = '#7289da';
  129. copyButton.style.color = '#ffffff';
  130. copyButton.style.border = 'none';
  131. copyButton.style.borderRadius = '3px';
  132. copyButton.style.cursor = 'pointer';
  133. container.appendChild(copyButton);
  134.  
  135. copyButton.addEventListener('click', function() {
  136. const dummy = document.createElement('textarea');
  137. document.body.appendChild(dummy);
  138. dummy.value = tokenDisplay.getAttribute('data-token');
  139. dummy.select();
  140. document.execCommand('copy');
  141. document.body.removeChild(dummy);
  142. alert("copied your authorization to clipboard.");
  143. });
  144.  
  145. const retryButton = document.createElement('button');
  146. retryButton.textContent = 'Retry';
  147. retryButton.style.padding = '10px';
  148. retryButton.style.backgroundColor = '#ff9800';
  149. retryButton.style.color = '#ffffff';
  150. retryButton.style.border = 'none';
  151. retryButton.style.borderRadius = '3px';
  152. retryButton.style.cursor = 'pointer';
  153. container.appendChild(retryButton);
  154.  
  155. retryButton.addEventListener('click', () => {
  156. location.reload();
  157. });
  158.  
  159. return { container, tokenDisplay };
  160. }
  161.  
  162. function createToggleImage(container) {
  163. const toggleImage = document.createElement('img');
  164. toggleImage.src = 'https://i.imgur.com/fv0qOVS.png';
  165. toggleImage.style.position = 'fixed';
  166. toggleImage.style.width = '30px';
  167. toggleImage.style.height = '30px';
  168. toggleImage.style.cursor = 'pointer';
  169. toggleImage.style.zIndex = '1001';
  170. toggleImage.style.left = '105px';
  171. toggleImage.style.top = '0px';
  172. document.body.appendChild(toggleImage);
  173.  
  174. toggleImage.addEventListener('click', () => {
  175. const isHidden = container.style.display === 'none';
  176. container.style.display = isHidden ? 'block' : 'none';
  177. });
  178. }
  179.  
  180. function maskToken(token) {
  181. return '*'.repeat(token.length);
  182. }
  183.  
  184. function getToken(tokenDisplay) {
  185. let token = localStorage.getItem('token');
  186. if (token) {
  187. token = token.slice(1, -1);
  188. tokenDisplay.textContent = maskToken(token);
  189. tokenDisplay.setAttribute('data-token', token);
  190. }
  191. }
  192.  
  193. const { container, tokenDisplay } = createUI();
  194. createToggleImage(container);
  195. getToken(tokenDisplay);
  196. })();