Infra_

Untitled

Jun 8th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const chalk = require('chalk');
  2. const request = require('request');
  3. const crypto = require('crypto');
  4. const fs = require('fs');
  5.  
  6. const namesFile = fs.readFileSync("names.json");
  7. const names = JSON.parse(namesFile);
  8.  
  9. let targetsFile = fs.readFileSync("targets.json");
  10. let targets = JSON.parse(targetsFile);
  11.  
  12. fs.watchFile('targets.json', (curr, prev) => {
  13.     targetsFile = fs.readFileSync("targets.json");
  14.     targets = JSON.parse(targetsFile);
  15.     console.log(` `);
  16.     console.log(chalk`{green Updated targets!}`);
  17. });
  18.  
  19. function doIt() {
  20.     console.log(` `);
  21.     targets.forEach((target, index) => {
  22.         let randName = names[Math.floor(Math.random() * names.length)].toLowerCase() + Math.floor(Math.random() * 90 + 10);
  23.         let randPassword = crypto.randomBytes(Math.floor(Math.random() * 8 + 3)).toString("hex");
  24.            
  25.         let formData = {
  26.             [target.loginField]: randName,
  27.             [target.passwordField]: randPassword,
  28.         };
  29.    
  30.         for(let [key, value] of Object.entries(target.extraFormData)) {
  31.             formData[key] = value;
  32.         }
  33.        
  34.         setTimeout(() => {
  35.             request.post(target.url, {
  36.                 formData: formData,
  37.                 followRedirect: false,
  38.                 timeout: 1500
  39.             }, (err, res, body) => {
  40.                 if (err) {
  41.                     console.log(chalk`{red [Error]} ${target.url} failed [${err}]`);
  42.                 }
  43.                 else {
  44.                     if (res.statusCode == 200)
  45.                         console.log(chalk`{green [200]} Sent {yellow ${randName}} with {yellow ${randPassword}} [${target.url}]`);
  46.                     else
  47.                         console.log(chalk`{red [${res.statusCode}]} Failed [${target.url}]`);
  48.                 }
  49.             });
  50.         }, 200 * index);
  51.     });
  52.     setTimeout(doIt, Math.floor(Math.random() * 15000 + 2000));
  53. }
  54. doIt();
Advertisement
Add Comment
Please, Sign In to add comment