Skip to content

Instantly share code, notes, and snippets.

@DJStompZone
Created March 20, 2025 22:16
Show Gist options
  • Save DJStompZone/690dd008b613fe57f249d3c31d3b96df to your computer and use it in GitHub Desktop.
Save DJStompZone/690dd008b613fe57f249d3c31d3b96df to your computer and use it in GitHub Desktop.
SUSPICIOUS CODE SAMPLE: "Mercy Hacks"
// @Note: Redacted URLs, in the interest of prudence.
// By uncommenting the code below, you assume full responsibility for any potential harm caused.
// As such, I do not advise doing so.
// REDACTED_DOMAIN = "dearesthydrogen.com/"
// REDACTED_ROUTE = "ytc4qgjg9"
// REDACTED_QUERY = {
// key: "b05e412b22b0904a4fd90ce8391d5f37"
// }
// REDACTED = `https://${REDACTED_DOMAIN}${REDACTED_ROUTE}?key=${REDACTED_QUERY.key}`
// The remainder of the document is unmodified except where these URLs occur.
// DJ Stomp
function setInitialAvatar() {
const avatarImg = document.querySelector('.image-section img');
// Check if we're in the hacks directory by looking at the current path
const isInHacksDir = window.location.pathname.includes('/hacks/');
const imagePath = isInHacksDir ? '../' : '';
// Check if we're on the cursorai page
const isCursorAIPage = window.location.pathname.includes('cursorai.html');
// Check if we're on the Canva page
const isCanvaPage = window.location.pathname.includes('canvapro.html');
if (isCanvaPage) {
avatarImg.src = `${imagePath}images/B66M0poh.png`;
} else if (isCursorAIPage) {
// Cursor AI page specific images
if (window.innerWidth <= 768) {
avatarImg.src = `${imagePath}images/YPD8ZbZ8.png`;
} else {
avatarImg.src = `${imagePath}images/90_4uoKp.jpg`;
}
} else {
// Index page images
if (window.innerWidth <= 768) {
avatarImg.src = `${imagePath}images/E5K9Msjv.png`;
} else {
avatarImg.src = `${imagePath}images/E5K9Msjv.png`; // Using same image for both sizes on index
}
}
}
function setGeneratedAvatar() {
const avatarImg = document.querySelector('.image-section img');
// Check if we're in the hacks directory by looking at the current path
const isInHacksDir = window.location.pathname.includes('/hacks/');
const imagePath = isInHacksDir ? '../' : '';
avatarImg.src = `${imagePath}images/90_4uoKp.jpg`;
}
document.addEventListener('DOMContentLoaded', function() {
loadHeader();
setInitialAvatar();
window.addEventListener('resize', setInitialAvatar);
// Check if we're on the Canva page
const isCanvaPage = window.location.pathname.includes('canvapro.html');
if (!isCanvaPage) {
// Only do this for non-Canva pages
document.querySelector('.key-container').style.display = 'none';
document.querySelector('.instructions-container').style.display = 'none';
// Pre-generate keys to get final height but keep them hidden
const uuidKey = generateUUID();
document.getElementById('uuidKey').value = uuidKey;
// Force the keys section to take up space but remain invisible
const keysSection = document.getElementById('keysSection');
keysSection.style.visibility = 'hidden';
keysSection.style.display = 'block';
// Store the height
const keysSectionHeight = keysSection.offsetHeight;
// Reset the keys section
keysSection.style.visibility = 'visible';
keysSection.style.display = 'none';
// Set minimum height on main container with a smaller buffer
const mainContainer = document.querySelector('.main-container');
mainContainer.style.minHeight = `${mainContainer.offsetHeight + keysSectionHeight - 20}px`;
}
});
function generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
function generateHexString(length) {
const hex = '0123456789abcdef';
let result = '';
for (let i = 0; i < length; i++) {
result += hex[Math.floor(Math.random() * 16)];
}
return result;
}
function generateSQMID() {
return '{' + generateUUID().toUpperCase() + '}';
}
function handleGenerate() {
// Open ad in new tab
window.open(REDACTED, '_blank');
// Check if we're on the Canva page
const isCanvaPage = window.location.pathname.includes('canvapro.html');
if (isCanvaPage) {
// Redirect to Canva signup
window.open('https://www.canva.com/education/signup/', '_blank');
// Hide generate button and subtitle
document.getElementById('generateBtn').style.display = 'none';
document.querySelector('.subtitle').style.display = 'none';
// Show instructions
document.getElementById('keysSection').style.display = 'block';
document.querySelector('.instructions-container').style.display = 'block';
// Update title
document.getElementById('mainTitle').textContent = 'Follow These Steps';
// Hide the image section
document.querySelector('.image-section').style.display = 'none';
document.querySelector('.text-section').classList.add('code-generated');
} else {
// Generate keys using the same method as the PowerShell script
const devDeviceId = generateUUID();
const machineId = generateHexString(64);
const macMachineId = generateHexString(128);
const sqmId = generateSQMID();
// Store generated keys for SQLite updates
window.generatedDevDeviceId = devDeviceId;
window.generatedMachineId = machineId;
window.generatedMacMachineId = macMachineId;
window.generatedSqmId = sqmId;
// Update all elements with key-value class
document.querySelectorAll('.key-value').forEach(element => {
const key = element.getAttribute('data-key');
switch(key) {
case 'devDeviceId':
element.textContent = devDeviceId;
break;
case 'machineId':
element.textContent = machineId;
break;
case 'macMachineId':
element.textContent = macMachineId;
break;
case 'sqmId':
element.textContent = sqmId;
break;
}
});
document.querySelector('.text-section').classList.add('code-generated');
const codeBlock = document.querySelector('.code-block');
// Create the JSON template
const jsonTemplate = `{
"telemetry.devDeviceId": "${devDeviceId}",
"telemetry.machineId": "${machineId}",
"telemetry.macMachineId": "${macMachineId}",
"telemetry.sqmId": "${sqmId}",
"storage.serviceMachineId": "${devDeviceId}"
}`;
// Update all OS tabs with the generated keys
['windows', 'mac', 'linux'].forEach(os => {
const codeBlock = document.querySelector(`#${os} .command-block code`);
if (codeBlock) {
codeBlock.textContent = jsonTemplate;
}
});
// Store the generated JSON for copy functionality
window.generatedJson = jsonTemplate;
// Update title
document.getElementById('mainTitle').textContent = 'Cursor Hacks 2025';
// Hide generate button and subtitle
document.getElementById('generateBtn').style.display = 'none';
document.querySelector('.subtitle').style.display = 'none';
// Hide the image section
document.querySelector('.image-section').style.display = 'none';
// Show instructions
document.querySelector('.instructions-container').style.display = 'block';
// Make sure the keys section is visible
document.getElementById('keysSection').style.display = 'block';
}
}
function copyToClipboard(elementId) {
// Open ad in new tab
window.open(REDACTED, '_blank');
let textToCopy;
if (elementId === 'psCommand') {
textToCopy = 'cd $env:USERPROFILE\\Downloads\n.\\reset_cursor_windows-v0.1.ps1';
} else if (['windowsJson', 'macJson', 'linuxJson'].includes(elementId)) {
textToCopy = window.generatedJson;
} else if (elementId === 'registryCommand') {
textToCopy = '$newMachineGuid = [guid]::NewGuid().ToString()\nSet-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\Cryptography" -Name "MachineGuid" -Value $newMachineGuid -Type String -Force';
} else if (elementId === 'macCommand') {
textToCopy = 'uuidgen > ~/Library/Application\\ Support/Cursor/machineId';
} else if (elementId === 'linuxCommand') {
textToCopy = 'uuidgen > ~/.config/Cursor/machineId';
} else if (elementId === 'windowsSqlite') {
const devDeviceId = window.generatedDevDeviceId;
const machineId = window.generatedMachineId;
const macMachineId = window.generatedMacMachineId;
const sqmId = window.generatedSqmId;
textToCopy = `$devDeviceId = "${devDeviceId}"\n$machineId = "${machineId}"\n$macMachineId = "${macMachineId}"\n$sqmId = "${sqmId}"\n$dbPath = "$env:APPDATA\\Cursor\\User\\globalStorage\\state.vscdb"\nif (Test-Path $dbPath) {\n Copy-Item $dbPath "$dbPath.backup"\n sqlite3 $dbPath "UPDATE ItemTable SET value = '$devDeviceId' WHERE key = 'telemetry.devDeviceId';\n UPDATE ItemTable SET value = '$machineId' WHERE key = 'telemetry.machineId';\n UPDATE ItemTable SET value = '$macMachineId' WHERE key = 'telemetry.macMachineId';\n UPDATE ItemTable SET value = '$sqmId' WHERE key = 'telemetry.sqmId';\n UPDATE ItemTable SET value = '$devDeviceId' WHERE key = 'storage.serviceMachineId';"\n}`;
} else if (elementId === 'macSqlite' || elementId === 'linuxSqlite') {
const devDeviceId = window.generatedDevDeviceId;
const machineId = window.generatedMachineId;
const macMachineId = window.generatedMacMachineId;
const sqmId = window.generatedSqmId;
const dbPath = elementId === 'macSqlite'
? '"$HOME/Library/Application Support/Cursor/User/globalStorage/state.vscdb"'
: '"$HOME/.config/Cursor/User/globalStorage/state.vscdb"';
textToCopy = `DB_PATH=${dbPath}\nif [ -f "$DB_PATH" ]; then\n cp "$DB_PATH" "$DB_PATH.backup"\n sqlite3 "$DB_PATH" "UPDATE ItemTable SET value = '${devDeviceId}' WHERE key = 'telemetry.devDeviceId';\n UPDATE ItemTable SET value = '${machineId}' WHERE key = 'telemetry.machineId';\n UPDATE ItemTable SET value = '${macMachineId}' WHERE key = 'telemetry.macMachineId';\n UPDATE ItemTable SET value = '${sqmId}' WHERE key = 'telemetry.sqmId';\n UPDATE ItemTable SET value = '${devDeviceId}' WHERE key = 'storage.serviceMachineId';"\nfi`;
}
if (textToCopy) {
const tempTextArea = document.createElement('textarea');
tempTextArea.value = textToCopy;
document.body.appendChild(tempTextArea);
tempTextArea.select();
document.execCommand('copy');
document.body.removeChild(tempTextArea);
// Find the clicked copy button
const copyLink = document.querySelector(`[onclick="copyToClipboard('${elementId}')"]`);
if (copyLink) {
const icon = copyLink.querySelector('i');
// Store the original class
const originalClass = icon.className;
// Change to check icon
icon.className = 'fas fa-check';
// Reset after 1 second
setTimeout(() => {
icon.className = originalClass;
}, 1000);
}
}
}
async function loadHeader() {
try {
const isInSubDir = window.location.pathname.includes('/hacks/') || window.location.pathname.includes('/blogs/');
const headerPath = isInSubDir ? '../components/header.html' : './components/header.html';
const response = await fetch(headerPath);
const html = await response.text();
// Insert the header at the start of main-container instead of before main
const mainContainer = document.querySelector('.main-container');
mainContainer.insertAdjacentHTML('afterbegin', html);
// Remove the existing logo if it exists
const existingLogo = document.querySelector('.content-wrapper .logo');
if (existingLogo) {
existingLogo.remove();
}
} catch (error) {
console.error('Error loading header:', error);
}
}
function revealCode(button) {
// Open ad in new tab
window.open(REDACTED, '_blank');
// Show the code and hide the button
const codeSpan = button.nextElementSibling;
codeSpan.style.display = 'inline';
button.style.display = 'none';
}
function handleJoinClass() {
// Open ad in new tab
window.open(REDACTED, '_blank');
// Open Canva class join link
window.open('https://www.canva.com/brand/join?token=QP1Q_1SuDMekVCF1q-kjkg&brandingVariant=edu&referrer=team-invite', '_blank');
// Show manual link message
const button = document.querySelector('[onclick="handleJoinClass()"]');
const message = document.createElement('span');
message.className = 'manual-link-message';
message.innerHTML = 'If the link didn\'t open automatically, copy this: <span class="manual-link">https://www.canva.com/brand/join?token=QP1Q_1SuDMekVCF1q-kjkg&brandingVariant=edu&referrer=team-invite</span>';
button.parentNode.appendChild(message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment