Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions tutorials/scripts/SSID_Fetcher_UserScript.user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// ==UserScript==
// @name PocketOption SSID Fetcher
// @namespace SixsPocketOptionSSIDFetcher
// @match *://pocketoption.com/*
// @match *://*.pocketoption.com/*
// @grant none
// @version 1.2
// @author Six
// @description Intercepts auth SSID from PocketOption
// ==/UserScript==

(function() {
'use strict';

const originalSend = WebSocket.prototype.send;

WebSocket.prototype.send = function(data) {
if (typeof data === 'string' && data.startsWith('42["auth",')) {
try {
const jsonStr = data.substring(2);
const parsedData = JSON.parse(jsonStr);

if (parsedData[0] === 'auth' && parsedData[1] && parsedData[1].session) {
const ssid = parsedData[1].session;

// Ask the user before showing sensitive info (basic security check)
const userwantsToShow = confirm("SSID Intercepted. Would you like to display the Session ID (SSID)?");

if (userwantsToShow) {
alert("Your SSID is:\n\n" + ssid);
} else {
console.log("[SSID Fetcher] Display dismissed by user.");
}
Comment on lines +27 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Displaying the SSID in an alert box is not very user-friendly, as it's difficult to copy the long string. A better user experience would be to copy the SSID to the clipboard directly and notify the user. This also improves the variable naming to follow camelCase convention.

Important: To use GM_setClipboard, you'll also need to update the script's metadata by changing line 6 from // @grant none to // @grant GM_setClipboard.

                    const userWantsToCopy = confirm("SSID Intercepted. Would you like to copy the Session ID (SSID) to your clipboard?");

                    if (userWantsToCopy) {
                        GM_setClipboard(ssid);
                        alert("Your SSID has been copied to the clipboard.");
                    } else {
                        console.log("[SSID Fetcher] SSID copy dismissed by user.");
                    }

}
} catch (e) {
// Ignore parsing errors to prevent site disruption
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Silently ignoring errors in the catch block makes debugging difficult if the website's API changes. It's better to log these errors to the console. This won't disrupt the site's functionality for users but will be very helpful for troubleshooting.

                console.error("[SSID Fetcher] Error parsing WebSocket message:", e);

}
}

return originalSend.apply(this, arguments);
};

console.log('[SSID Fetcher] Hooked and waiting for authentication...');
})();
Loading