FMHY Base64 Auto Decoder

Decode base64-encoded links in some pastebins and make URLs clickable

  1. // ==UserScript==
  2. // @name FMHY Base64 Auto Decoder
  3. // @version 2.4
  4. // @author Rust1667
  5. // @description Decode base64-encoded links in some pastebins and make URLs clickable
  6. // @match *://rentry.co/*
  7. // @match *://rentry.org/*
  8. // @match *://pastes.fmhy.net/*
  9. // @match *://bin.disroot.org/?*#*
  10. // @match *://privatebin.net/?*#*
  11. // @match *://textbin.xyz/?*#*
  12. // @match *://bin.idrix.fr/?*#*
  13. // @match *://privatebin.rinuploads.org/?*#*
  14. // @match *://pastebin.com/*
  15. // @grant none
  16. // @icon https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://fmhy.net&size=64
  17. // @namespace https://gf.qytechs.cn/users/980489
  18. // ==/UserScript==
  19.  
  20.  
  21. (function() {
  22. 'use strict';
  23.  
  24. // Regular expression to match base64-encoded strings
  25. const base64Regex = /^[A-Za-z0-9+/]+={0,2}$/;
  26.  
  27. // Function to decode base64 string
  28. function decodeBase64(encodedString) {
  29. return atob(encodedString);
  30. }
  31.  
  32. // Function to check if a string is a URL
  33. function isURL(str) {
  34. const pattern = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/i;
  35. return pattern.test(str);
  36. }
  37.  
  38. // Different script for different pastebins
  39. var currentUrl = window.location.href;
  40. const rentryOrSnowbinRegex = /^(https?:\/\/(?:rentry\.co|rentry\.org|pastes\.fmhy\.net)\/[\w\W]+)/;
  41. const FMHYmainBase64PageRegex = /^https:\/\/rentry\.(?:co|org)\/fmhybase64(?:#.*)?/i;
  42. const fmhyBase64RawRentryPageRegex = /^https:\/\/rentry\.(co|org)\/FMHYBase64\/raw$/i;
  43. const privatebinDomainsRegex = /^(https?:\/\/(?:bin\.disroot\.org|privatebin\.net|textbin\.xyz|bin\.idrix\.fr|privatebin\.rinuploads\.org)\/[\w\W]+)/;
  44. const pastebinComRegex = /^https:\/\/pastebin\.com\/.*/;
  45.  
  46. // PASTEBIN.COM
  47. if (pastebinComRegex.test(currentUrl)) {
  48. let elements = document.querySelectorAll('.de1');
  49. elements.forEach(function(element) {
  50. let text = element.textContent.trim();
  51. if (text.startsWith('aHR0')) {
  52. let decodedText = decodeBase64(text);
  53. let url = new URL(decodedText);
  54.  
  55. // Get the color of the original text
  56. let originalColor = window.getComputedStyle(element).color;
  57.  
  58. // Create a clickable link
  59. let link = document.createElement('a');
  60. link.href = url.href;
  61. link.textContent = url.href;
  62. link.style.color = originalColor; // Apply the original color
  63.  
  64. // Replace the original text with the clickable link
  65. element.textContent = '';
  66. element.appendChild(link);
  67. }
  68. });
  69.  
  70.  
  71. //RENTRY OR PASTES.FMHY
  72. } else if (rentryOrSnowbinRegex.test(currentUrl) && !fmhyBase64RawRentryPageRegex.test(currentUrl)) {
  73.  
  74. // Select appropriate tags based on the URL matching
  75. var elementsToCheck = FMHYmainBase64PageRegex.test(currentUrl) ? document.querySelectorAll('code') : document.querySelectorAll('code, p');
  76.  
  77. // Loop through each selected element
  78. elementsToCheck.forEach(function(element) {
  79. // Get the content of the element
  80. var content = element.textContent.trim();
  81.  
  82. // Check if the content matches the base64 regex
  83. if (base64Regex.test(content)) {
  84. // Decode the base64-encoded string
  85. var decodedString = decodeBase64(content).trim();
  86.  
  87. // If the decoded string has URLs, decode it and linkify when possible
  88. if (isURL(decodedString) || (decodedString.includes('http') && decodedString.includes('\n'))) {
  89.  
  90. // One line
  91. if (!decodedString.includes('\n')) {
  92. var link = document.createElement('a');
  93. link.href = decodedString;
  94. link.textContent = decodedString;
  95. link.target = '_self'; // Open link in the same tab
  96. element.textContent = ''; // Clear the content of the element
  97. element.appendChild(link); // Append the link to the element
  98. }
  99. //Multiple lines
  100. else {
  101. const lines = decodedString.split("\n");
  102. const links = lines.map(line => isURL(line.trim()) ? "<a href='" + line.trim() + "'>" + line.trim() + "</a>" : line.trim());
  103. element.innerHTML = links.join("<br>");
  104. }
  105.  
  106. }
  107. }
  108. });
  109.  
  110.  
  111.  
  112. //FMHY-BASE64 RAW RENTRY PAGE
  113. } else if (fmhyBase64RawRentryPageRegex.test(currentUrl)) {
  114.  
  115. // Find all lines starting with "* `"
  116. const lines = document.body.innerText.split('\n');
  117. for (let i = 0; i < lines.length; i++) {
  118. const line = lines[i];
  119. if (line.includes('`')) {
  120. const startIndex = line.indexOf('`');
  121. const endIndex = line.lastIndexOf('`');
  122. const encodedText = line.substring(startIndex + 1, endIndex).trim();
  123. const decodedText = atob(encodedText);
  124. const newLine = line.substring(0, startIndex) + decodedText + line.substring(endIndex + 1);
  125. lines[i] = newLine;
  126. }
  127. }
  128.  
  129. // Update the page content with decoded lines
  130. document.body.innerText = lines.join('\n');
  131.  
  132.  
  133.  
  134.  
  135. // PRIVATEBIN
  136. } else if (privatebinDomainsRegex.test(currentUrl)) {
  137.  
  138. // Wait for the decryption process to finish
  139. function waitForDecryption() {
  140. const prettyPrintElement = document.getElementById('prettyprint');
  141. if (prettyPrintElement && prettyPrintElement.textContent.trim() !== '') {
  142. let decryptedText = prettyPrintElement.innerHTML.trim();
  143. const lines = decryptedText.split('\n');
  144.  
  145. // Flag to track if any modifications were made
  146. let modified = false;
  147.  
  148. // Iterate through each line
  149. lines.forEach(line => {
  150. // Check if the line contains a potential Base64 encoded string
  151. if (base64Regex.test(line)) {
  152. // Attempt to decode the potential Base64 encoded string
  153. try {
  154. const decodedText = decodeBase64(line);
  155. // Trim the decoded text before checking if it's a URL
  156. const trimmedText = decodedText.trim();
  157. // If trimmed decoded string is a URL, make it clickable
  158. if (isURL(trimmedText)) {
  159. // Replace the line with the decoded and linked text
  160. decryptedText = decryptedText.replace(line, '<a href="' + trimmedText + '">' + trimmedText + '</a>');
  161. modified = true;
  162. }
  163. } catch (error) {
  164. // If an error occurs during decoding, show it in an alert message
  165. //alert("Unable to decode the string: " + line);
  166. }
  167. } else if (line.startsWith('`') && line.endsWith('`')) {
  168. // Check if the line starts and ends with backticks
  169. let textInsideBackticks = line.slice(1, -1);
  170. // Check if textInsideBackticks is a Base64 encoded string
  171. if (base64Regex.test(textInsideBackticks)) {
  172. // Attempt to decode the text inside backticks
  173. try {
  174. const decodedText = decodeBase64(textInsideBackticks);
  175. // Trim the decoded text before checking if it's a URL
  176. const trimmedText = decodedText.trim();
  177. // If trimmed decoded string is a URL, make it clickable
  178. if (isURL(trimmedText)) {
  179. // Replace the line with the decoded and linked text
  180. decryptedText = decryptedText.replace(line, '<a href="' + trimmedText + '">' + trimmedText + '</a>');
  181. modified = true;
  182. }
  183. } catch (error) {
  184. // If an error occurs during decoding, show it in an alert message
  185. //alert("Unable to decode the string: " + textInsideBackticks);
  186. }
  187. }
  188. }
  189. });
  190.  
  191. // If modifications were made, show modified text in the page
  192. if (modified) {
  193. prettyPrintElement.innerHTML = decryptedText;
  194. }
  195.  
  196. } else {
  197. setTimeout(waitForDecryption, 500); // Check again in 500ms
  198. }
  199. }
  200.  
  201. // Start waiting for decryption
  202. waitForDecryption();
  203. }
  204.  
  205.  
  206.  
  207.  
  208.  
  209. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址