Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. var lastPos = 0;
  2.  
  3. function exec_code(){
  4. var fs = require('fs');
  5. var child_process = require('child_process');
  6. //var lastPos = 0;
  7.  
  8. function getFriends() {
  9. var friendsList = [];
  10. var friends = fs.readFileSync('usernames.txt');
  11. for (friend of friends.toString().split('n')) {
  12. friend = friend.replace('r', '');
  13. friendsList.push(friend);
  14. }
  15. return friendsList;
  16. }
  17.  
  18. function getUsers() {
  19. var list = getFriends();
  20. var result = list.splice(lastPos, 94)
  21. lastPos+=94;
  22. return result;
  23. }
  24.  
  25. function getProxList(cb) {
  26. var temp = [];
  27. fs.readFile('proxies.txt', (err, lines) => {
  28. if (err) throw err;
  29. for (p of lines.toString().split('n')) {
  30. temp.push({host: p.split(':')[0].replace('r', ''), port: p.split(':')[1].replace('r', '')});
  31. }
  32. cb(temp);
  33. });
  34. }
  35.  
  36. fs.readFile('accounts.txt', (err, data) => {
  37. getProxList(function(proxList) {
  38.  
  39.  
  40. var timeout = 0;
  41. for (line of data.toString().split('n')) {
  42. var prox = proxList[Math.floor(Math.random() * proxList.length) + 1];
  43. var username = line.split(':')[0].replace('r', '');
  44. var password = line.split(':')[1].replace('r', '');
  45.  
  46. //if (prox.host === undefined || prox.port === undefined) { continue; }
  47.  
  48. var usersList = getUsers();
  49. (function(h, p, us, pp, l, t) {
  50. setTimeout(function() { // TEST IT
  51. console.log('Run: '+us);
  52. console.log('L: '+l);
  53. child_process.fork('./app.js', [h, p, us, pp, l]);
  54. }, t * 1000); // 5 sec
  55. })(prox.host, prox.port, username, password, usersList, timeout);
  56. timeout+=5; //60
  57. }
  58. });
  59. });
  60.  
  61.  
  62.  
  63. // child_process.fork('./app.js', [username, password, friend.replace('r', '')]);
  64.  
  65. }
  66.  
  67. exec_code();
  68. setInterval(exec_code, 14400000)
  69.  
  70. mzapc@mzabox ~/casper/test/works_Adder_without_delay
  71. $ node start.js
  72. C:cygwin64homemzapccaspertestworks_Adder_without_delaystart.js:55
  73. })(prox.host, prox.port, username, password, usersList, timeout);
  74. ^
  75.  
  76. TypeError: Cannot read property 'host' of undefined
  77. at C:cygwin64homemzapccaspertestworks_Adder_without_delaystart.js:55:11
  78. at C:cygwin64homemzapccaspertestworks_Adder_without_delaystart.js:32:9
  79. at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement