Advertisement
Guest User

Untitled

a guest
Nov 17th, 2016
1,096
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.08 KB | None | 0 0
  1. var Promise = require('bluebird');
  2. var cheerio = require('cheerio');
  3. var bhttp = require('bhttp');
  4. var User = require('../user');
  5. var fs = require('fs');
  6. var shelljs = require('shelljs');
  7. var session = bhttp.session();
  8. var os = require('os');
  9. var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
  10. var pastValue;
  11. var UserAgent = require('../user-agent');
  12.  
  13. // --------- DATABASE ---------
  14. var mongoose = require('mongoose');
  15.  
  16. mongoose.connect('mongodb://127.0.0.1:27017/bongacash');
  17.  
  18. var mongoDB = mongoose.connection;
  19.  
  20. mongoDB.on('error', function (err) {
  21. //console.log('connection error:', err.message);
  22. });
  23. mongoDB.once('open', function callback () {
  24. //console.log("Connected to DB!");
  25. });
  26.  
  27. var Schema = mongoose.Schema;
  28. var SignUp = new Schema({
  29. affiliate_id: { type: String, required: true },
  30. scheuld: { type: JSON, required: true },
  31. modified: { type: Date, default: Date.now }
  32. });
  33. var IP = new Schema({
  34. ip: { type: String, required: true },
  35. affiliate_id: { type: String, required: true },
  36. modified: { type: Date, default: Date.now }
  37. });
  38.  
  39. var SignUpModel = mongoose.model('SignUp', SignUp);
  40. var IPModel = mongoose.model('IP', IP);
  41.  
  42. module.exports.SignUpModel = SignUpModel;
  43. module.exports.IPModel = IPModel;
  44. function getDate(){
  45. var days = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];
  46. var currentdate = new Date();
  47. var date = {
  48. day : days[currentdate.getDay()],
  49. date : currentdate.getDate(),
  50. month : (currentdate.getMonth()+1),
  51. year : currentdate.getFullYear(),
  52. hour : currentdate.getHours(),
  53. min : currentdate.getMinutes(),
  54. sec : currentdate.getSeconds()
  55. };
  56. for(var k in date){
  57. var temp = date[k]+"";
  58. if(temp.length < 2){
  59. temp = "0"+temp;
  60. }
  61. }
  62. return date;
  63. }
  64. // --------- CREATING NEW QUERY ---------
  65. function generateScheuld(affiliate_id, callback){
  66. var affiliate_idCheckQuery = { affiliate_id : affiliate_id };
  67. SignUpModel.findOne(affiliate_idCheckQuery, function(err, respond) {
  68. if (respond){
  69. console.log('['+os.hostname()+'] SCHEULD ALREADY EXISTS FOR ID '+affiliate_id);
  70. callback(true);
  71. }else{
  72. console.log('['+os.hostname()+'] CREATING SCHEULD FOR ID '+affiliate_id);
  73. var affiliate_idGenerateScheuld = new SignUpModel({
  74. affiliate_id: affiliate_id,
  75. scheuld: addScheuld()
  76. });
  77. affiliate_idGenerateScheuld.save(function (err) {
  78. if (err) {console.log(err)} else {}
  79. });
  80. callback(true);
  81. }
  82. });
  83. }
  84. function compareIP(ip, affiliate_id, callback){
  85. var ipCheckQuery = { ip : ip, affiliate_id : affiliate_id };
  86. IPModel.findOne(ipCheckQuery, function(err, respond) {
  87. if (respond){
  88. console.log('['+os.hostname()+'] DUPLICATED IP');
  89. callback(false);
  90. }else{
  91. var ipNewSaveQuery = new IPModel({
  92. ip: ip,
  93. affiliate_id: affiliate_id
  94. });
  95. ipNewSaveQuery.save(function (err) {
  96. if (err) {console.log(err)} else {}
  97. });
  98. callback({
  99. ip: ip,
  100. affiliate_id: affiliate_id
  101. });
  102. }
  103. });
  104. }
  105. // --------- DATABASE ---------
  106. function timestamp(){
  107. var currentdate = new Date();
  108. var timestamp = {};
  109. timestamp.day = currentdate.getDate();
  110. timestamp.month = currentdate.getMonth()+1;
  111. timestamp.year = currentdate.getFullYear();
  112. timestamp.hour = currentdate.getHours();
  113. timestamp.min = currentdate.getMinutes();
  114. timestamp.sec = currentdate.getSeconds();
  115. return timestamp;
  116. }
  117. function addScheuld(){
  118. var scheuld = {
  119. "sunday" : {
  120. "00:00" : "high",
  121. "01:00" : "high",
  122. "02:00" : "high",
  123. "03:00" : "high",
  124. "04:00" : "low",
  125. "05:00" : "low",
  126. "06:00" : "low",
  127. "07:00" : "low",
  128. "08:00" : "high",
  129. "09:00" : "middle",
  130. "10:00" : "middle",
  131. "11:00" : "middle",
  132. "12:00" : "middle",
  133. "13:00" : "middle",
  134. "14:00" : "high",
  135. "15:00" : "middle",
  136. "16:00" : "middle",
  137. "17:00" : "middle",
  138. "18:00" : "middle",
  139. "19:00" : "high",
  140. "20:00" : "high",
  141. "21:00" : "high",
  142. "22:00" : "high",
  143. "23:00" : "high"
  144. },
  145. "monday" : {
  146. "00:00" : "high",
  147. "01:00" : "high",
  148. "02:00" : "high",
  149. "03:00" : "high",
  150. "04:00" : "low",
  151. "05:00" : "low",
  152. "06:00" : "low",
  153. "07:00" : "low",
  154. "08:00" : "high",
  155. "09:00" : "middle",
  156. "10:00" : "middle",
  157. "11:00" : "middle",
  158. "12:00" : "middle",
  159. "13:00" : "middle",
  160. "14:00" : "high",
  161. "15:00" : "middle",
  162. "16:00" : "middle",
  163. "17:00" : "middle",
  164. "18:00" : "middle",
  165. "19:00" : "high",
  166. "20:00" : "high",
  167. "21:00" : "high",
  168. "22:00" : "high",
  169. "23:00" : "high"
  170. },
  171. "tuesday" : {
  172. "00:00" : "high",
  173. "01:00" : "high",
  174. "02:00" : "high",
  175. "03:00" : "high",
  176. "04:00" : "low",
  177. "05:00" : "low",
  178. "06:00" : "low",
  179. "07:00" : "low",
  180. "08:00" : "high",
  181. "09:00" : "middle",
  182. "10:00" : "middle",
  183. "11:00" : "middle",
  184. "12:00" : "middle",
  185. "13:00" : "middle",
  186. "14:00" : "high",
  187. "15:00" : "middle",
  188. "16:00" : "middle",
  189. "17:00" : "middle",
  190. "18:00" : "middle",
  191. "19:00" : "high",
  192. "20:00" : "high",
  193. "21:00" : "high",
  194. "22:00" : "high",
  195. "23:00" : "high"
  196. },
  197. "wednesday" : {
  198. "00:00" : "high",
  199. "01:00" : "high",
  200. "02:00" : "high",
  201. "03:00" : "high",
  202. "04:00" : "low",
  203. "05:00" : "low",
  204. "06:00" : "low",
  205. "07:00" : "low",
  206. "08:00" : "high",
  207. "09:00" : "middle",
  208. "10:00" : "middle",
  209. "11:00" : "middle",
  210. "12:00" : "middle",
  211. "13:00" : "middle",
  212. "14:00" : "high",
  213. "15:00" : "middle",
  214. "16:00" : "middle",
  215. "17:00" : "middle",
  216. "18:00" : "middle",
  217. "19:00" : "high",
  218. "20:00" : "high",
  219. "21:00" : "high",
  220. "22:00" : "high",
  221. "23:00" : "high"
  222. },
  223. "thursday" : {
  224. "00:00" : "high",
  225. "01:00" : "high",
  226. "02:00" : "high",
  227. "03:00" : "high",
  228. "04:00" : "low",
  229. "05:00" : "low",
  230. "06:00" : "low",
  231. "07:00" : "low",
  232. "08:00" : "high",
  233. "09:00" : "middle",
  234. "10:00" : "middle",
  235. "11:00" : "middle",
  236. "12:00" : "middle",
  237. "13:00" : "middle",
  238. "14:00" : "high",
  239. "15:00" : "middle",
  240. "16:00" : "middle",
  241. "17:00" : "middle",
  242. "18:00" : "middle",
  243. "19:00" : "high",
  244. "20:00" : "high",
  245. "21:00" : "high",
  246. "22:00" : "high",
  247. "23:00" : "high"
  248. },
  249. "friday" : {
  250. "00:00" : "high",
  251. "01:00" : "high",
  252. "02:00" : "high",
  253. "03:00" : "high",
  254. "04:00" : "high",
  255. "05:00" : "high",
  256. "06:00" : "high",
  257. "07:00" : "high",
  258. "08:00" : "high",
  259. "09:00" : "middle",
  260. "10:00" : "middle",
  261. "11:00" : "middle",
  262. "12:00" : "middle",
  263. "13:00" : "middle",
  264. "14:00" : "high",
  265. "15:00" : "middle",
  266. "16:00" : "middle",
  267. "17:00" : "middle",
  268. "18:00" : "middle",
  269. "19:00" : "high",
  270. "20:00" : "high",
  271. "21:00" : "high",
  272. "22:00" : "high",
  273. "23:00" : "high"
  274. },
  275. "saturday" : {
  276. "00:00" : "high",
  277. "01:00" : "high",
  278. "02:00" : "high",
  279. "03:00" : "high",
  280. "04:00" : "high",
  281. "05:00" : "high",
  282. "06:00" : "high",
  283. "07:00" : "high",
  284. "08:00" : "high",
  285. "09:00" : "high",
  286. "10:00" : "high",
  287. "11:00" : "high",
  288. "12:00" : "high",
  289. "13:00" : "high",
  290. "14:00" : "high",
  291. "15:00" : "high",
  292. "16:00" : "high",
  293. "17:00" : "high",
  294. "18:00" : "high",
  295. "19:00" : "high",
  296. "20:00" : "high",
  297. "21:00" : "middle",
  298. "22:00" : "middle",
  299. "23:00" : "middle"
  300. }
  301. };
  302. var low = 350;
  303. var middle = 450;
  304. var high = 600;
  305. for(var k in scheuld) {
  306. for(var i in scheuld[k]){
  307. scheuld[k][i] = [0, 2];
  308. // if(scheuld[k][i] == "low"){
  309. // scheuld[k][i] = [0, getRandomInt(0, low)];
  310. // }
  311. // if(scheuld[k][i] == "middle"){
  312. // scheuld[k][i] = [0, getRandomInt(low, middle)];
  313. // }
  314. // if(scheuld[k][i] == "high"){
  315. // scheuld[k][i] = [0, getRandomInt(middle, high)];
  316. // }
  317. }
  318. }
  319. return scheuld;
  320. }
  321.  
  322.  
  323. function getRandomInt(min, max) {
  324. return Math.floor(Math.random() * (max - min + 1)) + min;
  325. }
  326. function separate(str){
  327. var STR = str+"";
  328. var position = STR.length;
  329. for(var i = STR.length; i > 0; i--){
  330. if((position-3) == i){
  331. STR = STR.substr(0, i) + " " + STR.substr(i);
  332. position = position-3;
  333. }
  334. }
  335. return STR;
  336. }
  337. String.prototype.replaceAll = function(str1, str2, ignore){
  338. return this.replace(new RegExp(str1.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g,"\\$&"),(ignore?"gi":"g")),(typeof(str2)=="string")?str2.replace(/\$/g,"$$$$"):str2);
  339. };
  340. Object.size = function(obj) {
  341. var size = 0, key;
  342. for (key in obj) {
  343. if (obj.hasOwnProperty(key)) size++;
  344. }
  345. return size;
  346. };
  347.  
  348. var VISIT=true;
  349. var frame = 0;
  350. // setInterval(function(){
  351. // console.log(frame);
  352. // frame++;
  353. // if(frame > 500){
  354. // console.log(' RESET ');
  355. // console.log(' RESET ');
  356. // console.log(' RESET ');
  357. // console.log(' RESET ');
  358. // console.log(' RESET ');
  359. // console.log(' RESET ');
  360. // console.log(' RESET ');
  361. // console.log(' RESET ');
  362. // session = bhttp.session();
  363. // hma.close();
  364. // VISIT=true;
  365. // frame=0;
  366. // }
  367. // },100);
  368.  
  369. function parseCookies(request) {
  370. var list = {},
  371. rc = request.headers.cookie;
  372.  
  373. rc && rc.split(';').forEach(function( cookie ) {
  374. var parts = cookie.split('=');
  375. list[parts.shift().trim()] = decodeURI(parts.join('='));
  376. });
  377.  
  378. return list;
  379. }
  380.  
  381. function getAcceptLanguage(){
  382. var acceptLanguage = [
  383. "cs, en-us; 0.9, de-de; 0.8, ru-ru; 0.7",
  384. "en;q=1.0, en;q=0.5, zh-cn, zh;q=0.5, en;q=0.5",
  385. "en;q=1.0,fr;q=1.0,de;q=0.9,ja;q=0.9,nl",
  386. "ca,ca-ES,es-es;q=0.9,es;q=0.9,en-US",
  387. "en-us;q=1.0, es-ve;q=0.5",
  388. "en;q=0.9,es-419;q=0.8,ca-AD",
  389. "de;q=0.7,ca-CA;q=0.7,cs-CZ"
  390. ];
  391. return acceptLanguage[getRandomInt(0, acceptLanguage.length-1)];
  392. }
  393.  
  394. var email = {
  395. status : "",
  396. create : function(email, callback){
  397. return Promise.try(function () {
  398. return session.get("http://mailnesia.com/mailbox/"+email);
  399. }).then(function (response) {
  400. callback(email);
  401. }).catch(function(err) {
  402. status = 'error:'+err;
  403. console.log('['+os.hostname()+'] '+'------------------ email.create() ERR ------------------');
  404. console.log('['+os.hostname()+'] '+status);
  405. });
  406. },
  407. getApproveURL : function(email, callback){
  408. return Promise.try(function () {
  409. return session.get("http://mailnesia.com/mailbox/"+email);
  410. }).then(function (response) {
  411. var $ = cheerio.load(response.body);
  412. var emailURL = "http://mailnesia.com"+$('a.email').attr('href');
  413. console.log('EMAIL URL: '+emailURL);
  414. return session.get(emailURL);
  415. }).then(function (response) {
  416. if (response) {
  417. var $ = cheerio.load(response.body);
  418. var approveURL = $('table.content').find('a').attr('href');
  419. callback(approveURL);
  420. }else{
  421. callback(false);
  422. }
  423. }).catch(function(err) {
  424. status = 'error:'+err;
  425. console.log('['+os.hostname()+'] '+email+'------------------ email.getApproveURL() ERR ------------------');
  426. console.log('['+os.hostname()+'] '+status);
  427. });
  428. },
  429. approve : function(url, callback){
  430. return Promise.try(function () {
  431. return session.get(url);
  432. }).then(function (response) {
  433. session = bhttp.session();
  434. callback("OK");
  435. }).catch(function(err) {
  436. status = 'error:'+err;
  437. console.log('['+os.hostname()+'] '+'------------------ email.approve() ERR ------------------');
  438. console.log('['+os.hostname()+'] '+status);
  439. callback(false);
  440. });
  441. }
  442. };
  443. var bongacams = {
  444. username : "",
  445. getID : function(callback){
  446. var id = ["332521","332521","332521"];
  447. callback(id[getRandomInt(0, id.length-1)]);
  448. },
  449. visit : function(id, callback){
  450. return Promise.try(function () {
  451. return session.get("http://bongacams.com/track?c="+id);
  452. }).then(function(response) {
  453. if(response){
  454. callback(response);
  455. }
  456. }).catch(function(err) {
  457. status = 'error:'+err;
  458. console.log('['+os.hostname()+'] '+'------------------ chaturbate.visit() ERR ------------------');
  459. console.log('['+os.hostname()+'] '+status);
  460. callback(false);
  461. });
  462. },
  463. signup : function(id, ip, callback){
  464. return Promise.try(function () {
  465. return session.get("http://bongacams.com/track?c="+id);
  466. }).then(function(response) {
  467. if(response){
  468. frame=0;
  469. console.log('['+os.hostname()+'] '+'/track?c='+id);
  470. return session.get("https://bongacams.com/members/join");
  471. }
  472. }).then(function(response) {
  473. if(response){
  474. frame=0;
  475. console.log('['+os.hostname()+'] '+'Loaded URL: /members/join');
  476. var $ = cheerio.load(response.body);
  477. var meta = User.generate();
  478. meta.email = meta.username+"@mailnesia.com";
  479. var date = timestamp();
  480. var SLAI = '{' +
  481. '"language":"en",' +
  482. '"cookieEnabled":true,' +
  483. '"javaEnabled":false,' +
  484. '"dateTime":"'+date.day+'.'+date.month+'.'+date.year+', '+date.hour+':'+date.min+':'+date.sec+'",' +
  485. '"ips":["192.168.1.100","'+ip+'"]' +
  486. '}';
  487. console.log('['+os.hostname()+'] '+SLAI);
  488. bongacams.username = meta.username;
  489. email.create(meta.username, function(){});
  490. return session.post("https://bongacams.com/members/join", {
  491. "security_log_additional_info" : SLAI,
  492. "popup_signup_source_id" : "",
  493. "user_member[id]" : "",
  494. "user_member[current_performer]" : "",
  495. "user_member[username]" : meta.username,
  496. "user_member[email]" : meta.email,
  497. "user_member[fix_chrome_autocomplete]" : "",
  498. "user_member[password]" : meta.password,
  499. "user_member[promo_code]" : "",
  500. "user_member[terms_of_use]" : "on"
  501. }, {
  502. headers: {
  503. "origin": "https://bongacams.com",
  504. "referer": "https://bongacams.com/members/join",
  505. "user-agent": UserAgent.get(),
  506. "accept-language": getAcceptLanguage()
  507. }
  508. });
  509. }
  510. }).then(function(response){
  511. if(response){
  512. var username = bongacams.username;
  513. bongacams.username = "";
  514. frame=0;
  515. var $ = cheerio.load(response.body);
  516. var confirmation = $('div.confirm_email_box').text();
  517. //confirmation = (confirmation.html()+'').replace('\n', '');
  518. callback(username);
  519. //if(error == 'Congratulations! You are ready to Chat.'){
  520. // console.log('['+os.hostname()+'] '+'user "'+$('a.username').html()+'" registered');
  521. // session = bhttp.session();
  522. // hma.close();
  523. // VISIT=true;
  524. // frame=0;
  525. //}else{
  526. // VISIT=true;
  527. // session = bhttp.session();
  528. // hma.close();
  529. // frame=0;
  530. // console.log('['+os.hostname()+'] '+$('#main').html());
  531. // console.log('['+os.hostname()+'] '+$('#error_notice').html());
  532. //}
  533. }
  534. }).catch(function(err){
  535. callback(false);
  536. //frame=0;
  537. //VISIT=true;
  538. //session = bhttp.session();
  539. //hma.close();
  540. //status = 'error:'+err;
  541. console.log('['+os.hostname()+'] '+'------------------ bongacams.signup() ERR ------------------');
  542. });
  543. }
  544. };
  545. var chaturbate = {
  546. status : "",
  547. getID : function(callback){
  548. // req('http://ft.camroutes.com/chaturbate/affiliate.nodejs', function(data){
  549. // var DATA = data.split(',');
  550. // var ID = [];
  551. // for(var i = 0; i < DATA.length; i++){
  552. // ID.push(DATA[i]);
  553. // }
  554. // status = ID;
  555. // //console.log('['+os.hostname()+'] '+'------------------ chaturbate.getID() OK ------------------');
  556. // //console.log('['+os.hostname()+'] '+JSON.stringify(status));
  557. // //console.log('['+os.hostname()+'] '+'---------------------------------------------------------------------------');
  558. // callback(ID);
  559. // });
  560. callback(["B64g1","B64g1"])
  561. },
  562. login : function(username, password) {
  563. return Promise.try(function () {
  564. return session.get("https://chaturbate.com/auth/login/");
  565. }).then(function (response) {
  566. var $ = cheerio.load(response.body);
  567. status = $(".requiredfield").text();
  568. var csrfToken = $("#main form[action='/auth/login/'] input[name='csrfmiddlewaretoken']").val();
  569. return session.post("https://chaturbate.com/auth/login/", {
  570. username: username,
  571. password: password,
  572. csrfmiddlewaretoken: csrfToken,
  573. next: "/"
  574. }, { headers: {"referer": "https://chaturbate.com/auth/login/"}});
  575. }).catch(function(err) {
  576. status = 'error:'+err;
  577. console.log('['+os.hostname()+'] '+'------------------ chaturbate.login() ERR ------------------');
  578. console.log('['+os.hostname()+'] '+status);
  579. });
  580. },
  581. visit : function(url){
  582. return Promise.try(function () {
  583. return session.get(url);
  584. }).catch(function(err) {
  585. status = 'error:'+err;
  586. console.log('['+os.hostname()+'] '+'------------------ chaturbate.visit() ERR ------------------');
  587. console.log('['+os.hostname()+'] '+status);
  588. });
  589. },
  590. signup : function(id, callback){
  591. return Promise.try(function () {
  592. return session.get("http://chaturbate.com/affiliates/in/?track=default&tour=g4pe&campaign="+id);
  593. //return session.get("http://chaturbate.com/affiliates/in/?track=default&tour=4uT2&campaign="+id);
  594. }).then(function(response) {
  595. if(response){
  596. frame=0;
  597. console.log('['+os.hostname()+'] '+'/in/?track=default&tour=g4pe&campaign='+id);
  598. //console.log('['+os.hostname()+'] '+'Loaded URL: /in/?track=default&tour=4uT2&campaign='+id);
  599. return session.get("https://chaturbate.com/accounts/register/");
  600. }
  601. }).then(function(response) {
  602. if(response){
  603. frame=0;
  604. console.log('['+os.hostname()+'] '+'Loaded URL: /accounts/register/');
  605. var $ = cheerio.load(response.body);
  606.  
  607. var meta = User.generate();
  608. meta.birthday_day = getRandomInt(2, 31);
  609. meta.birthday_month = getRandomInt(2, 12);
  610. meta.birthday_year = getRandomInt(1989, 1994);
  611. //console.log('['+os.hostname()+'] '+meta);
  612.  
  613. var csrfToken = $("#main form[action='/accounts/register/'] input[name='csrfmiddlewaretoken']").val();
  614.  
  615. return session.post("https://chaturbate.com/accounts/register/", {
  616. username: meta.username,
  617. password: meta.password,
  618. email: meta.email,
  619. birthday_day: meta.birthday_day,
  620. birthday_month: meta.birthday_month,
  621. birthday_year: meta.birthday_year,
  622. gender: "f",
  623. studio: "",
  624. terms: "on",
  625. csrfmiddlewaretoken: csrfToken
  626. }, {
  627. headers: {
  628. "origin": "https://chaturbate.com",
  629. "referer": "https://chaturbate.com/accounts/register/",
  630. "user-agent": UserAgent.get(),
  631. "accept-language": getAcceptLanguage()
  632. }
  633. });
  634. }
  635. }).then(function(response) {
  636. if(response){
  637. frame=0;
  638. var $ = cheerio.load(response.body);
  639.  
  640. var error = $('div.top-section').find('h1');
  641. error = (error.html()+'').replace('\n', '');
  642.  
  643. if(error == 'Congratulations! You are ready to Chat.'){
  644. console.log('['+os.hostname()+'] '+'user "'+$('a.username').html()+'" registered');
  645. session = bhttp.session();
  646. hma.close();
  647. VISIT=true;
  648. frame=0;
  649. }else{
  650. VISIT=true;
  651. session = bhttp.session();
  652. hma.close();
  653. frame=0;
  654. console.log('['+os.hostname()+'] '+$('#main').html());
  655. console.log('['+os.hostname()+'] '+$('#error_notice').html());
  656. }
  657. }
  658. }).catch(function(err) {
  659. frame=0;
  660. VISIT=true;
  661. session = bhttp.session();
  662. hma.close();
  663. status = 'error:'+err;
  664. console.log('['+os.hostname()+'] '+'------------------ chaturbate.signup() ERR ------------------');
  665. console.log('['+os.hostname()+'] '+status);
  666. });
  667. }
  668. };
  669. var hma = {
  670. connect : function(){
  671. shelljs.exec('./hma/connect.sh', {async:true});
  672. },
  673. close : function(){
  674. console.log('['+os.hostname()+'] '+'-------------------------------------');
  675. shelljs.exec('./hma/close.sh', {async:true});
  676. },
  677. status : function(callback){
  678. fs.readFile('./hma/status.log', 'utf8', function (err, data) {
  679. if (err) {
  680. fs.writeFile('./hma/status.log', 'disconnected', function(err) {
  681. if(err){}else{callback('disconnected');}
  682. });
  683. }else{
  684. callback(data);
  685. }
  686. });
  687. }
  688. };
  689. var ip = {
  690. get : function(callback){
  691. req("https://api.ipify.org", function(res) {
  692. if (res) {
  693. callback(res);
  694. } else {
  695. callback(false);
  696. }
  697. });
  698. },
  699. check : function(){},
  700. compare : function(){}
  701. };
  702.  
  703. function req(url, callback) {
  704. var xhr = new XMLHttpRequest();
  705. xhr.onreadystatechange = function() {
  706. if (xhr.readyState === 4) { //if complete
  707. if (xhr.status === 200) { //check if "OK" (200)
  708. callback(xhr.responseText);
  709. } else {
  710. callback(false);
  711. }
  712. }
  713. };
  714. try {
  715. xhr.open("GET", url, true);
  716. xhr.send();
  717. } catch (error) {
  718. callback(false);
  719. }
  720. }
  721.  
  722. var accounts = [];
  723. var statisticsAll = {};
  724. var statistics = {};
  725. var count = 0;
  726. var timeout;
  727.  
  728. hma.close();
  729.  
  730. function start(){
  731. Promise.try(function() {
  732. // Проверяем статус VPN
  733. hma.status(function(status){
  734. if(typeof status != 'undefined'){
  735. status = status.replace('\n', '');
  736. console.log('['+os.hostname()+'] '+status);
  737. if(status == 'connected'){
  738. if(VISIT) {
  739. VISIT = false;
  740. ip.get(function(ip){
  741. if(ip){
  742. frame=0;
  743. console.log('['+os.hostname()+'] '+'Your current IP: '+ip);
  744. chaturbate.getID(function (ID) {
  745. if (ID) {
  746. var id = ID[getRandomInt(0, ID.length - 1)];
  747. console.log('['+os.hostname()+'] '+'Current ID: ' + id);
  748. chaturbate.signup(id);
  749. }
  750. });
  751.  
  752. }
  753. })
  754. }
  755. }
  756. if(status == 'trying'){
  757. }
  758. if(status == 'disconnected'){
  759. hma.connect();
  760. }
  761. }
  762. });
  763. }).then(function () {
  764. clearTimeout(timeout);
  765. timeout = setTimeout(function(){
  766. start();
  767. }, 3000);
  768. }).catch(function(err) {
  769. chaturbate.status = 'error:'+err;
  770. console.log('['+os.hostname()+'] '+'------------------ mainLoop ------------------');
  771. console.log('['+os.hostname()+'] '+chaturbate.status);
  772. });
  773. }
  774. //start();
  775.  
  776. function bongacashViews(){
  777. Promise.try(function() {
  778. // Проверяем статус VPN
  779. hma.status(function(status){
  780. if(typeof status != 'undefined'){
  781. status = status.replace('\n', '');
  782. console.log('['+os.hostname()+'] '+status);
  783. if(status == 'connected'){
  784. if(VISIT) {
  785. VISIT = false;
  786. ip.get(function(ip){
  787. if(ip){
  788. frame=0;
  789. console.log('['+os.hostname()+'] '+'Your current IP: '+ip);
  790. bongacams.getID(function(id){
  791. console.log('['+os.hostname()+'] id: '+id);
  792. bongacams.visit(id, function(response){
  793. if(response){
  794. console.log('['+os.hostname()+'] URL visit: OK!');
  795. setTimeout(function(){
  796. console.log('['+os.hostname()+'] URL visit: TRYING ...');
  797. session = bhttp.session();
  798. hma.close();
  799. VISIT=true;
  800. frame=0;
  801. bongacashViews();
  802. }, 25000);
  803. }else{
  804. console.log('['+os.hostname()+'] URL visit: OK!');
  805. setTimeout(function(){
  806. console.log('['+os.hostname()+'] URL visit: TRYING ...');
  807. session = bhttp.session();
  808. hma.close();
  809. VISIT=true;
  810. frame=0;
  811. bongacashViews();
  812. }, 25000);
  813. }
  814. });
  815. });
  816. }
  817. })
  818. }
  819. }
  820. if(status == 'trying'){
  821. }
  822. if(status == 'disconnected'){
  823. hma.connect();
  824. }
  825. }
  826. });
  827. }).then(function () {
  828. clearTimeout(timeout);
  829. timeout = setTimeout(function(){
  830. session = bhttp.session();
  831. hma.close();
  832. VISIT=true;
  833. frame=0;
  834. bongacashViews();
  835. }, 25000);
  836. }).catch(function(err) {
  837. chaturbate.status = 'error:'+err;
  838. console.log('['+os.hostname()+'] '+'------------------ mainLoop ------------------');
  839. console.log('['+os.hostname()+'] '+chaturbate.status);
  840. });
  841. }
  842.  
  843. //bongacashViews();
  844.  
  845. var oneHalfHour = false;
  846. var twoHalfHour = false;
  847. var lastHour;
  848.  
  849. function scheuldChecker(callback){
  850. var time = timestamp();
  851. if(oneHalfHour == false && twoHalfHour == false){
  852. console.log('Save Current Hour!');
  853. lastHour = time.hour;
  854. }
  855. if(lastHour != time.hour){
  856. console.log('New Hour Begin!');
  857. oneHalfHour = false;
  858. twoHalfHour = false;
  859. lastHour = time.hour;
  860. }
  861. if(oneHalfHour == false && parseInt(time.min) < parseInt(30)){
  862. oneHalfHour = true;
  863. console.log('First Registration DONE!');
  864. callback(true);
  865. }
  866. if(twoHalfHour == false && parseInt(time.min) > parseInt(30)){
  867. twoHalfHour = true;
  868. console.log('Second Registration DONE!');
  869. callback(true);
  870. }
  871. if(oneHalfHour == true){
  872. var wait = 30-time.min;
  873. console.log('Next registration after '+wait+' min.');
  874. }
  875. if(twoHalfHour == true){
  876. var wait = 60-time.min;
  877. console.log('Next registration after '+wait+' min.');
  878. }
  879. }
  880.  
  881.  
  882. function bongacashStart(){
  883. bongacams.getID(function(id){
  884. //generateScheuld(id, function(respond){
  885. // if(respond){
  886. scheuldChecker(function(result){
  887. if(result){
  888. ip.get(function(ip){
  889. compareIP(ip, id, function(respond){
  890. if(respond){
  891. console.log('['+os.hostname()+'] SIGN UP DONE! - ip: '+ip+' id: '+id);
  892. }
  893. });
  894. });
  895. }
  896. });
  897. // bongacams.visit(id, function(response){
  898. // if(response){
  899. // console.log('['+os.hostname()+'] URL visit: OK!');
  900. // setTimeout(function(){
  901. // console.log('['+os.hostname()+'] URL visit: TRYING ...');
  902. // bongacashStart();
  903. // }, 25000);
  904. // }else{
  905. // console.log('['+os.hostname()+'] URL visit: OK!');
  906. // setTimeout(function(){
  907. // console.log('['+os.hostname()+'] URL visit: TRYING ...');
  908. // bongacashStart();
  909. // }, 25000);
  910. // }
  911. // });
  912. // bongacams.signup(id, ip, function(response){
  913. // if(response){
  914. // console.log('['+os.hostname()+'] '+response);
  915. // setTimeout(function(){
  916. // email.getApproveURL(response, function(url){
  917. // if(typeof url != "undefined" && url != false){
  918. // console.log('['+os.hostname()+'] '+url);
  919. // email.approve(url, function(url){
  920. // console.log('['+os.hostname()+'] '+url);
  921. // setTimeout(function(){
  922. // console.log('['+os.hostname()+'] ----------------------');
  923. // //bongacashStart();
  924. // }, 5000);
  925. // });
  926. // }else{
  927. // email.getApproveURL(response);
  928. // }
  929. // });
  930. // }, 45000);
  931. // }else{
  932. // console.log('['+os.hostname()+'] ----------------------');
  933. // //bongacashStart();
  934. // }
  935. // });
  936.  
  937.  
  938.  
  939. // }
  940. //});
  941. });
  942. }
  943. setInterval(function(){
  944. bongacashStart();
  945. }, 2000);
  946.  
  947. //bongacashStart();
  948. //email.getApproveURL("motherfuckermickeybitch", function(response){
  949. // if(response){
  950. // console.log(response);
  951. // email.approve(response, function(username){
  952. // console.log(username);
  953. // });
  954. // }
  955. //});
  956. //email.create("motherfuckermickeybitch", function(response){
  957. // if(response){
  958. // console.log(response);
  959. // }
  960. //});
  961.  
  962. // MainLoop DONT USE
  963. var mainLoop = function () {
  964. chaturbate.getID(function(ID){
  965. if(ID){
  966. Promise.try(function () {
  967. sh.connect();
  968. sh.close();
  969. return ID[getRandomInt(0, ID.length-1)];
  970. }).then(function (id) {
  971. return id;
  972. }).then(function (id) {
  973. return id;
  974. }).then(function (id) {
  975. return id;
  976. }).then(function (id) {
  977. return id;
  978. }).then(function (id) {
  979. return id;
  980. }).then(function (id) {
  981. return id;
  982. }).then(function (id) {
  983. return id;
  984. }).then(function (id) {
  985. console.log('['+os.hostname()+'] '+id)
  986. // if(response.error){
  987. // console.log('['+os.hostname()+'] '+"ERR");
  988. // session = bhttp.session();
  989. // }else{
  990. // var $ = cheerio.load(response.body);
  991. // chaturbate.status = $('.username').html();
  992. // console.log('['+os.hostname()+'] '+'------------------ chaturbate.login() OK ------------------');
  993. // console.log('['+os.hostname()+'] '+chaturbate.status);
  994. // console.log('['+os.hostname()+'] '+'---------------------------------------------------------------------------');
  995. // }
  996. }).then(function () {
  997. clearTimeout(timeout);
  998. timeout = setTimeout(function(){
  999. mainLoop();
  1000. }, 1500);
  1001. }).catch(function(err) {
  1002. chaturbate.status = 'error:'+err;
  1003. console.log('['+os.hostname()+'] '+'------------------ mainLoop ------------------');
  1004. console.log('['+os.hostname()+'] '+chaturbate.status);
  1005. });
  1006. }
  1007. });
  1008. };
  1009. // MainLoop DONT USE
  1010.  
  1011. var cub = function(io) {
  1012. //io.on('connection', function(socket){
  1013. // console.log('['+os.hostname()+'] '+'a user connected');
  1014. // var sender = setInterval(function(){
  1015. // socket.emit('statistics', statisticsAll);
  1016. // socket.emit('status', true);
  1017. // }, 1000);
  1018. // socket.on('authorization', function(data){
  1019. // if(data == '1488'){
  1020. // socket.emit('authorization', 'ok');
  1021. // }
  1022. // });
  1023. // socket.on('disconnect', function(){
  1024. // clearInterval(sender);
  1025. // console.log('['+os.hostname()+'] '+'user disconnected');
  1026. // });
  1027. //});
  1028. };
  1029.  
  1030. module.exports.cub = cub;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement