Advertisement
MeKLiN2

hsscharlie2

Jan 28th, 2024
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. // ==UserScript==
  2. // @name HSSCharlie
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-01-28
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://stumblechat.com/room/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=stumblechat.com
  9. // @grant GM_setClipboard
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Intercept WebSocket constructor to extract WebSocket URL
  16. const originalWebSocket = window.WebSocket;
  17. window.WebSocket = function(url, protocols) {
  18. // Call original constructor
  19. const ws = new originalWebSocket(url, protocols);
  20.  
  21. // Log WebSocket URL
  22. console.log('WebSocket URL:', url);
  23.  
  24. // Return WebSocket object
  25. return ws;
  26. };
  27.  
  28. // Function to display WebSocket URL in a DIV
  29. function displayWebSocketURL(webSocketURL) {
  30. // Create a DIV to display WebSocket URL
  31. const div = document.createElement('div');
  32. div.style.cssText = 'position: fixed; top: 20px; left: 20px; z-index: 9999; background-color: white; border: 1px solid black; padding: 10px; max-height: 200px; overflow-y: auto;';
  33. div.innerHTML = `
  34. <p>WebSocket URL:</p>
  35. <textarea id="webSocketURL" readonly style="width: 100%; height: 100px; margin-bottom: 10px;">${webSocketURL}</textarea>
  36. <button id="saveButton">Save to Clipboard</button>
  37. `;
  38. document.body.appendChild(div);
  39.  
  40. // Add event listener to save button
  41. const saveButton = div.querySelector('#saveButton');
  42. saveButton.addEventListener('click', () => {
  43. const webSocketURLTextArea = div.querySelector('#webSocketURL');
  44. GM_setClipboard(webSocketURLTextArea.value);
  45. alert('WebSocket URL copied to clipboard!');
  46. });
  47. }
  48.  
  49. // Call the function to display WebSocket URL
  50. displayWebSocketURL('wss://wss1.stumblechat.com/'); // Assuming a static URL for demonstration
  51.  
  52. })();
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement