Skip to content

Instantly share code, notes, and snippets.

@DET171
Last active March 24, 2023 04:07
Show Gist options
  • Save DET171/90e8ab6ab746aca03c4f8d65dd8cf606 to your computer and use it in GitHub Desktop.
Save DET171/90e8ab6ab746aca03c4f8d65dd8cf606 to your computer and use it in GitHub Desktop.
Find the profile of a certain person on codebreaker.xyz
// install the required dependencies first:
// npm i common-tags axios jsom consola
// and finally run the program
// node find.js
// NOTE: This is ESM
import axios from 'axios';
import { stripIndents } from 'common-tags';
import { JSDOM } from 'jsdom';
import console from 'consola';
import boxen from 'boxen';
import chalk from 'chalk';
const personToFind = ['Chur', 'Zhe']; // person name here
const rankings = (await axios.get('https://codebreaker.xyz/rankings')).data;
const dom = new JSDOM(stripIndents(rankings).replace(/\n/g, ''));
const window = dom.window;
const document = window.document;
const hrefs = [];
console.info('[+] Parsing profile links...');
[].forEach.call(document.getElementsByTagName('a'), ({ href }, index) => {
if (index <= 15) return;
hrefs.push(href);
});
console.success('[+] Parsed.');
console.info('[+] Fetching profiles...');
for (let i = 0; i < hrefs.length; i++) {
const profileLink = hrefs[i];
console.info(`[${i + 1}] Fetching ${profileLink.replace('/profile/', '')}'s profile...`);
const { data } = await axios.get(encodeURI(`https://codebreaker.xyz/${profileLink}`));
if (personToFind.every(person => data.toLowerCase().includes(person.toLowerCase()))) {
console.log(boxen(stripIndents`
${chalk.green.bold('SUCCESS')}
${personToFind.join(' ')} was found!
${'Profile link:'} ${chalk.blue(`https://codebreaker.xyz/${profileLink}`)}
${'Username:'} ${profileLink.replace('/profile/', '')}
`, { padding: 1, borderColor: 'green' }));
process.exit(0);
}
else {
continue;
}
}
console.log(boxen(stripIndents`
${chalk.red.bold('FAILED :(')}
${personToFind.join(' ')} was not found.
`,
{
padding: 1,
borderColor: 'red'
}));
@DET171
Copy link
Author

DET171 commented Apr 30, 2022

Well let's hope that the codebreaker admins and superadmins don't go ballistic when they see this

@dvdg6566
Copy link

Well let's hope that the codebreaker admins and superadmins don't go ballistic when they see this

why y'all despo to do stalking :(

@DET171
Copy link
Author

DET171 commented Mar 24, 2023

Well let's hope that the codebreaker admins and superadmins don't go ballistic when they see this

why y'all despo to do stalking :(

It was more of a bet (:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment