const crypto = require("crypto"); const fs = require("fs"); // Add all bot usernames here. const USERNAMES = [ "ZareMate", "Tomek", "Cytrus", "Qawe", "Bot", "Skybloczek", "Bronkol", ]; const homedir = require("os").homedir(); const HASHED_PROFILES_FOLDER = `${homedir}/.minecraft/nmp-cache`; function createHash(input) { return crypto .createHash("sha1") .update(input ?? "", "binary") .digest("hex") .substr(0, 6); } function checkIfHashedPresent(username) { const hash = createHash(username); const xblPath = `${HASHED_PROFILES_FOLDER}/${hash}_xbl-cache.json`; const mcaPath = `${HASHED_PROFILES_FOLDER}/${hash}_mca-cache.json`; const livePath = `${HASHED_PROFILES_FOLDER}/${hash}_live-cache.json`; const exists = fs.existsSync(xblPath) || fs.existsSync(mcaPath) || fs.existsSync(livePath); return { exists, hash }; } function checkAllHashedProfiles() { const results = {}; for (const username of USERNAMES) { const { exists, hash } = checkIfHashedPresent(username); results[username] = { hash, exists }; } return results; } console.log(checkAllHashedProfiles());