Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. const request = require('request');
  2. const logger = require(__dirname + '/util/logger');
  3. const fs = require('fs');
  4.  
  5. const PROXY_FILE = __dirname + "/proxies.txt";
  6.  
  7. const triesPerSecond = 0.5;
  8.  
  9. var proxyLine = 0;
  10. var proxyUrl = "";
  11. var working = [];
  12.  
  13. getGiftCode = function () {
  14. let code = '';
  15. let dict = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  16. for(var i = 0; i < 18; i++){
  17. code = code + dict.charAt(Math.floor(Math.random() * dict.length));
  18. }
  19. return code;
  20. }
  21.  
  22. function updateLine(){
  23. proxyLine++;
  24. var lineReader = require('line-reader');
  25. var readLine = 0;
  26. lineReader.eachLine(PROXY_FILE, function(line, last) {
  27. readLine++;
  28. if (readLine === proxyLine) {
  29. proxyUrl = "http://" + line;
  30. }
  31. if (last) {
  32. readLine = 0;
  33. }
  34. });
  35. }
  36.  
  37. updateLine();
  38.  
  39. checkCode = function (code) {
  40. var proxiedRequest = request.defaults({'proxy': proxyUrl});
  41. proxiedRequest.timeout = 1500;
  42. proxiedRequest.get(`https://discordapp.com/api/v6/entitlements/gift-codes/${code}?with_application=false&with_subscription_plan=true`, (error, resp, body) => {
  43. if(error){
  44. console.log('\x1b[33m%s\x1b[0m', `Error: Chill I'am Legit`);
  45. updateLine();
  46. return;
  47. }
  48. try {
  49. body = JSON.parse(body);
  50. if(body.message != "Unknown Gift Code" && body.message != "You are being rate limited."){
  51. logger.log('\x1b[41m', `FOUND CODE THAT WORKS: https://discord.gift/${code}`);
  52. console.log(JSON.stringify(body, null, 4));
  53. working.push(`https://discord.gift/${code}`);
  54. fs.writeFileSync(__dirname + '/codes.json', JSON.stringify(working, null, 4));
  55. }
  56. else if(body.message === "Limit") {
  57. updateLine();
  58. console.log("Waiting...");
  59.  
  60. }else{
  61. console.log('\x1b[36m%s\x1b[0m', `Kod: ${code} : Searching!`);
  62. }
  63. }
  64. catch (error) {
  65. logger.error(`An error occurred:`);
  66. logger.error(error);
  67. return;
  68. }
  69. });
  70. }
  71. logger.info(`Nitro Generator edit by dvc`);
  72. logger.info(`Add me on discord ۞! dvc۞#6666 for buy more apps`)
  73. logger.info(`My server: ScCepes`)
  74. logger.info(`Searching Proxy`)
  75. logger.info(`Open proxies.txt`)
  76. logger.info(`License: LIFTTIME | VIP`)
  77. logger.info(`Fresh update: 13.11.2019`)
  78. logger.info(`Version: v0.0.2`)
  79. logger.info(`\n\n\n\nConnection with discordapp.com!\n\n\n\n\n\n\n`);
  80.  
  81. checkCode(getGiftCode());
  82. setInterval(() => {
  83. checkCode(getGiftCode());
  84. }, (5/triesPerSecond) * 50);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement