Advertisement
Guest User

Untitled

a guest
Feb 26th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.18 KB | None | 0 0
  1.  
  2. const utils = require("../bin/utils.js");
  3. const config = utils.config;
  4. const discord = utils.discord;
  5.  
  6. const mysql = utils.mysql;
  7. const request = utils.request;
  8. const http = utils.http;
  9. const https = utils.https;
  10. //const Agent = utils.Agent;
  11. var HttpsProxyAgent= utils.HttpsProxyAgent;
  12. var md5 = utils.md5;
  13. const randomstring = utils.randomstring;
  14.  
  15. var fs = require('fs')
  16.  
  17. var good_discs = utils.uniq_fast(config.discordOGTags);
  18. var shit_tiers = new Array();
  19. let users = [];
  20. let emails = [];
  21.  
  22. var account_batch = new Array();
  23. var proxies_tested = new Array();
  24. let proxies_temp = utils.uniq_fast(utils.replaceAll(fs.readFileSync("proxy.txt", "UTF-8"), '\r' , '').split("\n"));
  25. for(var i = 0; i < proxies_temp.length; i++) { proxies_temp = utils.shuffleArray(proxies_temp); }
  26. const proxies_loaded = JSON.parse(JSON.stringify(proxies_temp));
  27.  
  28. const reqRegistOptions = {
  29. "uri": config.registrationUrl,
  30. "method": "POST",
  31. "headers": {
  32. "authority": "discordapp.com",
  33. "method": "POST",
  34. "scheme": "https",
  35. "path": "/api/v6/auth/register",
  36. "accept-encoding": "gzip, deflate, br",
  37. "referer": "https://discordapp.com/register",
  38. "accept": "*/",
  39. "accept-language": "en-US",
  40. "content-type": "application/json",
  41. "origin": "https://discordapp.com",
  42. "user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
  43. "x-fingerprint": config.fingerprint,
  44. "x-super-properties": "eyJvcyI6IldpbmRvd3MiLCJicm93c2VyIjoiQ2hyb21lIiwiZGV2aWNlIjoiIiwicmVmZXJyZXIiOiIiLCJyZWZlcnJpbmdfZG9tYWluIjoiIn0=",
  45. },
  46. "body": "",
  47. "json": {},
  48. "maxRedirects": 20,
  49. "proxy": "",
  50. "followRedirect": true,
  51. "timeout": 70000,
  52. };
  53.  
  54.  
  55. const reqChangeUsernameOptions = {
  56. "uri": config.checkUrl,
  57. "method": "PATCH",
  58. "headers": {
  59. "method": "PATCH",
  60. "content-type": "application/json",
  61. },
  62. "proxy": "",
  63. "followRedirect": false,
  64. "timeout": 16000,
  65. }
  66.  
  67. const reqCheckOptions = {
  68. "uri": config.checkUrl,
  69. "method": "GET",
  70. "headers": {
  71. "method": "GET",
  72. },
  73. "proxy": "",
  74. "followRedirect": false,
  75. "timeout": 20000,
  76. }
  77. const twocapInOptions = {
  78. "method": "POST",
  79. "url": config["2captchainurl"] + "?key=" + config["2captchaApi"] + "&method=userrecaptcha&googlekey=" + config.discordGoogleKey + "&pageurl=https://discordapp.com/&json=1",
  80. "headers": {
  81. "accept": "*/*",
  82. "authority": "2captcha.com",
  83. "content-type": "application/json",
  84. "accept-language": "en-US",
  85. "method": "POST",
  86. },
  87. };
  88. const twocapOutOptions = {
  89. "method": "GET",
  90. "url": config["2captchaouturl"] + "?key=" + config["2captchaApi"] + "&json=1&action=get&id=",
  91. "headers": {
  92. "accept": "*/*",
  93. "authority": "2captcha.com",
  94. "content-type": "application/json",
  95. "accept-language": "en-US",
  96. "method": "GET",
  97. },
  98.  
  99. };
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107. function CheckAllAccounts() {
  108. if(haltDbSaves === true || config.farmMode === true) return;
  109. if(proxies_tested.length > 0) {
  110. //console.log("CheckAllAccounts");
  111. //var q = "SELECT * FROM " + config.dbConData["table"] + " WHERE discriminator IS NULL";
  112. var q = "SELECT * FROM " + config.dbConData["table"] + "";
  113. //good_discs.forEach(function(disc) { if(typeof(disc) === "string") { if(disc.length === 4) {q += " OR discriminator LIKE '" + disc + "'";}}});
  114.  
  115.  
  116. utils.RunQuery(q).then(data => {
  117. // do stuff
  118. let maxr = 9500-(9999-config.accountDiscrimsFreeSlots);
  119. let data_new = new Array();
  120.  
  121. let runs = 0;
  122. for(var i = 0; i < data.length; i++) {
  123. if(runs > (Math.round(maxr/2))) continue;
  124. if(typeof(data[i]) !== "object") continue;
  125. let val = data[i];
  126. let ps = true;
  127. if(typeof(val["discriminator"]) === "string") {
  128. if(val["username"] === config.discrimForcerUsername && good_discs.includes(val["discriminator"]) === true) {
  129. if(typeof(val["date_lastchecked"]) === "string") {
  130. let diff = new Date() - new Date(val["date_lastchecked"]);
  131. if(diff < 30*60*1000) { ps = false; }
  132. }
  133. if(ps === true) { data_new.push(val); runs++; }
  134. }
  135. }
  136. }
  137.  
  138.  
  139. for(var i = 0; i < data.length; i++) {
  140. if(runs > (Math.round(maxr/4))) continue;
  141. if(typeof(data[i]) !== "object") continue;
  142. let val = data[i];
  143. let ps = true;
  144. if(typeof(val["discriminator"]) === "string") {
  145. if((val["username"] !== config.discrimForcerUsername && good_discs.includes(val["discriminator"]) === false) || (val["username"] !== config.discrimForcerUsername && shit_tiers.includes(val["discriminator"]) === true)) {
  146. if(typeof(val["date_lastchecked"]) === "string") {
  147. let diff = new Date() - new Date(val["date_lastchecked"]);
  148. if(diff < 30*60*1000) { ps = false; }
  149. }
  150. if(ps === true) { data_new.push(val); runs++; }
  151. }
  152. }
  153. }
  154.  
  155. for(var i = 0; i < data.length; i++) {
  156. if(typeof(data[i]) !== "object") continue;
  157. let val = data[i];
  158. let ps = true;
  159. if(typeof(val["discriminator"]) !== "string") {
  160. if(typeof(val["date_lastchecked"]) === "string") {
  161. let diff = new Date() - new Date(val["date_lastchecked"]);
  162. if(diff < 30*60*1000) { ps = false; }
  163. }
  164. if(ps === true) { data_new.push(val); }
  165. }
  166. }
  167. console.log(data.length + " | " + data_new.length + " | " + maxr);
  168. data = data_new;
  169. runs = 0;
  170.  
  171. for(let i = 0; i < data.length; i++) {
  172. if(runs > maxr || maxr < 1) continue;
  173. if(typeof(data[i]) === "object") {
  174. let val = data[i];
  175. let docont = false;
  176. if(typeof(val["discriminator"]) !== "string") {
  177. docont = true;
  178. } else {
  179. if(typeof(val["username"]) === "string") {
  180. if((val["username"] !== config.discrimForcerUsername && shit_tiers.includes(val["discriminator"]) === true) || (val["username"] !== config.discrimForcerUsername && good_discs.includes(val["discriminator"]) === false) || (val["username"] === config.discrimForcerUsername && good_discs.includes(val["discriminator"]) === true)) {
  181. docont = true;
  182. }
  183. }
  184. }
  185. if(typeof(val["date_lastchecked"]) === "string") {
  186. let diff = new Date() - new Date(val["date_lastchecked"]);
  187. if(diff < 30*60*1000) {
  188. docont = false;
  189. }
  190. }
  191. if(docont === true) {
  192. runs++;
  193. CheckUser(proxies_tested[Math.floor(Math.random() * proxies_tested.length)], val["token"], val["password"], val["date_changedname"]).then(res => {
  194. let val2;
  195. data.forEach(function(vll) {
  196. if(typeof(vll) === "object") {
  197. if(vll["email"] === res["email"]) {
  198. val2 = vll;
  199. }
  200. }
  201. });
  202. if(typeof(val2) === "object") {
  203. let f = false;
  204. if(account_batch.length > 0) {
  205. account_batch.forEach(function(vl3) {
  206. if(typeof(vl3) === "object") {
  207. if(typeof(vl3["email"]) === "string" && typeof(vl3["password"]) === "string") {
  208. if(vl3["email"] === val2["email"] && vl3["password"] === val2["password"]) {
  209. f = true;
  210. }
  211. }
  212. }
  213. });
  214. }
  215. if(f === false) {
  216. let dtlastname = null;
  217. if(typeof(res["username"]) === "string") {
  218. if(res["username"] !== val2["username"]) {
  219. val2["username"] = res["username"];
  220. }
  221. }
  222. if(typeof(res["discriminator"]) === "string") {
  223. if(res["discriminator"] !== val2["discriminator"]) {
  224. dtlastname = String(new Date());
  225. }
  226. }
  227. //console.log("Fixed problem!");
  228. account_batch.push({
  229. "id": res["id"],
  230. "discriminator": res["discriminator"],
  231. "date_lastchecked": new Date(),
  232. "date_created": val2["date_created"],
  233. "email": val2["email"],
  234. "username": val2["username"],
  235. "password": val2["password"],
  236. "token": val2["token"],
  237. "date_changedname": dtlastname,
  238. });
  239. //console.log("pushed!");
  240. }
  241. }
  242. }).catch(e => { /* console.error(e); */ });
  243. }
  244. }
  245. }
  246. });
  247. }
  248. }
  249. function SaveGoodDiscrimsToFile() {
  250. utils.RunQuery("SELECT * from " + config.dbConData["table"] + " WHERE discriminator IS NOT NULL").then(data => {
  251. let txtw = "**File containing decent discrims in the database.\nFormat: Discriminator\n\n";
  252. let txtp = "**File containing decent discrims in the database.\nFormat: Discriminator | Userid | Username | Password | Email | Token | Date Created\n\n";
  253. let ogs = new Array(new Array(), new Array());
  254. let rep4s = new Array(new Array(), new Array());
  255. let rep3s = new Array(new Array(), new Array());
  256. let rep24s = new Array(new Array(), new Array());
  257. let rep2s = new Array(new Array(), new Array());
  258. let others = new Array(new Array(), new Array());
  259. for(var asd = 0; asd < data.length; asd++) {
  260. let val = data[asd];
  261. if(typeof(val) !== "object") continue;
  262. if(typeof(config.discrimForcerUsername) === "string") { if(config.discrimForcerUsername !== "" && config.discrimForcerUsername.length > 4) { if(val["username"] === config.discrimForcerUsername) continue;}}
  263.  
  264. let og = false; // check if is OG
  265.  
  266. config.discordOGTags.forEach(function(vlc) {
  267. if(typeof(vlc) === "string") {
  268. if(vlc === val["discriminator"]) {
  269. og = true;
  270. }
  271. }
  272. });
  273. let disc = val["discriminator"].split("");
  274. let reps = {};
  275.  
  276. let repeats_2 = 0; // amount of times 2 chars are repeated. max 2, 2+2 = 4
  277. let repeats_3 = false; // If there's a 3number repetition
  278. let rep_4 = false; // if there's a 4number repetition
  279.  
  280. if(og === false) {
  281. for(var i = 0; i < disc.length; i++) {
  282. let thisch = disc[i];
  283. if(typeof(reps[thisch]) === "number") {
  284. reps[thisch] ++;
  285. } else {
  286. reps[thisch] = 1;
  287. }
  288. }
  289. //console.log(reps);
  290. for(let key in reps) {
  291. let obj = reps[key];
  292. if(obj === 4) {
  293. rep_4 = true;
  294. } else if(obj === 3) {
  295. repeats_3 = true;
  296. } else if(obj === 2) {
  297. repeats_2++;
  298. }
  299. }
  300. }
  301.  
  302. //if(rep_4 === true || og === true || repeats_3 === true || repeats_2 === 2) { console.log("Decent discrim: " + val["discriminator"]); }
  303.  
  304. if(og === true) {
  305. ogs[0].push(val["discriminator"]);
  306. ogs[1].push(val["discriminator"] + " | " + val["id"] + " | " + val["username"] + " | " + val["password"] + " | " + val["email"] + " | " + val["token"] + " | " + val["date_created"]);
  307. } else if(rep_4 === true) {
  308. rep4s[0].push(val["discriminator"]);
  309. rep4s[1].push(val["discriminator"] + " | " + val["id"] + " | " + val["username"] + " | " + val["password"] + " | " + val["email"] + " | " + val["token"] + " | " + val["date_created"]);
  310. } else if(repeats_3 === true) {
  311. rep3s[0].push(val["discriminator"]);
  312. rep3s[1].push(val["discriminator"] + " | " + val["id"] + " | " + val["username"] + " | " + val["password"] + " | " + val["email"] + " | " + val["token"] + " | " + val["date_created"]);
  313. } else if(repeats_2 === 2) {
  314. rep24s[0].push(val["discriminator"]);
  315. rep24s[1].push(val["discriminator"] + " | " + val["id"] + " | " + val["username"] + " | " + val["password"] + " | " + val["email"] + " | " + val["token"] + " | " + val["date_created"]);
  316. } else if(repeats_2 === 1) {
  317. rep2s[0].push(val["discriminator"]);
  318. rep2s[1].push(val["discriminator"] + " | " + val["id"] + " | " + val["username"] + " | " + val["password"] + " | " + val["email"] + " | " + val["token"] + " | " + val["date_created"]);
  319. } else {
  320. others[0].push(val["discriminator"]);
  321. others[1].push(val["discriminator"] + " | " + val["id"] + " | " + val["username"] + " | " + val["password"] + " | " + val["email"] + " | " + val["token"] + " | " + val["date_created"]);
  322. }
  323. }
  324. let orig = JSON.parse(JSON.stringify(ogs[0]));
  325. ogs[0] = utils.uniq_fast(ogs[0]);
  326. for(var i = 0; i < ogs[0].length; i++) {
  327. if(typeof(ogs[0][i]) === "string") {
  328. let cc = utils.countInArray(orig, ogs[0][i]);
  329. if(cc > 1) {
  330. ogs[0][i] = ogs[0][i] + " (" + cc + ")";
  331. }
  332. }
  333. }
  334.  
  335. orig = JSON.parse(JSON.stringify(rep4s[0]));
  336. rep4s[0] = utils.uniq_fast(rep4s[0]);
  337. for(var i = 0; i < rep4s[0].length; i++) {
  338. if(typeof(rep4s[0][i]) === "string") {
  339. let cc = utils.countInArray(orig, rep4s[0][i]);
  340. if(cc > 1) {
  341. rep4s[0][i] = rep4s[0][i] + " (" + cc + ")";
  342. }
  343. }
  344. }
  345.  
  346. orig = JSON.parse(JSON.stringify(rep3s[0]));
  347. rep3s[0] = utils.uniq_fast(rep3s[0]);
  348. for(var i = 0; i < rep3s[0].length; i++) {
  349. if(typeof(rep3s[0][i]) === "string") {
  350. let cc = utils.countInArray(orig, rep3s[0][i]);
  351. if(cc > 1) {
  352. rep3s[0][i] = rep3s[0][i] + " (" + cc + ")";
  353. }
  354. }
  355. }
  356. orig = JSON.parse(JSON.stringify(rep24s[0]));
  357. rep24s[0] = utils.uniq_fast(rep24s[0]);
  358. for(var i = 0; i < rep24s[0].length; i++) {
  359. if(typeof(rep24s[0][i]) === "string") {
  360. let cc = utils.countInArray(orig, rep24s[0][i]);
  361. if(cc > 1) {
  362. rep24s[0][i] = rep24s[0][i] + " (" + cc + ")";
  363. }
  364. }
  365. }
  366.  
  367. orig = JSON.parse(JSON.stringify(rep2s[0]));
  368. rep2s[0] = utils.uniq_fast(rep2s[0]);
  369. for(var i = 0; i < rep2s[0].length; i++) {
  370. if(typeof(rep2s[0][i]) === "string") {
  371. let cc = utils.countInArray(orig, rep2s[0][i]);
  372. if(cc > 1) {
  373. rep2s[0][i] = rep2s[0][i] + " (" + cc + ")";
  374. }
  375. }
  376. }
  377.  
  378. orig = JSON.parse(JSON.stringify(others[0]));
  379. others[0] = utils.uniq_fast(others[0]);
  380. for(var i = 0; i < others[0].length; i++) {
  381. if(typeof(others[0][i]) === "string") {
  382. let cc = utils.countInArray(orig, others[0][i]);
  383. if(cc > 1) {
  384. others[0][i] = others[0][i] + " (" + cc + ")";
  385. }
  386. }
  387. }
  388.  
  389.  
  390. let good = ogs[0].length+rep4s[0].length+rep3s[0].length+rep24s[0].length+rep2s[0].length;
  391. let useless = data.length-good;
  392. txtw += `Total accounts: ${data.length}\nGood accounts: ${good}\nUseless accounts: ${useless}\n\n`;
  393. txtp += `Total accounts: ${data.length}\nGood accounts: ${good}\nUseless accounts: ${useless}\n\n`;
  394. if(ogs[0].length > 0) {
  395. let pct = ogs[0].length/data.length;
  396. pct = Number((pct).toFixed(6));
  397. txtw += "\n-------------------\n <OG_TAGS> (" + ogs[0].length + " // " + pct + "%) \n-------------------"; ogs[0].forEach(function(vl) { txtw += "\n" + vl; }); txtw += "\n-------------------\n </OG_TAGS> \n-------------------";
  398. txtp += "\n-------------------\n <OG_TAGS> (" + ogs[1].length + " // " + pct + "%) \n-------------------"; ogs[1].forEach(function(vl) { txtp += "\n" + vl; }); txtp += "\n-------------------\n </OG_TAGS> \n-------------------";
  399. }
  400. if(rep4s[0].length > 0) {
  401. let pct = rep4s[0].length/data.length;
  402. pct = Number((pct).toFixed(6));
  403. txtw += "\n\n\n-------------------\n <REPEAT_4TIMES> (" + rep4s[0].length + " // " + pct + "%) \n-------------------"; rep4s[0].forEach(function(vl) { txtw += "\n" + vl; }); txtw += "\n-------------------\n </REPEAT_4TIMES> \n-------------------";
  404. txtp += "\n\n\n-------------------\n <REPEAT_4TIMES> (" + rep4s[1].length + " // " + pct + "%) \n-------------------"; rep4s[1].forEach(function(vl) { txtp += "\n" + vl; }); txtp += "\n-------------------\n </REPEAT_4TIMES> \n-------------------";
  405. }
  406. if(rep3s[0].length > 0) {
  407. let pct = rep3s[0].length/data.length;
  408. pct = Number((pct).toFixed(6));
  409. txtw += "\n\n\n-------------------\n <REPEAT_3TIMES> (" + rep3s[0].length + " // " + pct + "%) \n-------------------"; rep3s[0].forEach(function(vl) { txtw += "\n" + vl; }); txtw += "\n-------------------\n </REPEAT_3TIMES> \n-------------------";
  410. txtp += "\n\n\n-------------------\n <REPEAT_3TIMES> (" + rep3s[1].length + " // " + pct + "%) \n-------------------"; rep3s[1].forEach(function(vl) { txtp += "\n" + vl; }); txtp += "\n-------------------\n </REPEAT_3TIMES> \n-------------------";
  411. }
  412. if(rep24s[0].length > 0) {
  413. let pct = rep24s[0].length/data.length;
  414. pct = Number((pct).toFixed(6));
  415. txtw += "\n\n\n-------------------\n <REPEAT_2_2TIMES> (" + rep24s[0].length + " // " + pct + "%) \n-------------------"; rep24s[0].forEach(function(vl) { txtw += "\n" + vl; }); txtw += "\n-------------------\n </REPEAT_2_2TIMES> \n-------------------";
  416. txtp += "\n\n\n-------------------\n <REPEAT_2_2TIMES> (" + rep24s[1].length + " // " + pct + "%) \n-------------------"; rep24s[1].forEach(function(vl) { txtp += "\n" + vl; }); txtp += "\n-------------------\n </REPEAT_2_2TIMES> \n-------------------";
  417. }
  418. if(rep2s[0].length > 0) {
  419. let pct = rep2s[0].length/data.length;
  420. pct = Number((pct).toFixed(6));
  421. txtw += "\n\n\n-------------------\n <REPEAT_2TIMES> (" + rep2s[0].length + " // " + pct + "%) \n-------------------"; rep2s[0].forEach(function(vl) { txtw += "\n" + vl; }); txtw += "\n-------------------\n </REPEAT_2TIMES> \n-------------------";
  422. txtp += "\n\n\n-------------------\n <REPEAT_2TIMES> (" + rep2s[1].length + " // " + pct + "%) \n-------------------"; rep2s[1].forEach(function(vl) { txtp += "\n" + vl; }); txtp += "\n-------------------\n </REPEAT_2TIMES> \n-------------------";
  423. }
  424. if(others[0].length > 0) {
  425. let pct = others[0].length/data.length;
  426. pct = Number((pct).toFixed(6));
  427. txtw += "\n\n\n-------------------\n <TRASH> (" + others[0].length + " // " + pct + "%) \n-------------------"; others[0].forEach(function(vl) { txtw += "\n" + vl; }); txtw += "\n-------------------\n </TRASH> \n-------------------";
  428. txtp += "\n\n\n-------------------\n <TRASH> (" + others[1].length + ") \n-------------------"; others[1].forEach(function(vl) { txtp += "\n" + vl; }); txtp += "\n-------------------\n </TRASH> \n-------------------";
  429. }
  430.  
  431. if(fs.readFileSync("discrims.txt", "UTF-8") !== txtw) {
  432. fs.writeFileSync("discrims.txt", txtw);
  433. //console.log("Saved to file (public)!");
  434. }
  435. if(fs.readFileSync("discrims_private.txt", "UTF-8") !== txtp) {
  436. fs.writeFileSync("discrims_private.txt", txtp);
  437. //console.log("Saved to file (private)!");
  438. }
  439. });
  440. }
  441.  
  442.  
  443.  
  444.  
  445. function CheckUser(proxy, token, password, dtlastname) {
  446. if(config.farmMode === true) return;
  447. if(!proxy) { return; }
  448. if(!token) { return; }
  449. if(!password) { return; }
  450. return new Promise(function(fulfill, reject) {
  451. let opts = JSON.parse(JSON.stringify(reqCheckOptions));
  452. let agent_r = new HttpsProxyAgent("http://" + proxy);
  453. opts["agent"] = agent_r;
  454. opts["headers"]["authorization"] = token;
  455. request(opts, function(error, response, body) {
  456. try {
  457. if(error) { reject(error); return; }
  458. //console.log(body);
  459. //console.log(typeof(body));
  460. if(typeof(body) === "string") {
  461. body = JSON.parse(body);
  462. }
  463. if(typeof(body["code"]) === "undefined") {
  464. if(typeof(body["username"]) === "string") {
  465. let doname = false;
  466. if(typeof(config.discrimForcerUsername) === "string") {
  467. if(config.discrimForcerUsername !== "" && config.discrimForcerUsername.length > 4) {
  468. if((body["username"] !== config.discrimForcerUsername && shit_tiers.includes(body["discriminator"]) === true) || (body["username"] !== config.discrimForcerUsername && good_discs.includes(body["discriminator"]) !== true) || (body["username"] === config.discrimForcerUsername && good_discs.includes(body["discriminator"]) === true)) {
  469. doname = true;
  470. }
  471. }
  472. }
  473. if(typeof(dtlastname) === "string") {
  474. let diff = new Date() - new Date(dtlastname);
  475. if(diff < 24*60*60*1000) { doname = false; }
  476. }
  477. if(doname === false) { fulfill(body); } else {
  478. //console.log("changing name lole. curr = " + body["username"]);
  479. let curr = body["username"];
  480. let optsChg = JSON.parse(JSON.stringify(reqChangeUsernameOptions));
  481. optsChg["agent"] = agent_r;
  482. optsChg["headers"]["authorization"] = token;
  483. let nm = config.discrimForcerUsername;
  484. if(body["username"] === nm) {
  485. let lenusr = utils.getRandomInt(config.usernamelength, config.usernamemaxlen);
  486. nm = randomstring.generate(
  487. {
  488. length:lenusr,
  489. charset: 'alphanumeric',
  490. });
  491. console.log("new gen : " + nm);
  492. }
  493. let json_this = {
  494. "username": nm,
  495. "password": password,
  496. };
  497. optsChg["json"] = json_this;
  498. request(optsChg, function(error, response, body2) {
  499. try {
  500. if(error) { reject(error); return; }
  501. //console.log(body2);
  502. if(typeof(body2) === "string") {
  503. body2 = JSON.parse(body2);
  504. }
  505. if(typeof(body2) === "object") {
  506. if(typeof(body2["code"]) !== "undefined") {
  507. if(String(body2["code"]) === "40002") {
  508. if(typeof(body["discriminator"]) !== "undefined") {
  509. if(config.discordOGTags.includes(body["discriminator"]) === true) {
  510. console.log("WARNING : OG TAG '" + body["discriminator"] + "' IS STUCK. GO FIX MANUALLY!");
  511. process.exit();
  512. }
  513. }
  514. }
  515. }
  516. if(typeof(body2["username"]) === "string") {
  517. if(body2["username"] !== curr) {
  518. body["username"] = body2["username"];
  519. }
  520. if(typeof(body2["discriminator"]) !== "undefined") {
  521. if(body2["discriminator"] !== body["discriminator"]) {
  522. body["discriminator"] = body2["discriminator"];
  523. console.log("updated discrim!");
  524. }
  525. }
  526. }
  527. }
  528. fulfill(body);
  529.  
  530. } catch(e) { /* console.error(e); */ }
  531.  
  532. });
  533. }
  534. return;
  535. }
  536. }
  537. } catch(e) { /* console.error(e); */ }
  538. }).catch(e => { console.error(e); });
  539. });
  540. }
  541. function CheckSolveCaptcha(proxy, id) {
  542. if(!proxy) return;
  543. if(!id) return;
  544. return new Promise(function(fulfill, reject) {
  545. let optsOut = JSON.parse(JSON.stringify(twocapOutOptions));
  546. let agent_r = new HttpsProxyAgent("http://" + proxy);
  547. optsOut["agent"] = agent_r;
  548. optsOut["url"] = optsOut["url"] + id;
  549. let intCheckCap = setInterval(function() {
  550. request(optsOut, function(error, response, body) {
  551. try {
  552. body = JSON.parse(body);
  553. //console.log(body);
  554. if(error) { clearInterval(intCheckCap); reject(error); return; }
  555. if(typeof(body["status"]) !== "undefined") {
  556. if(String(body["status"]) === "1") {
  557. clearInterval(intCheckCap);
  558. fulfill(body["request"]);
  559. return;
  560. }
  561. }
  562. } catch(e) { /* */ }
  563.  
  564. });
  565. }, 10000);
  566. });
  567. }
  568. function SubmitCaptcha(proxy, red) {
  569. if(!proxy) return;
  570. if(!red) red = false;
  571. return new Promise(function(fulfill, reject) {
  572. let optsIn = JSON.parse(JSON.stringify(twocapInOptions));
  573. let agent_r = new HttpsProxyAgent("http://" + proxy);
  574. optsIn["agent"] = agent_r;
  575. //optsIn["url"] += "&proxy=" + proxy + "&proxytype=HTTPS";
  576. request(optsIn, function(error, response, body) {
  577. try {
  578. if(typeof(body) === "string") {
  579. body = JSON.parse(body);
  580. }
  581. if(error) { reject(error); return; }
  582. if(typeof(body["status"]) !== "undefined") {
  583. if(String(body["status"]) === "1") {
  584. fulfill(body["request"]);
  585. return;
  586. } else {
  587. if(body["request"] === "ERROR_NO_SLOT_AVAILABLE" && red === false) {
  588. SubmitCaptcha(proxy).then(k => {
  589. setTimeout(function() {
  590. fulfill(k, true);
  591. return;
  592. }, 5000);
  593. }).catch(e => {});
  594. }
  595. }
  596. }
  597. } catch(e) {
  598. if(red === false) {
  599. SubmitCaptcha(proxy).then(k => {
  600. setTimeout(function() {
  601. fulfill(k, true);
  602. return;
  603. }, 10000);
  604. }).catch(e => {});
  605. }
  606. }
  607. reject(body);
  608. });
  609. });
  610. }
  611.  
  612.  
  613.  
  614. function SolveACaptcha(proxy) {
  615. return new Promise(function(fulfill, reject) {
  616. SubmitCaptcha(proxy).then(id => {
  617. console.log("doit creator> captcha being solved");
  618. setTimeout(function() {
  619. CheckSolveCaptcha(proxy, id).then(key => {
  620. console.log("doit creator> [SUCCESS] solved a captcha");
  621. fulfill(key);
  622. }).catch(e => { console.error(e); reject(e); });
  623. }, 10000);
  624. }).catch(e => { console.error(e); });
  625. });
  626. }
  627.  
  628. function testProxy(proxy, url) {
  629. if(!proxy) return;
  630. if(!url) url = "http://www.google.com";
  631.  
  632. let agent_r = new HttpsProxyAgent("http://" + proxy);
  633.  
  634. return new Promise(function(fulfill) {
  635. // because Promise.all stops all work once a rejection is thrown...
  636. function reject(data) {
  637. fulfill({"error": true, "data": data, "proxy": proxy});
  638. }
  639. // To prevent infinite runs.
  640. setTimeout(function() { reject("script timeout"); return; }, 45000);
  641. request({
  642. uri: url,
  643. method: "GET",
  644. "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
  645. accept: "*/*",
  646. agent: agent_r,
  647. timeout: 35000,
  648. followRedirect: false,
  649. }, function(error, response, body) {
  650. //console.log("Error" + error);
  651. //console.log("Body: " + body);
  652. if(!error) { if(response) { if(response.statusCode === 200) { fulfill({ "body": body, "proxy": proxy }); return; } } }
  653. reject(error);
  654. return;
  655. });
  656. });
  657. }
  658.  
  659. function DoAccount(proxy, json) {
  660. if(config.farmMode === false) return;
  661. if(!proxy) return;
  662. if(!json) return;
  663.  
  664. let agent_r = new HttpsProxyAgent("http://" + proxy);
  665. let opts = JSON.parse(JSON.stringify(reqRegistOptions));
  666. opts["agent"] = agent_r;
  667. json["invite"] = config.discordInvite;
  668. if(typeof(config.discordInvite) === "null") {
  669. json["invite"] = "null";
  670. }
  671. opts["json"] = utils.mysql_real_escape_string(json);
  672. //console.log(json);
  673. return new Promise(function(fulfill) {
  674. // because Promise.all stops all work once a rejection is thrown...
  675. function reject(data) {
  676. fulfill({"error": true, "data": data, "proxy": proxy, "json": json});
  677. }
  678. // To prevent infinite runs.
  679. let tm = setTimeout(function() { reject("script timeout"); return; }, 110000);
  680. request(opts, function(error, response, body) {
  681. //console.log("Error" + error);
  682. //console.log(body);
  683. clearTimeout(tm);
  684. if(!error && response) { /* console.log(`Resp code: ${response.statusCode}`); */ if(response.statusCode === 201 || response.statusCode === 400) { fulfill({ "body": body, "proxy": proxy, "json": json }); return; } }
  685. reject(error);
  686. return;
  687. });
  688. });
  689. }
  690.  
  691.  
  692. function startProcess() {
  693. console.log(` `);
  694. console.log(`--------------------------------------------------------------------------`);
  695. console.log(`doit creator> Welcome to the creator! Creating accounts now!`);
  696. console.log(`Please give this a few minutes to run, accounts will automatically be made and sent to your database.`);
  697. console.log(`--------------------------------------------------------------------------`);
  698. console.log(` `);
  699. console.log(` `);
  700. console.log(`Status:`);
  701. console.log(`doit creator> Enabled discrim farm (${good_discs.length})`);
  702. //console.log(`doit creator> Loading up ${proxies_loaded.length} proxies!`);
  703. let promises = new Array();
  704. let runs = 0;
  705. for(let i = 0; i < proxies_loaded.length; i++) {
  706. if(typeof(config.testProxyPct) === "number") { if(runs/config.testProxyPct >= config.maxPerBatch) { continue;} }
  707. runs++;
  708. // get proxy object
  709. const proxy = proxies_loaded[i];
  710. // test the proxy
  711. promises.push(testProxy(proxy, "https://www.google.com"));
  712. }
  713. console.log(`doit creator> Testing ${runs} loaded proxies!`);
  714. let donep = Promise.all(promises);
  715. donep.then(data => {
  716. for(let i = 0; i < data.length; i++) {
  717. console.log(`${i}/${data.length}`);
  718. if(typeof(data) !== "object") continue;
  719. if(typeof(data[i]) !== "object") continue;
  720. console.log(data[i]);
  721. if(typeof(data[i]["error"]) === "boolean" && i !== data.length - 1) { if(typeof(data[i]["error"]) === "boolean") { if(data[i]["error"] === true) { /* console.error(data[i]["data"]); */ continue; }}}
  722. if(typeof(data[i]["error"]) !== "boolean") { if(typeof(data[i]["proxy"]) === "string") { proxies_tested.push(data[i]["proxy"]); }}
  723. if(i === data.length - 1) {
  724. setInterval(function() {
  725. CheckAllAccounts();
  726. }, 5* 60 * 1000);
  727. CheckAllAccounts();
  728. console.log(`doit creator> [NOTE] Found ${proxies_tested.length} active proxies!`);
  729. if(proxies_tested.length < 10) {
  730. console.log('[FAILED] exiting, too few proxies. (try http/s)');
  731. process.exit();
  732. }
  733. setTimeout(function() {
  734. if(config.maxPerBatch > 0 && config.farmMode === true) {
  735. CreateAccounts();
  736. } else if(config.farmMode === false) {
  737. console.log("farmMode is false, not creating accounts.");
  738. }
  739. }, 10000);
  740. }
  741. }
  742. });
  743. }
  744.  
  745. let ranOneTime = false;
  746. let haltDbSaves = false;
  747. function CreateAccounts() {
  748. if(ranOneTime === true) return;
  749. ranOneTime = true;
  750. console.log("doit creator> [Success] Creating accounts!");
  751.  
  752. let discordPromises = new Array();
  753. for(let i = 0; i < proxies_tested.length; i++) {
  754.  
  755. if (config.forceruser === true){
  756. var user = config.forceduser
  757. }
  758.  
  759. else if (config.genuser === false){
  760. let users = config.usernames;
  761. var user = users[i];
  762. }
  763. else{
  764. let lenusr = utils.getRandomInt(config.usernamelength, config.usernamemaxlen);
  765. var user = randomstring.generate(
  766. {
  767. length:lenusr,
  768. charset: 'alphanumeric',
  769. });
  770.  
  771. }
  772.  
  773. let passlen = utils.getRandomInt(config.passwordlen, config.passwordmaxlen);
  774. let pass = randomstring.generate(
  775. {
  776. length:passlen,
  777. charset: 'alphanumeric',
  778. });
  779.  
  780. if (config.genemails === false){
  781. let emails = config.emails;
  782. var mail = emails[i];
  783. }
  784. else{
  785. let maillen = utils.getRandomInt(config.emaillen, config.emailmaxlen);
  786. var mail = randomstring.generate(
  787. {
  788. length:maillen,
  789. charset: 'alphanumeric',
  790. capitalization: "lowercase",
  791. });
  792. mail = mail + "@" + config.mails[Math.floor(Math.random() * config.mails.length)];
  793. }
  794.  
  795.  
  796.  
  797.  
  798.  
  799. console.log(`Username: ${user} | Password: ${pass} | Email: ${mail}`);
  800. discordPromises.push(DoAccount(proxies_tested[i], {
  801. "fingerprint": config.fingerprint,
  802. "email": mail,
  803. "captcha_key": null,
  804. "username": user,
  805. "password": pass,
  806. }));
  807. }
  808.  
  809.  
  810.  
  811.  
  812. let discord_all = Promise.all(discordPromises);
  813. discord_all.then(data => {
  814. haltDbSaves = true;
  815. for(let i = 0; i < data.length; i++) {
  816. let val = data[i];
  817. if(typeof(val["body"]) === "object" && typeof(val["json"]) === "object") {
  818. let json_new = JSON.parse(JSON.stringify(val["json"]));
  819. if(typeof(val["body"]["token"]) !== "undefined") {
  820. haltDbSaves = true;
  821. //console.log(val["proxy"]);
  822. console.log("Got an account!");
  823. //console.log(typeof(val["body"]["token"]));
  824. json_new["token"] = val["body"]["token"];
  825. json_new["date_created"] = new Date();
  826. account_batch.push(json_new);
  827. haltDbSaves = false;
  828. } else if(typeof(val["body"]["captcha_key"]) === "object" && utils.isArray(val["body"]["captcha_key"]) === true) {
  829. let need_cap = false;
  830. val["body"]["captcha_key"].forEach(function(vl) { if(typeof(vl) === "string") { if(vl === "captcha-required") { need_cap = true; }}});
  831. if(need_cap === true && config.do2captcha === true) {
  832. if(account_batch.length >= config.maxPerBatch) continue;
  833. account_batch.push(json_new["username"]);
  834. //console.log(val["proxy"]);
  835. console.log("doit creator> Got proxy, sending captcha to indian");
  836. // do 2captcha shit
  837. SolveACaptcha(val["proxy"]).then(key => {
  838. json_new["captcha_key"] = key;
  839. function DoAccountFinish() {
  840. DoAccount(val["proxy"], {
  841. "fingerprint": config.fingerprint,
  842. "email": json_new["email"],
  843. "captcha_key": key,
  844. "username": json_new["username"],
  845. "password": json_new["password"],
  846. }).then(vl2 => {
  847. if(typeof(vl2["error"]) === "boolean") {
  848. if(vl2["error"] === true) {
  849. setTimeout(function() {
  850. //console.log(vl2);
  851. console.log("doit creator> Failed login with captcha, retrying.");
  852. DoAccountFinish();
  853. }, 15000);
  854. return;
  855. }
  856. }
  857. let tk = vl2["body"]["token"];
  858. if(tk === undefined) {
  859. console.log("doit creator> [FAILED] Token not solved captcha.");
  860. let stp = false;
  861. if(typeof(vl2["body"]["captcha_key"]) === "object") {
  862. if(vl2["body"]["captcha_key"][0] === "incorrect-captcha-sol" || vl2["body"]["captcha_key"][0] === "timeout-or-duplicate" || vl2["body"]["captcha_key"][0] === "response-already-used-error" || vl2["body"]["captcha_key"][0] === "invalid-keys") {
  863. stp = true;
  864. }
  865. }
  866. if(stp === false) {
  867. //console.log(vl2["body"]);
  868. DoAccountFinish();
  869. }
  870. return;
  871. }
  872. haltDbSaves = true;
  873. console.log("doit creator> adding to db now " + tk + "");
  874. json_new["token"] = tk;
  875. json_new["date_created"] = new Date();
  876. for(var i = 0; i < account_batch.length; i++) {
  877. if(typeof(account_batch[i]) === "string") {
  878. if(account_batch[i] === json_new["username"]) {
  879. account_batch.splice(i,1);
  880. }
  881. }
  882. }
  883. account_batch.push(json_new);
  884. console.log("doit creator> created account!");
  885. console.log(val['discriminator']);
  886. haltDbSaves = false;
  887. });
  888. }
  889. DoAccountFinish();
  890. }).catch(e => { });
  891. }
  892. } else {
  893. //console.log(val["proxy"]);
  894. //console.log(val["body"]);
  895. }
  896. }
  897. }
  898. setTimeout(function() { haltDbSaves = false; }, 10000);
  899. });
  900. }
  901.  
  902. setInterval(function() {
  903. if(haltDbSaves === true) return;
  904. if(account_batch.length > 0) {
  905. let toadd = new Array();
  906. account_batch.forEach(function(vl) {
  907. if(typeof(vl["token"]) === "string" && typeof(vl["date_created"]) !== "undefined" && typeof(vl["username"]) === "string" && typeof(vl["password"]) === "string" && typeof(vl["email"]) === "string") {
  908. toadd.push(vl);
  909. }
  910. });
  911. if(toadd.length > 0) {
  912. let txtf = "REPLACE INTO " + config.dbConData["table"] + " (id, token, username, password, email, date_created, date_lastchecked, date_changedname, discriminator) VALUES";
  913. for(let i = 0; i < toadd.length; i++) {
  914. var vl = toadd[i];
  915. txtf += "(";
  916. if(typeof(vl["id"]) === "string") {
  917. txtf += mysql.escape(vl["id"]) + ",";
  918. } else { txtf += "NULL,"; }
  919. txtf += mysql.escape(vl["token"]) + ",";
  920. txtf += mysql.escape(vl["username"]) + ",";
  921. txtf += mysql.escape(vl["password"]) + ",";
  922. txtf += mysql.escape(vl["email"]) + ",";
  923. txtf += mysql.escape(vl["date_created"]) + ",";
  924. if(typeof(vl["date_lastchecked"]) === "object") {
  925. txtf += mysql.escape(String(vl["date_lastchecked"])) + ",";
  926. } else { txtf += "NULL,"; }
  927. if(typeof(vl["date_changedname"]) === "string") {
  928. txtf += mysql.escape(String(vl["date_changedname"])) + ","; } else { txtf += "NULL,"; }
  929. if(typeof(vl["discriminator"]) === "string") {
  930. txtf += mysql.escape(vl["discriminator"]);
  931. } else { txtf += "NULL"; }
  932. if(i === toadd.length - 1) {
  933. txtf += ");";
  934. } else { txtf += "),"; }
  935. for(let a = 0; a < account_batch.length; a++) {
  936. if(typeof(account_batch[a]) === "object") { if(typeof(account_batch[a]["token"]) === "string") { if(account_batch[a]["token"] === vl["token"]) {
  937. account_batch.splice(a,1);
  938. //console.log("removed from account_batch");
  939. }}}
  940. }
  941. }
  942. //console.log(txtf);
  943. utils.RunQuery(txtf).then(() => {
  944. //console.log("Saved into db!");
  945. setTimeout(function() {
  946. SaveGoodDiscrimsToFile();
  947. }, 5000);
  948. }).catch(e => { console.error(e); account_batch.push(vl); });
  949. }
  950. }
  951. }, 5000);
  952.  
  953.  
  954.  
  955.  
  956.  
  957. for(var i = 1; i < 10000; i++) {
  958. let disc2 = String(i);
  959. if(i < 10) { disc2 = "000" + disc2; } else {
  960. if(i < 100) { disc2 = "00" + disc2; } else {
  961. if(i < 1000) { disc2 = "0" + disc2; }}}
  962. if(good_discs.includes(disc2) === true) continue;
  963. let disc = disc2.split("");
  964. let reps = {};
  965. let rep_4 = false;
  966. for(var asd = 0; asd < disc.length; asd++) {
  967. let thisch = disc[asd];
  968. if(typeof(reps[thisch]) === "number") {
  969. reps[thisch] ++;
  970. } else {
  971. reps[thisch] = 1;
  972. }
  973. }
  974. for(let key in reps) {
  975. let obj = reps[key];
  976. if(obj === 4) {
  977. rep_4 = true;
  978. }
  979. }
  980. if(rep_4 === true) {
  981. good_discs.push(disc2);
  982. }
  983. }
  984.  
  985. for(var i = 1; i < 10000; i++) {
  986. let disc2 = String(i);
  987. if(i < 10) { disc2 = "000" + disc2; } else {
  988. if(i < 100) { disc2 = "00" + disc2; } else {
  989. if(i < 1000) { disc2 = "0" + disc2; }}}
  990. if(good_discs.includes(disc2) === true) continue;
  991. let disc = disc2.split("");
  992. let reps = {};
  993.  
  994. let finshrow = false;
  995. let rowchars = 0;
  996.  
  997. var prevch = "";
  998. for(var asd = 0; asd < disc.length; asd++) {
  999. let thisch = disc[asd];
  1000. if(finshrow === false) {
  1001. if(thisch === prevch) {
  1002. rowchars++;
  1003. } else {
  1004. if(prevch !== "") {
  1005. finshrow = true;
  1006. //console.log("done " + rowchars);
  1007. } else {
  1008. rowchars = 1;
  1009. }
  1010. }
  1011. }
  1012. prevch = thisch;
  1013. if(typeof(reps[thisch]) === "number") {
  1014. reps[thisch] ++;
  1015. } else {
  1016. reps[thisch] = 1;
  1017. }
  1018. }
  1019.  
  1020. if(rowchars >= 3 ) {
  1021. good_discs.push(disc2);
  1022. if(shit_tiers.includes(disc2) === false) shit_tiers.push(disc2);
  1023. }
  1024. }
  1025.  
  1026. for(var i = 1; i < 10000; i++) {
  1027. let disc2 = String(i);
  1028. if(i < 10) { disc2 = "000" + disc2; } else {
  1029. if(i < 100) { disc2 = "00" + disc2; } else {
  1030. if(i < 1000) { disc2 = "0" + disc2; }}}
  1031. if(good_discs.includes(disc2) === true || good_discs.length > config.accountDiscrimsFreeSlots) continue;
  1032. let disc = disc2.split("");
  1033. let reps = {};
  1034. let rep_3 = false;
  1035. let repeats_2 = 0;
  1036.  
  1037. for(var asd = 0; asd < disc.length; asd++) {
  1038. let thisch = disc[asd];
  1039. if(typeof(reps[thisch]) === "number") {
  1040. reps[thisch] ++;
  1041. } else {
  1042. reps[thisch] = 1;
  1043. }
  1044. }
  1045. for(let key in reps) {
  1046. let obj = reps[key];
  1047. if(obj === 3) {
  1048. rep_3 = true;
  1049. } else if(obj === 2) {
  1050. repeats_2++;
  1051. }
  1052. }
  1053. if(rep_3 === true || repeats_2 === 2) {
  1054. good_discs.push(disc2);
  1055. if(shit_tiers.includes(disc2) === false) shit_tiers.push(disc2);
  1056. }
  1057. }
  1058.  
  1059.  
  1060. utils.connection.on('close', function(err) {
  1061. if (err) {
  1062. // Oops! Unexpected closing of connection, lets reconnect back.
  1063. utils.connection = mysql.createConnection(utils.dbConData);
  1064. } else {
  1065. console.log('Connection closed normally.');
  1066. }
  1067. });
  1068.  
  1069.  
  1070.  
  1071. setTimeout(function() {
  1072. CheckAllAccounts();
  1073. setTimeout(function() {
  1074. SaveGoodDiscrimsToFile();
  1075. }, 5000);
  1076. }, 1);
  1077.  
  1078.  
  1079. startProcess();
  1080. utils.connection.connect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement