17 faucets crypto bot & StormGain miner Trigger


SUBMITTED BY: PimpDaddy

DATE: July 2, 2021, 1:24 p.m.

UPDATED: July 2, 2021, 2:24 p.m.

FORMAT: Text only

SIZE: 81.1 kB

HITS: 1224

  1. SIgn Up TO facuets
  2. @note Links to create new accounts using my referral:
  3. // @note https://faucetpay.io/?r=1140585
  4. // @note https://freebitco.in/?r=46334826
  5. // @note https://app.stormgain.com/friend/BNS17722452
  6. // @note https://freecardano.com/?ref=346495
  7. // @note https://freebinancecoin.com/?ref=176633
  8. // @note https://freebitcoin.io/?ref=506599
  9. // @note https://freedash.io/?ref=132684
  10. // @note https://free-doge.com/?ref=199022
  11. // @note https://freeethereum.com/?ref=218020
  12. // @note https://freechainlink.io/?ref=84537
  13. // @note https://free-ltc.com/?ref=127524
  14. // @note https://freeneo.io/?ref=107888
  15. // @note https://freesteam.io/?ref=122086
  16. // @note https://free-tron.com/?ref=237317
  17. // @note https://freeusdcoin.com/?ref=139322
  18. // @note https://freetether.com/?ref=190533
  19. // @note https://freenem.com/?ref=300886
  20. // @note https://coinfaucet.io/?ref=822473
  21. Download tampermoney plugin
  22. Create new scritp
  23. SAVE.
  24. Go To: https://satology.onrender.com/faucets/referrals
  25. Faucet bot starts working
  26. // ==UserScript==
  27. // @name [satology] Auto Claim Multiple Faucets with Monitor UI
  28. // @description Freebitco.in, StormGain Miner, 15 Faucets + Promo Codes + Autologin.
  29. // @description Automatic activation of StormGain Miner every 4 hours and hourly claim of free ADA, BNB, BTC, DASH, DOGE, ETH, LINK, LTC, NEO, STEAM, TRX, USDC, USDT, XEM, XRP
  30. // @version 1.1.4
  31. // @author satology
  32. // @namespace satology.onrender.com
  33. // @homepage https://satology.onrender.com/faucets/referrals
  34. // @note ----------------------------------------I M P O R T A N T---------------------------------------------------------------------------------------
  35. // @note YOU MUST HAVE A hCaptcha solver INSTALLED to claim from the faucets
  36. // @note I recommend this script: https://greasyfork.org/en/scripts/425854-hcaptcha-solver-automatically-solves-hcaptcha-in-browser
  37. // @note ------------------------------------------------------------------------------------------------------------------------------------------------
  38. // @note ---------------------------------------- LAST UPDATES ------------------------------------------------------------------------------------------
  39. // @note [@1.1.0] Added Freebitco.in and autologin for @cryptosfaucets
  40. // @note > You can enable autologin/credentials in the config object
  41. // @note > You can enable activation of daily RPBonus for FreeBitco.in in the config object
  42. // @note > Added boolean setToEnglish (DEFAULT TRUE) at localeConfig object, to change the language of the faucets to English.
  43. // @note ---------------------------------------- LAST UPDATES ------------------------------------------------------------------------------------------
  44. // @note ------------------------------------------------------------------------------------------------------------------------------------------------
  45. // @note MAIN FEATURES:
  46. // @note > Automatic hourly rolls for 16 faucets: Freebitco.in and @CryptosFaucets (ADA, BNB, BTC, DASH, DOGE, ETH, LINK, LTC, NEO, STEAM, TRX, USDC, USDT, XEM, XRP)
  47. // @note > Automatic activation of StormGain Miner (free BTC every 4 hours)
  48. // @note > Accepts promotion codes (http://twitter.com/cryptosfaucets, free roll shortlinks) for the 15 faucets
  49. // @note > Simple Monitor UI on top of a website to track progress (claims, next rolls, promo codes)
  50. // @note ------------------------------------------------------------------------------------------------------------------------------------------------
  51. // @note IMPORTANT CONSIDERATIONS:
  52. // @note 0. You need to enable popups on the Manager UI website to be able to open the faucets
  53. // @note 2. FAUCETS WEBSITES MUST OPEN IN ENGLISH TO BE ABLE TO RECOGNIZE IF THE PROMO CODE WAS ACCEPTED
  54. // @note In case you don't want to have them in English, you need to change the 3 strings the code uses for validation
  55. // @note (Search for localeStrings in the code and replace them)
  56. // @note 3. Autorolls will trigger ONLY when the faucet was opened by the Manager UI.
  57. // @note This is to allow users to navigate the websites to get the ShortLinks extra rolls, for example,
  58. // @note without having to stop the script.
  59. // @note 5. You can disable faucets from the script in case you need to or you are not registered yet.
  60. // @note It would be great if you could use my referral links listed below if you need an account.
  61. // @note To disable them, just set enabled: false in the webList array, save the script & refresh the manager
  62. // @note 6. All data stored for tracking and to be displayed is stored locally in your environment. Nothing is uploaded.
  63. // @note Always open to feedback. I'd be glad to hear from you if you find any bugs, have suggestions or new enhancements/features you'd like to see
  64. // @note ------------------------------------------------------------------------------------------------------------------------------------------------
  65. // @note ----------------------------------------I M P O R T A N T---------------------------------------------------------------------------------------
  66. // @note [@1.0.11] Modified timeouts and removed auto refresh. YOU MUST HAVE A hCaptcha solver INSTALLED to claim from the faucets now as they've added it and it's working.
  67. // @note I recommend this script: https://greasyfork.org/en/scripts/425854-hcaptcha-solver-automatically-solves-hcaptcha-in-browser
  68. // @note ------------------------------------------------------------------------------------------------------------------------------------------------
  69. // @note ------------------------------------------------------------------------------------------------------------------------------------------------
  70. // @note Requested for upcoming updates:
  71. // @note - Enable/Disable faucet from the Manager UI, add extra column with conversion
  72. // @note - Implement FaucetPay PTC autoclicker (https://faucetpay.io/?r=1140585)
  73. // @note - Add bagi.co.in
  74. // @note ------------------------------------------------------------------------------------------------------------------------------------------------
  75. // @note Links to create new accounts using my referral:
  76. // @note https://faucetpay.io/?r=1140585
  77. // @note https://freebitco.in/?r=46334826
  78. // @note https://app.stormgain.com/friend/BNS17722452
  79. // @note https://freecardano.com/?ref=346495
  80. // @note https://freebinancecoin.com/?ref=176633
  81. // @note https://freebitcoin.io/?ref=506599
  82. // @note https://freedash.io/?ref=132684
  83. // @note https://free-doge.com/?ref=199022
  84. // @note https://freeethereum.com/?ref=218020
  85. // @note https://freechainlink.io/?ref=84537
  86. // @note https://free-ltc.com/?ref=127524
  87. // @note https://freeneo.io/?ref=107888
  88. // @note https://freesteam.io/?ref=122086
  89. // @note https://free-tron.com/?ref=237317
  90. // @note https://freeusdcoin.com/?ref=139322
  91. // @note https://freetether.com/?ref=190533
  92. // @note https://freenem.com/?ref=300886
  93. // @note https://coinfaucet.io/?ref=822473
  94. // @note ------------------------------------------------------------------------------------------------------------------------------------------------
  95. // @note If you wanna team up or just share some ideas, you can contact me at satology@protonmail.com
  96. // @note ------------------------------------------------------------------------------------------------------------------------------------------------
  97. // @grant GM_setValue
  98. // @grant GM_getValue
  99. // @grant window.close
  100. // @grant GM_openInTab
  101. // @icon https://www.google.com/s2/favicons?domain=stormgain.com
  102. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js
  103. // @match https://satology.onrender.com/faucets/referrals*
  104. // @match https://app.stormgain.com/crypto-miner/
  105. // @match https://freecardano.com/*
  106. // @match https://freebinancecoin.com/*
  107. // @match https://freebitcoin.io/*
  108. // @match https://freedash.io/*
  109. // @match https://free-doge.com/*
  110. // @match https://freeethereum.com/*
  111. // @match https://freechainlink.io/*
  112. // @match https://free-ltc.com/*
  113. // @match https://freeneo.io/*
  114. // @match https://freesteam.io/*
  115. // @match https://free-tron.com/*
  116. // @match https://freeusdcoin.com/*
  117. // @match https://freetether.com/*
  118. // @match https://freenem.com/*
  119. // @match https://coinfaucet.io/*
  120. // @match https://freebitco.in/
  121. // ==/UserScript==
  122. (function() {
  123. 'use strict';
  124. /**
  125. * Specific string values to check if a promotion code was succesfully processed (used via indexOf).
  126. * Defaults are set for English.
  127. * If you want to view the faucets in another language, you will need to change the following values
  128. */
  129. const localeConfig = {
  130. setToEnglish: true, // will set the faucets to English
  131. stringSearches: {
  132. promoCodeAccepted: 'roll',
  133. promoCodeUsed: 'already used',
  134. promoCodeInvalid: 'not found',
  135. promoCodeInvalid2: 'only alphanumeric',
  136. promoCodeInvalid3: 'ended'
  137. }
  138. };
  139. const WebType = {
  140. CRYPTOSFAUCETS: 1,
  141. STORMGAIN: 2,
  142. FREEBITCOIN: 3
  143. };
  144. const CFUrlType = {
  145. HOME: 0,
  146. FREE: 1,
  147. CONTACTTWITTER: 2,
  148. PROMOTION: 3,
  149. STATS: 4,
  150. SETTINGS: 5,
  151. FREEROLLS: 6,
  152. IGNORE: 99
  153. };
  154. const PromoStatus = {
  155. NOCODE: 0,
  156. PENDING: 1,
  157. ACCEPTED: 2,
  158. USEDBEFORE: 3,
  159. INVALID: 4,
  160. UNKNOWNERROR: 5
  161. };
  162. const RandomInteractionLevel = {
  163. NONE: 0,
  164. LOW: 1,
  165. MEDIUM: 2,
  166. HIGH: 3
  167. };
  168. let config = {
  169. timeout: 4, // Use -1 to disable the timeout functionality. In minutes. Max time the monitor will wait for a result/roll.
  170. // After timeout is reached, the Manager/Monitor will assume something is wrong
  171. // (usually faucet tab being accidentally closed or failed to connect)
  172. // Will trigger a refresh on the Monitor website and carry on the process
  173. postponeMinutes: 65, // Minutes to wait before retrying a faucet that timed out
  174. cf: {
  175. autologin: false,
  176. credentials: {
  177. mode: 1, // POSSIBLE VALUES:
  178. // 1: Use email/password saved through the script
  179. // 2: Waits for the credentials to be added manually or by a third party software/extension.
  180. // Useful if you use different email/password combinations on each faucet
  181. email: 'YOUR@EMAIL.com',
  182. password: 'YOURPASSWORD'
  183. }
  184. },
  185. fb: {
  186. activateRPBonus: false // will try to activate the highest RP Roll Bonus available for the account (100, 50 25, ... points per roll),
  187. }
  188. }
  189. let persistence, shared, manager, ui, CFPromotions, interactions, SGProcessor, CFProcessor, CFHistory, FBProcessor;
  190. let helpers = {
  191. cleanString: function(input) {
  192. var output = "";
  193. for (var i=0; i<input.length; i++) {
  194. if (input.charCodeAt(i) <= 127) {
  195. output += input.charAt(i);
  196. }
  197. }
  198. return output;
  199. },
  200. shuffle: function (array) {
  201. let currentIndex = array.length, temporaryValue, randomIndex;
  202. while (0 !== currentIndex) {
  203. randomIndex = Math.floor(Math.random() * currentIndex);
  204. currentIndex -= 1;
  205. temporaryValue = array[currentIndex];
  206. array[currentIndex] = array[randomIndex];
  207. array[randomIndex] = temporaryValue;
  208. }
  209. return array;
  210. },
  211. getPrintableTime: function (date = new Date()) {
  212. return ('0' + date.getHours()).slice(-2) + ':' + ('0' + date.getMinutes()).slice(-2) + ':' + ('0' + date.getSeconds()).slice(-2)
  213. },
  214. getPrintableDateTime: function (date) {
  215. if (date != null) {
  216. return ('0' + date.getDate()).slice(-2) + '/' + ('0' + (date.getMonth() + 1)).slice(-2) + ' ' + ('0' + date.getHours()).slice(-2) + ':' + ('0' + date.getMinutes()).slice(-2);
  217. } else {
  218. return '';
  219. }
  220. },
  221. getEnumText: function (enm, value) {
  222. return Object.keys(enm).find(key => enm[key] === value);
  223. },
  224. randomMs: function (a, b){
  225. return a + (b - a) * Math.random();
  226. },
  227. addMinutes: function(date, mins) {
  228. return date.setMinutes(date.getMinutes() + parseInt(mins) + 1);
  229. },
  230. randomInt: function(min, max) {
  231. return Math.floor(Math.random() * (max - min + 1) + min);
  232. },
  233. addMilliseconds: function(date, ms) {
  234. return date.setMilliseconds(date.getMilliseconds() + ms);
  235. },
  236. getRandomMillisecondsFromMinutesRange(minute, rangeDiffInPercentage) {
  237. const msCenter = minute * 60 * 1000;
  238. const msRangeDiff = Math.round(msCenter * rangeDiffInPercentage / 100);
  239. return helpers.randomMs(msCenter - msRangeDiff, msCenter + msRangeDiff);
  240. },
  241. getEmojiForPromoStatus: function(promoStatus) {
  242. switch (promoStatus) {
  243. case PromoStatus.NOCODE:
  244. return '⚪';
  245. break;
  246. case PromoStatus.PENDING:
  247. return '⏳';
  248. break;
  249. case PromoStatus.ACCEPTED:
  250. return '✔️';
  251. break;
  252. case PromoStatus.USEDBEFORE:
  253. return '🕙';
  254. break;
  255. case PromoStatus.INVALID:
  256. return '❌';
  257. break;
  258. case PromoStatus.UNKNOWNERROR:
  259. return '❗';
  260. break;
  261. }
  262. },
  263. getHost: function(url, withHttps = false) {
  264. if (url.includes('//')) {
  265. url = url.split('//')[1];
  266. }
  267. url = url.split('/')[0];
  268. return withHttps ? ('https://' + url) : url;
  269. },
  270. cf: {
  271. getUrlType: function(url) {
  272. if (url.endsWith('/free')) {
  273. return CFUrlType.FREE;
  274. }
  275. if (url.includes('/promotion/')) {
  276. return CFUrlType.PROMOTION;
  277. }
  278. if (url.endsWith('/contact-twitter')) {
  279. return CFUrlType.CONTACTTWITTER;
  280. }
  281. if (url.endsWith('/free-rolls')) {
  282. return CFUrlType.FREEROLLS;
  283. }
  284. if (url.endsWith('/settings')) {
  285. return CFUrlType.SETTINGS;
  286. }
  287. if (url.endsWith('/stats')) {
  288. return CFUrlType.STATS;
  289. }
  290. if (url.endsWith('/')) {
  291. url = url.slice(0, -1);
  292. if (url == helpers.getHost(url, true)) {
  293. return CFUrlType.HOME;
  294. }
  295. }
  296. return CFUrlType.IGNORE;
  297. }
  298. }
  299. }
  300. let objectGenerator = {
  301. createPersistence: function() {
  302. const prefix = 'autoWeb_';
  303. function save(key, value, parseIt = false) {
  304. GM_setValue(prefix + key, parseIt ? JSON.stringify(value) : value);
  305. };
  306. function load(key, parseIt = false) {
  307. let value = GM_getValue(prefix + key);
  308. if(value && parseIt) {
  309. value = JSON.parse(value);
  310. }
  311. return value;
  312. };
  313. return {
  314. save: save,
  315. load: load
  316. };
  317. },
  318. createShared: function() {
  319. let flowControl;
  320. function isOpenedByManager(currentHost) {
  321. loadFlowControl();
  322. if(!flowControl) {
  323. return false;
  324. }
  325. let millisecondsDistance = new Date() - flowControl.requestedTime;
  326. // if(flowControl.opened || flowControl.host != currentHost || millisecondsDistance > 120000) {
  327. if(flowControl.opened || (flowControl.host != currentHost && !flowControl.expectedHosts.includes(currentHost)) || millisecondsDistance > 120000) {
  328. return false;
  329. }
  330. return true;
  331. };
  332. function setFlowControl(id, url, webType, expectedHosts) {
  333. flowControl = {
  334. id: id,
  335. url: url,
  336. host: helpers.getHost(url),
  337. type: webType,
  338. requestedTime: new Date(),
  339. opened: false,
  340. expectedHosts: expectedHosts,
  341. error: false,
  342. result: {}
  343. };
  344. persistence.save('flowControl', flowControl, true);
  345. };
  346. function wasVisited(expectedId) {
  347. loadFlowControl();
  348. return flowControl.id == expectedId && flowControl.opened;
  349. };
  350. function hasErrors(expectedId) {
  351. return flowControl.id == expectedId && flowControl.error;
  352. };
  353. function getResult() {
  354. return flowControl.result;
  355. };
  356. function getCurrent() {
  357. let current = {};
  358. current.url = flowControl.url;
  359. current.host = flowControl.host;
  360. current.type = flowControl.type;
  361. return current;
  362. };
  363. function saveAndclose(runDetails, delay = 0) {
  364. markAsVisited(runDetails);
  365. if(delay) {
  366. setTimeout(window.close, delay);
  367. } else {
  368. window.close();
  369. }
  370. };
  371. function loadFlowControl() {
  372. flowControl = persistence.load('flowControl', true);
  373. };
  374. function markAsVisited(runDetails) {
  375. flowControl.opened = true;
  376. flowControl.result = runDetails;
  377. persistence.save('flowControl', flowControl, true);
  378. };
  379. function closeWithError(errorType, errorMessage) {
  380. flowControl.error = true;
  381. flowControl.result = {
  382. errorType: errorType,
  383. errorMessage: errorMessage
  384. };
  385. persistence.save('flowControl', flowControl, true);
  386. window.close();
  387. };
  388. return {
  389. setFlowControl: setFlowControl,
  390. wasVisited: wasVisited,
  391. isOpenedByManager: isOpenedByManager,
  392. getCurrent: getCurrent,
  393. getResult: getResult,
  394. closeWindow: saveAndclose,
  395. closeWithError: closeWithError,
  396. hasErrors: hasErrors
  397. };
  398. },
  399. createManager: function() {
  400. let timestamp = null;
  401. let timeWaiting = 0;
  402. let promoInterval;
  403. let webList = [
  404. { id: '1', name: 'ADA', url: 'https://freecardano.com/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  405. { id: '2', name: 'BNB', url: 'https://freebinancecoin.com/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  406. { id: '3', name: 'BTC', url: 'https://freebitcoin.io/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  407. { id: '4', name: 'DASH', url: 'https://freedash.io/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  408. { id: '5', name: 'ETH', url: 'https://freeethereum.com/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  409. { id: '6', name: 'LINK', url: 'https://freechainlink.io/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  410. { id: '7', name: 'LTC', url: 'https://free-ltc.com/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  411. { id: '8', name: 'NEO', url: 'https://freeneo.io/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  412. { id: '9', name: 'STEAM', url: 'https://freesteam.io/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  413. { id: '10', name: 'TRX', url: 'https://free-tron.com/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  414. { id: '11', name: 'USDC', url: 'https://freeusdcoin.com/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  415. { id: '12', name: 'USDT', url: 'https://freetether.com/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  416. { id: '13', name: 'XEM', url: 'https://freenem.com/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  417. { id: '14', name: 'XRP', url: 'https://coinfaucet.io/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  418. { id: '15', name: 'StormGain', url: 'https://app.stormgain.com/crypto-miner/', type: WebType.STORMGAIN, enabled: true },
  419. { id: '16', name: 'DOGE', url: 'https://free-doge.com/free', type: WebType.CRYPTOSFAUCETS, enabled: true },
  420. { id: '17', name: 'FreeBitco.in', url: 'https://freebitco.in/', type: WebType.FREEBITCOIN, enabled: true }
  421. ];
  422. function start(){
  423. loader.initialize();
  424. ui.init(getCFlist());
  425. update();
  426. promoInterval = setInterval(manager.readNewPromoCode, 5000);
  427. setTimeout(manager.process, 10000);
  428. };
  429. let loader = function() {
  430. function initialize() {
  431. setTimestamp();
  432. initializeWebList();
  433. initializePromotions();
  434. initializeHistory();
  435. };
  436. function initializeWebList() {
  437. let storedData = persistence.load('webList', true);
  438. if(storedData) {
  439. let newOnes = addNewOnes(storedData);
  440. if (newOnes) {
  441. newOnes.forEach( function (element, idx, arr) {
  442. storedData.push(element);
  443. });
  444. }
  445. let disabledList = webList.filter( x => !x.enabled ).map( x => x.id );
  446. storedData.forEach( function (element, idx, arr) {
  447. arr[idx].nextRoll = element.nextRoll ? new Date(element.nextRoll) : new Date();
  448. arr[idx].enabled = !disabledList.includes(element.id);
  449. });
  450. webList = storedData;
  451. setup();
  452. } else {
  453. setup(true);
  454. }
  455. };
  456. function addNewOnes(storedData) {
  457. let allIds = webList.map( x => x.id );
  458. let storedIds = storedData.map( x => x.id );
  459. let newOnes = allIds.filter( x => !storedIds.includes(x) );
  460. return webList.filter( x => newOnes.includes(x.id) );
  461. };
  462. function initializePromotions() {
  463. let storedData = persistence.load('CFPromotions', true);
  464. if (storedData) {
  465. storedData.forEach( function (element, idx, arr) {
  466. arr[idx].added = new Date(element.added);
  467. arr[idx].statusPerFaucet.forEach( function (el, i, a) {
  468. a[i].execTimeStamp = (el.execTimeStamp != null) ? new Date(el.execTimeStamp) : null;
  469. });
  470. });
  471. CFPromotions.load(storedData);
  472. }
  473. };
  474. function initializeHistory() {
  475. CFHistory.initOrLoad();
  476. };
  477. function setTimestamp() {
  478. timestamp = new Date().getTime();
  479. persistence.save('timestamp', timestamp);
  480. };
  481. function removeDisabledFaucets() {
  482. webList = webList.filter(x => x.enabled);
  483. };
  484. function setup(reset = false) {
  485. removeDisabledFaucets();
  486. if(reset) {
  487. helpers.shuffle(webList);
  488. }
  489. let timeDistance = 0;
  490. webList.forEach( function (element, idx, arr) {
  491. if (reset || !element.lastClaim) {
  492. arr[idx].lastClaim = 0;
  493. }
  494. if (reset || !element.aggregate) {
  495. arr[idx].aggregate = 0;
  496. }
  497. if (reset || !element.balance) {
  498. arr[idx].balance = 0;
  499. }
  500. if (reset || !element.stats) {
  501. arr[idx].stats = {};
  502. }
  503. if (reset || !element.nextRoll) {
  504. timeDistance += helpers.randomMs(10000, 15000);
  505. arr[idx].nextRoll = new Date(helpers.addMilliseconds(new Date(), timeDistance));
  506. }
  507. });
  508. };
  509. return {
  510. initialize: initialize
  511. };
  512. }();
  513. function update(sortIt = true) {
  514. if(sortIt) {
  515. webList.sort((a,b) => a.nextRoll.getTime() - b.nextRoll.getTime());
  516. }
  517. persistence.save('webList', webList, true);
  518. ui.refresh(webList, CFPromotions.getAll());
  519. updateRollStatsSpan();
  520. };
  521. function process() {
  522. if(isObsolete()) {
  523. return;
  524. }
  525. if(webList[0].nextRoll.getTime() < (new Date()).getTime()) {
  526. ui.log(`Opening ${webList[0].name}`);
  527. open();
  528. } else {
  529. let timeUntilNext = webList[0].nextRoll.getTime() - (new Date()).getTime() + helpers.randomMs(1000, 2000);
  530. ui.log(`Waiting ${(timeUntilNext/1000/60).toFixed(2)} minutes...`);
  531. setTimeout(manager.process, timeUntilNext);
  532. }
  533. };
  534. function isObsolete() {
  535. let savedTimestamp = persistence.load('timestamp');
  536. if (savedTimestamp && savedTimestamp > timestamp) {
  537. ui.log('<b>STOPING EXECUTION!<b> A new Manager UI window was opened. Process should continue there');
  538. clearInterval(promoInterval);
  539. return true;
  540. }
  541. return false;
  542. };
  543. function open(promoCode) {
  544. let navUrl = webList[0].url;
  545. if(promoCode) {
  546. navUrl = getPromoUrl(promoCode);
  547. ui.log(`Opening ${webList[0].name} with Promo Code [${promoCode}]`);
  548. }
  549. let expectedHosts = [];
  550. expectedHosts.push((new URL(navUrl)).host);
  551. if(webList[0].type == webList[0].type == WebType.STORMGAIN) {
  552. expectedHosts.push((new URL('https://www.google.com').host));
  553. expectedHosts.push((new URL('https://www.recaptcha.net').host));
  554. }
  555. shared.setFlowControl(webList[0].id, navUrl, webList[0].type, expectedHosts);
  556. setTimeout(manager.resultReader, 15000);
  557. // GM_openInTab(navUrl, 'loadInBackground');
  558. GM_openInTab(navUrl, { active: false});
  559. };
  560. function getPromoUrl(promoCode) {
  561. let url = webList[0].url;
  562. url = url.slice(0, url.length - 4);
  563. return url + "promotion/" + promoCode;
  564. }
  565. function resultReader() {
  566. if(isObsolete()) {
  567. return;
  568. }
  569. if(shared.wasVisited(webList[0].id)) {
  570. timeWaiting = 0;
  571. let result = shared.getResult();
  572. if (result) {
  573. updateWebListItem(result);
  574. if ( (webList[0].type == WebType.CRYPTOSFAUCETS) &&
  575. ( (result.claimed) || (result.promoStatus && result.promoStatus != PromoStatus.ACCEPTED) )) {
  576. let promoCode = CFPromotions.hasPromoAvailable(webList[0].id);
  577. if (promoCode) {
  578. update(false);
  579. open(promoCode);
  580. return;
  581. }
  582. }
  583. } else {
  584. ui.log(`Unable to read last run result, for ID: ${webList[0].id} > ${webList[0].name}`);
  585. }
  586. update(true);
  587. process();
  588. return;
  589. } else {
  590. timeWaiting += 15;
  591. if (!shared.hasErrors(webList[0].id) && !hasTimedOut()) {
  592. ui.log(`Waiting for ${webList[0].name} results...`, timeWaiting);
  593. setTimeout(manager.resultReader, 15000);
  594. return;
  595. // Handle Error
  596. let errorDetails = shared.getResult();
  597. ui.log(`${webList[0].name} closed with error: ${errorDetails.errorType} ${errorDetails.errorMessage}`);
  598. let millisecondsDelay = helpers.getRandomMillisecondsFromMinutesRange(config.postponeMinutes, 5);
  599. webList[0].nextRoll = new Date(helpers.addMilliseconds(new Date(), millisecondsDelay));
  600. update(true);
  601. window.location.reload();
  602. return;
  603. }
  604. if (shared.hasErrors(webList[0].id)) {
  605. webList[0].stats.errors = shared.getResult();
  606. ui.log(`${webList[0].name} closed with error: ${webList[0].stats.errors.errorType} ${webList[0].stats.errors.errorMessage}`);
  607. }
  608. if (hasTimedOut()) {
  609. if(webList[0].stats.countTimeouts) {
  610. webList[0].stats.countTimeouts += 1;
  611. } else {
  612. webList[0].stats.countTimeouts = 1;
  613. }
  614. ui.log(`Waited too much time for ${webList[0].name} results: triggering timeout`);
  615. }
  616. let millisecondsDelay = helpers.getRandomMillisecondsFromMinutesRange(config.postponeMinutes, 5);
  617. webList[0].nextRoll = new Date(helpers.addMilliseconds(new Date(), millisecondsDelay));
  618. update(true);
  619. window.location.reload();
  620. return;
  621. }
  622. };
  623. function hasTimedOut() {
  624. return config.timeout != -1 && (timeWaiting > (config.timeout * 60));
  625. };
  626. function updateWebListItem(result) {
  627. ui.log(`Updating data: ${JSON.stringify(result)}`);
  628. webList[0].stats.countTimeouts = 0;
  629. webList[0].stats.errors = null;
  630. if (result.claimed) {
  631. result.claimed = parseFloat(result.claimed);
  632. if(!isNaN(result.claimed)) {
  633. webList[0].lastClaim = result.claimed;
  634. webList[0].aggregate += result.claimed;
  635. }
  636. }
  637. if(result.balance) {
  638. webList[0].balance = result.balance;
  639. }
  640. if(result.nextRoll) {
  641. webList[0].nextRoll = new Date(result.nextRoll);
  642. }
  643. if(result.promoStatus) {
  644. CFPromotions.updateFaucetForCode(result.promoCode, webList[0].id, result.promoStatus);
  645. }
  646. if(result.rolledNumber) {
  647. CFHistory.addRoll(result.rolledNumber);
  648. }
  649. };
  650. function readNewPromoCode() {
  651. let promoCodeElement = $('#promo-code-new')[0];
  652. let promoCode = helpers.cleanString(promoCodeElement.innerText);
  653. let promoDisplayStatus = $('#promo-display-status')[0];
  654. if (promoCode == 'REMOVEALLPROMOS' ) {
  655. CFPromotions.removeAll();
  656. promoCodeElement.innerText = '';
  657. promoDisplayStatus.innerHTML = 'Promo codes removed!';
  658. ui.refresh(null, CFPromotions.getAll());
  659. } else if(promoCode != '') {
  660. CFPromotions.addNew(promoCode);
  661. promoCodeElement.innerText = '';
  662. $('#promo-text-input').val('');
  663. promoDisplayStatus.innerHTML = 'Code ' + promoCode + ' added!';
  664. ui.log(`Promo code ${promoCode} added`);
  665. ui.refresh(null, CFPromotions.getAll());
  666. }
  667. };
  668. function updateRollStatsSpan() {
  669. let rollsSpanElement = $('#rolls-span')[0];
  670. rollsSpanElement.innerText = CFHistory.getRollsMeta().join(',');
  671. };
  672. function getCFlist() {
  673. let items;
  674. items = webList.filter(f => f.type === WebType.CRYPTOSFAUCETS);
  675. items = items.map(x => {
  676. return {
  677. id: x.id,
  678. name: x.name
  679. };});
  680. items.sort((a, b) => (a.name > b.name) ? 1 : -1);
  681. return items;
  682. };
  683. return{
  684. init:start,
  685. process: process,
  686. resultReader: resultReader,
  687. getFaucetsForPromotion: getCFlist,
  688. readNewPromoCode: readNewPromoCode
  689. };
  690. },
  691. createUi: function() {
  692. let logLines = ['', '', '', '', ''];
  693. function init(cfFaucets) {
  694. appendCSS();
  695. appendJavaScript();
  696. appendHtml();
  697. createPromoTable(cfFaucets);
  698. };
  699. function appendCSS() {
  700. let css = '';
  701. $('head').append(css);
  702. };
  703. function appendJavaScript() {
  704. let js = '';
  705. js += '<script language="text/javascript">';
  706. js += 'var myBarChart;';
  707. js += 'function savePromoCode() {';
  708. js += 'var promoText = document.getElementById("promo-text-input");';
  709. js += 'var promoCode = document.getElementById("promo-code-new");';
  710. js += 'var promoDisplayStatus = document.getElementById("promo-display-status");';
  711. js += 'promoCode.innerHTML = promoText.value.trim();';
  712. js += 'promoDisplayStatus.innerHTML = "Adding code&nbsp&quot;<b>" + promoCode.innerHTML + "</b>&quot;... This could take around a minute. Please wait..."';
  713. js += '}';
  714. js += 'function removeAllPromos() {';
  715. js += 'var promoCode = document.getElementById("promo-code-new");';
  716. js += 'var promoDisplayStatus = document.getElementById("promo-display-status");';
  717. js += 'promoCode.innerHTML = "REMOVEALLPROMOS";';
  718. js += 'promoDisplayStatus.innerHTML = "Removing all promotion codes... This could take around a minute. Please wait..."';
  719. js += '}';
  720. js += 'function openStatsChart() {';
  721. js += 'if(myBarChart) { myBarChart.destroy(); }';
  722. js += 'let statsFragment = document.getElementById("stats-fragment");';
  723. js += 'if (statsFragment.style.display === "block") { statsFragment.style.display = "none"; document.getElementById("stats-button").innerText = "Lucky Number Stats"; } else {';
  724. js += 'statsFragment.style.display = "block"; document.getElementById("stats-button").innerText = "Close Stats";';
  725. js += 'var canvas = document.getElementById("barChart");';
  726. js += 'var ctx = canvas.getContext("2d");';
  727. js += 'var dataSpan = document.getElementById("rolls-span");';
  728. js += 'var data = {';
  729. js += 'labels: ["0000-9885", "9886-9985", "9986-9993", "9994-9997", "9998-9999", "10000"],';
  730. js += 'datasets: [ { fill: false, backgroundColor: [ "#990000", "#660066", "#000099", "#ff8000", "#ffff00", "#00ff00"],';
  731. js += 'data: dataSpan.innerText.split(",") } ] };';
  732. js += 'var options = { plugins: { legend: { display: false } }, title: { display: true, text: "Rolled Numbers", position: "top" }, rotation: -0.3 * Math.PI };';
  733. js += 'myBarChart = new Chart(ctx, { type: "pie", data: data, options: options }); } }';
  734. js += '</script>';
  735. $('head').append(js);
  736. };
  737. function appendHtml() {
  738. let html ='';
  739. html += '<pre style="width:100%;" id="console-log"><b>Loading...</b></pre>';
  740. html += '<section id="stats-fragment" class="fragment" style="display:none;"><div class="container-fluid bg-dark "><div class="container py-1 "><div class="row align-items-center text-center justify-content-center">';
  741. html += '<div class="col-md-3"><canvas id="barChart"></canvas><span id="rolls-span" style="display:none;"></span></div></div></div></div></div></section>';
  742. html += '<section id="table-struct" class="fragment "><div class="container-fluid bg-dark "><div class="container py-1 "><div class="row mx-0"><div class="title col-3 px-0 text-white"><h2>Schedule</h2></div>';
  743. html += '<div class="title col-6 w-100 text-white"></div><div class="title col-3 text-right"><a class="btn m-2 anchor btn-outline-primary" id="stats-button" onclick="openStatsChart()">Lucky Number Stats</a></div></div>';
  744. html += '<div class="row align-items-center text-center justify-content-end">';
  745. html += '<div class="col-12 order-lg-1 text-center"><div class="row justify-content-center"><div class="col table-responsive" id="schedule-container"></div></div></div></div></div></div></section>';
  746. html +='<section id="table-struct-promo" class="fragment "><div class="container-fluid bg-dark "><div class="container py-1 "><div class="row mx-0">';
  747. html +='<div class="title col-3 px-0 text-white"><h2>Promo Codes</h2></div><div class="title col-3 w-100 text-white">';
  748. html +='<div class="input-group my-0"><input type="text" class="form-control py-1" id="promo-text-input" placeholder="Type a Promo code...">';
  749. html +='<div class="input-group-append"><button class="btn btn-success" id="promo-button" onclick="savePromoCode()"><i class="fa fa-plus"></i></button>';
  750. html +='</div></div></div><div class="title col-4 text-white justify-content-end"><span id="promo-display-status" class="text-white"></span>';
  751. html +='<span id="promo-code-new" style="display:none;"></span></div><div class="title col-2 text-right"><a class="btn m-2 anchor btn-outline-danger" id="promo-button" onclick="removeAllPromos()">Remove All</a>';
  752. html +='</div></div><div class="row align-items-center text-center justify-content-end"><div class="col-12 order-lg-1 text-center">';
  753. html +='<div class="row justify-content-center"><div class="col table-responsive" id="promo-container"></div></div></div></div></div></div></section>';
  754. $('#referral-table').before(html);
  755. $('#schedule-container').append( createScheduleTable() );
  756. };
  757. function createPromoTable(faucets) {
  758. let tableStructure = '';
  759. tableStructure += '<table class="table table-bordered text-white" id="promo-table">';
  760. tableStructure += '<caption style="text-align: -webkit-center;">⏳ Pending ✔️ Accepted 🕙 Used Before ❌ Invalid code ❗ Unknown error ⚪ No code</caption>';
  761. tableStructure += '<thead><tr><th class="">Code</th><th class="">Added</th>';
  762. for (let i = 0, all = faucets.length; i < all; i++) {
  763. tableStructure += '<th data-faucet-id="' + faucets[i].id + '">' + faucets[i].name + '</th>';
  764. }
  765. tableStructure += '</tr></thead><tbody id="promo-table-body"></tbody></table>';
  766. $('#promo-container').append( tableStructure );
  767. };
  768. function createScheduleTable() {
  769. let tableStructure = '';
  770. tableStructure += '<table class="table table-bordered text-white" id="schedule-table"><thead><tr>';
  771. tableStructure += '<th class="hide-on-mobile">#</th><th class="">Name</th><th class="">Last Claim</th>';
  772. tableStructure += '<th class="hide-on-mobile">Aggregate</th><th class="hide-on-mobile">Balance</th><th class="">Next Roll</th>';
  773. tableStructure += '</tr></thead><tbody id="schedule-table-body"></tbody></table>';
  774. return tableStructure;
  775. };
  776. function loadScheduleTable(data) {
  777. let tableBody = '';
  778. for(let i=0, all = data.length; i < all; i++) {
  779. tableBody += '<tr class="align-middle" data-id="' + data[i].id + '">';
  780. tableBody +='<td class="align-middle hide-on-mobile">' + (i + 1).toString() + '</td>';
  781. tableBody +='<td class="align-middle">' + data[i].name + '</td>';
  782. tableBody +='<td class="align-middle">' + data[i].lastClaim.toFixed(8) + '</td>';
  783. tableBody +='<td class="align-middle hide-on-mobile">' + data[i].aggregate.toFixed(8) + '</td>';
  784. tableBody +='<td class="align-middle hide-on-mobile">' + (data[i].balance ? data[i].balance.split(' ')[0] : "") + '</td>';
  785. tableBody +='<td class="align-middle">' + helpers.getPrintableTime(data[i].nextRoll) + addBadges(data[i].stats) + '</td>';
  786. tableBody +='</tr>';
  787. }
  788. $('#schedule-table-body').html(tableBody);
  789. };
  790. function addBadges(stats) {
  791. let consecutiveTimeout = stats.countTimeouts;
  792. let otherErrors = stats.errors;
  793. let html = ' ';
  794. if (consecutiveTimeout) {
  795. html += `<span class="badge badge-pill badge-warning" title="${consecutiveTimeout} consecutive timeouts">${consecutiveTimeout}</span>`;
  796. }
  797. if (otherErrors) {
  798. html += `<span class="badge badge-pill badge-warning" title="${otherErrors.errorMessage}">${otherErrors.errorType}</span>`;
  799. }
  800. return html;
  801. }
  802. function loadPromotionTable(codes) {
  803. let tableBody = '';
  804. for(let c=0; c < codes.length; c++) {
  805. let data = codes[c];
  806. tableBody += '<tr data-promotiobn-id="' + data.id + '">';
  807. tableBody += '<td class="align-middle">' + data.code + '</td>';
  808. tableBody +='<td class="align-middle">' + helpers.getPrintableDateTime(data.added) + '</td>';
  809. for(let i=0, all = data.statusPerFaucet.length; i < all; i++) {
  810. tableBody +='<td class="align-middle" title="Runned @' + helpers.getPrintableDateTime(data.statusPerFaucet[i].execTimeStamp) + '">' + helpers.getEmojiForPromoStatus(data.statusPerFaucet[i].status ?? 0) + '</td>';
  811. }
  812. tableBody +='</tr>';
  813. }
  814. $('#promo-table-body').html(tableBody);
  815. };
  816. function refresh(scheduleData, promotionData) {
  817. if (scheduleData) {
  818. loadScheduleTable(scheduleData);
  819. }
  820. if (promotionData) {
  821. loadPromotionTable(promotionData);
  822. }
  823. };
  824. function log(msg, elapsed = false) {
  825. if(msg) {
  826. let previous = logLines[0].split('&nbsp')[1];
  827. if(elapsed && (previous == msg)) {
  828. logLines[0] = helpers.getPrintableTime() + '&nbsp' + msg + '&nbsp[Elapsed time:&nbsp' + elapsed + '&nbspseconds]';
  829. } else {
  830. logLines.pop();
  831. logLines.unshift(helpers.getPrintableTime() + '&nbsp' + msg);
  832. }
  833. $('#console-log').html(logLines.join('<br>'));
  834. }
  835. };
  836. return {
  837. init: init,
  838. refresh: refresh,
  839. loadPromotionTable: loadPromotionTable,
  840. log: log
  841. }
  842. },
  843. createCFPromotions: function() {
  844. let codes = [];
  845. function PromotionCode(id, code, repeatDaily = false) {
  846. this.id = id;
  847. this.code = code;
  848. this.added = new Date();
  849. this.statusPerFaucet = [];
  850. this.repeatDaily = repeatDaily;
  851. this.lastExecTimeStamp = null;
  852. };
  853. function getFaucetStatusInPromo(promo, faucetId) {
  854. let faucet = promo.statusPerFaucet.find(x => x.id == faucetId);
  855. return faucet.status ?? PromoStatus.NOCODE;
  856. };
  857. function addNew(code) {
  858. let newPromo = new PromotionCode(codes.length, code);
  859. newPromo.statusPerFaucet = manager.getFaucetsForPromotion();
  860. newPromo.statusPerFaucet.forEach(function (element, idx, arr) {
  861. arr[idx].status = PromoStatus.PENDING;
  862. arr[idx].execTimeStamp = null;
  863. });
  864. codes.push(newPromo);
  865. codes.sort((a, b) => (a.id < b.id) ? 1 : -1);
  866. save();
  867. };
  868. function getAll() {
  869. return codes;
  870. };
  871. function updateFaucetForCode(code, faucetId, newStatus) {
  872. let promo = codes.find(x => x.code == code);
  873. let faucet = promo.statusPerFaucet.find(x => x.id == faucetId);
  874. if(faucet) {
  875. faucet.status = newStatus;
  876. faucet.execTimeStamp = new Date();
  877. promo.lastExecTimeStamp = faucet.execTimeStamp;
  878. }
  879. save();
  880. };
  881. function hasPromoAvailable(faucetId) {
  882. let resp = false;
  883. codes.forEach(function (promotion, idx, arr) {
  884. let status = getFaucetStatusInPromo(promotion, faucetId);
  885. if (status == PromoStatus.PENDING) {
  886. resp = promotion.code;
  887. return;
  888. }
  889. });
  890. return resp;
  891. };
  892. function save() {
  893. persistence.save('CFPromotions', getAll(), true);
  894. };
  895. function load(data) {
  896. codes = data;
  897. };
  898. function removeAll() {
  899. codes = [];
  900. save();
  901. };
  902. return {
  903. addNew: addNew,
  904. removeAll: removeAll,
  905. getAll: getAll,
  906. load: load,
  907. updateFaucetForCode: updateFaucetForCode,
  908. hasPromoAvailable: hasPromoAvailable
  909. }
  910. },
  911. createInteractions: function(){
  912. let randomInteractionLevel = RandomInteractionLevel.MEDIUM;
  913. let maxActions = 0;
  914. let performedActions = -1;
  915. let selectableElements;
  916. let actions = {
  917. available: [
  918. function() {
  919. $('html, body').animate({
  920. scrollTop: helpers.randomInt(0, $('html, body').get(0).scrollHeight)
  921. }, {
  922. complete: setTimeout(interactions.addPerformed, helpers.randomMs(100, 3000)),
  923. duration: helpers.randomMs(100, 1500)
  924. });
  925. },
  926. function() {
  927. let element = interactions.selectableElements[helpers.randomInt(0, interactions.selectableElements.length - 1)];
  928. try {
  929. if (document.body.createTextRange) {
  930. const range = document.body.createTextRange();
  931. range.moveToElementText(element);
  932. range.select();
  933. } else if (window.getSelection) {
  934. const selection = window.getSelection();
  935. const range = document.createRange();
  936. range.selectNodeContents(element);
  937. selection.removeAllRanges();
  938. selection.addRange(range);
  939. }
  940. } catch (err) { }
  941. interactions.addPerformed();
  942. }
  943. ]
  944. };
  945. function start(selectableElements) {
  946. performedActions = 0;
  947. switch(randomInteractionLevel) {
  948. case RandomInteractionLevel.NONE:
  949. maxActions = 0;
  950. break;
  951. case RandomInteractionLevel.LOW:
  952. maxActions = helpers.randomInt(2, 4);
  953. break;
  954. case RandomInteractionLevel.MEDIUM:
  955. maxActions = helpers.randomInt(5, 8);
  956. break;
  957. case RandomInteractionLevel.HIGH:
  958. maxActions = helpers.randomInt(12, 16);
  959. break;
  960. }
  961. interactions.selectableElements = selectableElements;
  962. performActions();
  963. }
  964. function performActions() {
  965. if(performedActions >= maxActions) {
  966. return;
  967. }
  968. let delay = 0;
  969. for(let i = 0; i < maxActions; i++) {
  970. delay += helpers.randomMs(350, 1500);
  971. setTimeout(actions.available[helpers.randomInt(0, actions.available.length - 1)], delay);
  972. }
  973. }
  974. function addPerformed() {
  975. performedActions++;
  976. }
  977. function completed() {
  978. return (performedActions >= maxActions);
  979. }
  980. return {
  981. start: start,
  982. completed: completed,
  983. addPerformed: addPerformed,
  984. selectableElements: selectableElements
  985. };
  986. },
  987. createSGProcessor: function() {
  988. let timerSpans;
  989. function run() {
  990. if(isLoading()) {
  991. setTimeout(SGProcessor.run, helpers.randomMs(5000, 10000));
  992. return;
  993. } else {
  994. if(isMinerActive()) {
  995. processRunDetails();
  996. } else {
  997. activateMiner();
  998. }
  999. }
  1000. };
  1001. function isLoading() {
  1002. return $('#loader-logo').length;
  1003. };
  1004. function isMinerActive() {
  1005. timerSpans = $('.mb-8 .wrapper .mb-1 span');
  1006. if(timerSpans.length > 0) {
  1007. return true;
  1008. } else {
  1009. return false;
  1010. }
  1011. return (timerSpans.length === 0);
  1012. };
  1013. function activateMiner() {
  1014. const activateButton = document.querySelector('.mb-8 .wrapper button');
  1015. if (activateButton) {
  1016. activateButton.click();
  1017. setTimeout(SGProcessor.processRunDetails, helpers.randomMs(10000, 20000));
  1018. } else {
  1019. if(!is404Error()) {
  1020. SGProcessor.processRunDetails()
  1021. }
  1022. }
  1023. };
  1024. function is404Error() {
  1025. const h1 = document.getElementsByTagName('h1');
  1026. if (h1.length > 0 && h1[0].innerText.includes('404')) {
  1027. window.location.reload();
  1028. return true;
  1029. }
  1030. return false;
  1031. }
  1032. function processRunDetails() {
  1033. let result = {};
  1034. result.nextRoll = helpers.addMinutes(new Date(), readCountdown().toString());
  1035. result.balance = readBalance();
  1036. shared.closeWindow(result);
  1037. };
  1038. function readCountdown() {
  1039. let mins = 15;
  1040. try {
  1041. let timeLeft = timerSpans.last().text().split(':');
  1042. if(timeLeft.length === 3) {
  1043. mins = parseInt(timeLeft[0]) * 60 + parseInt(timeLeft[1]);
  1044. }
  1045. } catch (err) { }
  1046. return mins;
  1047. };
  1048. function readBalance() {
  1049. let balance = "";
  1050. try {
  1051. balance = $('span.text-accent').first().text() + " BTC";
  1052. } catch (err) { }
  1053. return balance;
  1054. };
  1055. return {
  1056. run: run,
  1057. processRunDetails: processRunDetails
  1058. };
  1059. },
  1060. createCFProcessor: function() {
  1061. const NavigationProcess = {
  1062. ROLLING: 1,
  1063. PROCESSING_PROMOTION: 2,
  1064. LOGIN: 3
  1065. };
  1066. let navigationProcess;
  1067. let countdown;
  1068. let rollButton;
  1069. let promotionTag;
  1070. let timeWaiting= 0;
  1071. let loopingForErrors = false;
  1072. function run() {
  1073. navigationProcess = NavigationProcess.ROLLING;
  1074. displayStatusUi();
  1075. setTimeout(findCountdownOrRollButton, helpers.randomMs(2000, 5000));
  1076. };
  1077. function doLogin() {
  1078. navigationProcess = NavigationProcess.LOGIN;
  1079. displayStatusUi();
  1080. setTimeout(findLoginForm, helpers.randomMs(2000, 5000));
  1081. };
  1082. function isFullyLoaded() { //Waits 55 seconds max
  1083. if(document.readyState == 'complete' || timeWaiting == -1) {
  1084. $('#process-status')[0].innerHTML = 'Interacting';
  1085. timeWaiting = 0;
  1086. interact();
  1087. } else {
  1088. timeWaiting = -1;
  1089. $('#process-status')[0].innerHTML = 'Waiting for document fully loaded';
  1090. setTimeout(CFProcessor.isFullyLoaded, helpers.randomMs(45000, 55000));
  1091. }
  1092. };
  1093. function runPromotion() {
  1094. navigationProcess = NavigationProcess.PROCESSING_PROMOTION
  1095. displayStatusUi();
  1096. setTimeout(CFProcessor.findPromotionTag, helpers.randomMs(1000, 3000));
  1097. };
  1098. function findCountdownOrRollButton() {
  1099. if( isCountdownVisible() && !isRollButtonVisible() ) {
  1100. timeWaiting = 0;
  1101. processRunDetails();
  1102. } else if ( !isCountdownVisible() && isRollButtonVisible() ) {
  1103. timeWaiting = 0;
  1104. setTimeout(CFProcessor.isFullyLoaded, helpers.randomMs(1000, 5000));
  1105. } else {
  1106. if (timeWaiting/1000 > config.timeout * 60) {
  1107. shared.closeWithError('TIMEOUT', '');
  1108. return;
  1109. }
  1110. timeWaiting += 3000;
  1111. setTimeout(findCountdownOrRollButton, helpers.randomMs(2000, 5000));
  1112. }
  1113. };
  1114. function findLoginForm() {
  1115. if ( $('div.login-wrapper').is(':visible') ) {
  1116. //Other possible error is if recaptcha did not load yet... so maybe wait til the web is fully loaded for low connection issues
  1117. if( $('.login-wrapper .error').length > 0 && $('.login-wrapper .error')[0].innerHTML != '') {
  1118. let errorMessage = $('.login-wrapper .error').text();
  1119. shared.closeWithError('LOGIN_ERROR', errorMessage);
  1120. return;
  1121. }
  1122. if(!loopingForErrors) {
  1123. if(config.cf.credentials.mode == 1) {
  1124. timeWaiting = 0;
  1125. $('.login-wrapper input[name="email"]').val(config.cf.credentials.email);
  1126. $('.login-wrapper input[name="password"]').val(config.cf.credentials.password);
  1127. $('.login-wrapper button.login').click();
  1128. loopingForErrors = true;
  1129. } else {
  1130. if($('.login-wrapper input[name="email"]').val() != '' && $('.login-wrapper input[name="password"]').val() != '') {
  1131. $('.login-wrapper button.login').click();
  1132. $('#process-status')[0].innerHTML = 'Processing';
  1133. loopingForErrors = true;
  1134. } else {
  1135. $('#process-status')[0].innerHTML = 'Waiting for credentials...';
  1136. if (timeWaiting/1000 > (config.timeout / 1.5) * 60) {
  1137. shared.closeWithError('LOGIN_ERROR', 'No credentials were provided');
  1138. return;
  1139. }
  1140. }
  1141. }
  1142. }
  1143. }
  1144. if (timeWaiting/1000 > config.timeout * 60) {
  1145. shared.closeWithError('TIMEOUT', '');
  1146. return;
  1147. }
  1148. timeWaiting += 3000;
  1149. setTimeout(findLoginForm, helpers.randomMs(2000, 5000));
  1150. };
  1151. function interact() {
  1152. let selectables = []
  1153. selectables = selectables.concat($('td').toArray());
  1154. selectables = selectables.concat($('p').toArray());
  1155. selectables = selectables.concat($('th').toArray());
  1156. interactions.start(selectables);
  1157. setTimeout(CFProcessor.waitInteractions, helpers.randomMs(2000, 4000));
  1158. }
  1159. function waitInteractions() {
  1160. if(interactions.completed()) {
  1161. roll();
  1162. } else {
  1163. setTimeout(CFProcessor.waitInteractions, helpers.randomMs(2000, 4000));
  1164. }
  1165. }
  1166. function isCountdownVisible() {
  1167. countdown = $('.timeout-wrapper');
  1168. return ($(countdown).length > 0 && $(countdown[0]).is(':visible'));
  1169. };
  1170. function isRollButtonVisible() {
  1171. rollButton = $('.main-button-2.roll-button.bg-2');
  1172. return ($(rollButton).length > 0 && $(rollButton[0]).is(':visible'));
  1173. };
  1174. function roll() {
  1175. $('#process-status')[0].innerHTML = 'Roll triggered';
  1176. $(rollButton[0]).click();
  1177. setTimeout(findCountdownOrRollButton, helpers.randomMs(2000, 3000));
  1178. }
  1179. function isPromotionTagVisible() {
  1180. let pTags = $('p');
  1181. if (pTags.length > 0) {
  1182. promotionTag = $('p')[0];
  1183. return true;
  1184. }
  1185. return false;
  1186. };
  1187. function findPromotionTag() {
  1188. if( isPromotionTagVisible() ) {
  1189. processRunDetails();
  1190. } else {
  1191. setTimeout(CFProcessor.findPromotionTag, helpers.randomMs(2000, 5000));
  1192. }
  1193. };
  1194. function processRunDetails() {
  1195. let result = {};
  1196. if(navigationProcess == NavigationProcess.ROLLING) {
  1197. result.nextRoll = readCountdown();
  1198. result.claimed = readClaimed();
  1199. result.balance = readBalance();
  1200. if(result.claimed != 0) {
  1201. result.rolledNumber = readRolledNumber();
  1202. }
  1203. result.balance = readBalance();
  1204. } else if (navigationProcess == NavigationProcess.PROCESSING_PROMOTION) {
  1205. result.promoStatus = readPromoStatus();
  1206. result.promoCode = readPromoCode();
  1207. if (result.promoStatus == PromoStatus.ACCEPTED) {
  1208. result.nextRoll = helpers.addMinutes(new Date(), "-120");
  1209. }
  1210. }
  1211. shared.closeWindow(result);
  1212. };
  1213. function readCountdown() {
  1214. let minsElement = $('.timeout-container .minutes .digits');
  1215. let mins = "0";
  1216. if ($(minsElement).length > 0) {
  1217. mins = $(minsElement)[0].innerHTML;
  1218. }
  1219. if (mins) {
  1220. return helpers.addMinutes(new Date(), mins.toString());
  1221. } else {
  1222. return null;
  1223. }
  1224. };
  1225. function readClaimed() {
  1226. let claimed = 0;
  1227. try {
  1228. claimed = $('.result')[0].innerHTML;
  1229. claimed = claimed.trim();
  1230. claimed = claimed.slice(claimed.lastIndexOf(" ") + 1);
  1231. } catch(err) { }
  1232. return claimed;
  1233. };
  1234. function readRolledNumber() {
  1235. let number = 0;
  1236. try {
  1237. number = $('.lucky-number').toArray().map(x => x.innerText).join('');
  1238. number = parseInt(number);
  1239. } catch(err) { }
  1240. return number;
  1241. };
  1242. function readBalance() {
  1243. let balance = "";
  1244. try {
  1245. balance = $('.navbar-coins.bg-1 a').first().text();
  1246. } catch(err) { }
  1247. return balance;
  1248. };
  1249. function readPromoStatus() {
  1250. let promoStatus = PromoStatus.UNKNOWNERROR;
  1251. try {
  1252. if(promotionTag.innerHTML.indexOf(localeConfig.stringSearches.promoCodeAccepted) > 0) {
  1253. return PromoStatus.ACCEPTED;
  1254. } else if(promotionTag.innerHTML.indexOf(localeConfig.stringSearches.promoCodeUsed) > 0) {
  1255. return PromoStatus.USEDBEFORE;
  1256. } else if(promotionTag.innerHTML.indexOf(localeConfig.stringSearches.promoCodeInvalid) > 0) {
  1257. return PromoStatus.INVALID;
  1258. } else if(promotionTag.innerHTML.indexOf(localeConfig.stringSearches.promoCodeInvalid2) > 0) {
  1259. return PromoStatus.INVALID;
  1260. } else if(promotionTag.innerHTML.indexOf(localeConfig.stringSearches.promoCodeInvalid3) > 0) {
  1261. return PromoStatus.INVALID;
  1262. }
  1263. } catch ( err ) { }
  1264. return promoStatus;
  1265. };
  1266. function validatePromoString() {
  1267. };
  1268. function readPromoCode() {
  1269. var urlSplit = window.location.href.split('/');
  1270. return urlSplit[urlSplit.length - 1];
  1271. };
  1272. function displayStatusUi() {
  1273. $( 'body' ).prepend( '<div class="withdraw-button bg-2" style="top:30%; z-index:1500;" href="#">⚙️ <span id="process-status">Processing</span></div>' );
  1274. };
  1275. return {
  1276. run: run,
  1277. runPromotion: runPromotion,
  1278. findPromotionTag: findPromotionTag,
  1279. waitInteractions: waitInteractions,
  1280. isFullyLoaded: isFullyLoaded,
  1281. doLogin: doLogin
  1282. };
  1283. },
  1284. createCFHistory: function() {
  1285. let rollsMeta = [
  1286. { id: 0, range: '0000-9885', count: 0 },
  1287. { id: 1, range: '9886-9985', count: 0 },
  1288. { id: 2, range: '9986-9993', count: 0 },
  1289. { id: 3, range: '9994-9997', count: 0 },
  1290. { id: 4, range: '9998-9999', count: 0 },
  1291. { id: 5, range: '10000', count: 0 }
  1292. ];
  1293. function initOrLoad() {
  1294. let storedData = persistence.load('CFHistory', true);
  1295. if(storedData) {
  1296. rollsMeta = storedData;
  1297. }
  1298. };
  1299. function addRoll(number) {
  1300. switch(true) {
  1301. case (number <= 9885):
  1302. rollsMeta[0].count++;
  1303. break;
  1304. case (number <= 9985):
  1305. rollsMeta[1].count++;
  1306. break;
  1307. case (number <= 9993):
  1308. rollsMeta[2].count++;
  1309. break;
  1310. case (number <= 9997):
  1311. rollsMeta[3].count++;
  1312. break;
  1313. case (number <= 9999):
  1314. rollsMeta[4].count++;
  1315. break;
  1316. case (number == 10000):
  1317. rollsMeta[5].count++;
  1318. break;
  1319. default:
  1320. break;
  1321. }
  1322. save();
  1323. };
  1324. function getRollsMeta() {
  1325. return rollsMeta.map(x => x.count);
  1326. };
  1327. function save() {
  1328. persistence.save('CFHistory', rollsMeta, true);
  1329. };
  1330. return {
  1331. initOrLoad: initOrLoad,
  1332. addRoll: addRoll,
  1333. getRollsMeta: getRollsMeta
  1334. }
  1335. },
  1336. createFBProcessor: function() {
  1337. let timeWaiting= 0;
  1338. let countdownMinutes;
  1339. function run() {
  1340. setTimeout(findCountdownOrRollButton, helpers.randomMs(12000, 15000));
  1341. };
  1342. function findCountdownOrRollButton() {
  1343. if ( isCountdownVisible() ) {
  1344. timeWaiting = 0;
  1345. countdownMinutes = +document.querySelectorAll('.free_play_time_remaining.hasCountdown .countdown_amount')[0].innerHTML + 1;
  1346. let result = {};
  1347. result.balance = readBalance();
  1348. result.nextRoll = helpers.addMinutes(new Date(), countdownMinutes.toString());
  1349. shared.closeWindow(result);
  1350. return;
  1351. }
  1352. if ( isRollButtonVisible() ) {
  1353. if (config.fb.activateRPBonus) {
  1354. if (!document.getElementById('bonus_container_free_points')) {
  1355. document.querySelector('a.rewards_link').click();
  1356. activateBonus(0);
  1357. }
  1358. }
  1359. if (isHCaptchaVisible()) {
  1360. waitForCaptcha();
  1361. } else {
  1362. clickRoll();
  1363. }
  1364. }
  1365. };
  1366. function isCountdownVisible() {
  1367. return document.querySelectorAll('.free_play_time_remaining.hasCountdown .countdown_amount').length > 0;
  1368. };
  1369. function isHCaptchaVisible() {
  1370. let hCaptchaFrame = document.querySelector('.h-captcha > iframe');
  1371. if (hCaptchaFrame && $(hCaptchaFrame).is(':visible')) {
  1372. return true;
  1373. }
  1374. return false;
  1375. };
  1376. function isRollButtonVisible() {
  1377. return $(document.getElementById('free_play_form_button')).is(':visible');
  1378. };
  1379. function waitForCaptcha() {
  1380. if ( document.querySelector('.h-captcha > iframe').getAttribute('data-hcaptcha-response').length > 0) {
  1381. clickRoll();
  1382. } else {
  1383. if (timeWaiting/1000 > config.timeout * 60) {
  1384. shared.closeWithError('TIMEOUT', '');
  1385. return;
  1386. }
  1387. timeWaiting += 10000;
  1388. setTimeout(waitForCaptcha, helpers.randomMs(10000, 12000));
  1389. }
  1390. };
  1391. function clickRoll() {
  1392. try {
  1393. document.getElementById('free_play_form_button').click();
  1394. setTimeout(processRunDetails, helpers.randomMs(3000, 10000));
  1395. } catch (err) {
  1396. shared.closeWithError('CLICK_ROLL_ERROR', err);
  1397. }
  1398. };
  1399. function processRunDetails() {
  1400. if ($(document.getElementById('winnings')).is(':visible')) {
  1401. closePopup();
  1402. let result = {};
  1403. result.claimed = readClaimed();
  1404. result.balance = readBalance();
  1405. if(result.claimed != 0) {
  1406. result.rolledNumber = readRolledNumber();
  1407. result.nextRoll = helpers.addMinutes(new Date(), "60");
  1408. }
  1409. shared.closeWindow(result);
  1410. return;
  1411. }
  1412. if ($(document.getElementById('same_ip_error')).is(':visible')) {
  1413. shared.closeWithError('ROLL_ERROR', document.getElementById('same_ip_error').innerHTML);
  1414. return;
  1415. }
  1416. if($('#free_play_error').is(':visible')) {
  1417. shared.closeWithError('ROLL_ERROR', $('.free_play_error')[0].innerHTML);
  1418. return;
  1419. }
  1420. if ($('.free_play_result_error').is(':visible')) {
  1421. shared.closeWithError('ROLL_ERROR', $('.free_play_result_error')[0].innerHTML);
  1422. return;
  1423. }
  1424. if (timeWaiting/1000 > config.timeout * 60) {
  1425. shared.closeWithError('TIMEOUT', '');
  1426. return;
  1427. }
  1428. timeWaiting += 5000;
  1429. setTimeout(processRunDetails, helpers.randomMs(5000, 6000));
  1430. };
  1431. function closePopup() {
  1432. let closePopupBtn = document.querySelector('.reveal-modal.open .close-reveal-modal');
  1433. if (closePopupBtn) {
  1434. closePopupBtn.click();
  1435. }
  1436. };
  1437. function readRolledNumber() {
  1438. let rolled = 0;
  1439. try {
  1440. rolled = parseInt([... document.querySelectorAll('#free_play_digits span')].map( x => x.innerHTML).join(''));
  1441. } catch { }
  1442. return rolled;
  1443. };
  1444. function readBalance() {
  1445. let balance = 0;
  1446. try {
  1447. balance = document.getElementById('balance').innerHTML;
  1448. } catch { }
  1449. return balance;
  1450. };
  1451. function readClaimed() {
  1452. let claimed = 0;
  1453. try {
  1454. claimed = document.getElementById('winnings').innerHTML;
  1455. } catch { }
  1456. return claimed;
  1457. };
  1458. function activateBonus(i) {
  1459. if($(document.querySelector('#reward_point_redeem_result_container_div .reward_point_redeem_result_error')).is(':visible')) {
  1460. let closeBtn = document.querySelector('#reward_point_redeem_result_container_div .reward_point_redeem_result_box_close')
  1461. if ($(closeBtn).is(':visible')) {
  1462. closeBtn.click();
  1463. }
  1464. } else if ($(document.querySelector('#reward_point_redeem_result_container_div .reward_point_redeem_result_success')).is(':visible')) {
  1465. let closeBtn = document.querySelector('#reward_point_redeem_result_container_div .reward_point_redeem_result_box_close')
  1466. if ($(closeBtn).is(':visible')) {
  1467. closeBtn.click();
  1468. document.querySelector('#free_play_link_li a');
  1469. setTimeout(findCountdownOrRollButton, helpers.randomMs(10000, 12000));
  1470. return;
  1471. }
  1472. }
  1473. try {
  1474. let redeemButtons = document.querySelectorAll('#free_points_rewards button');
  1475. redeemButtons[i].click();
  1476. i = i + 1;
  1477. } catch (err) {
  1478. }
  1479. if(i > 4) {
  1480. document.querySelector('#free_play_link_li a');
  1481. setTimeout(findCountdownOrRollButton, helpers.randomMs(10000, 12000));
  1482. return;
  1483. }
  1484. setTimeout(activateBonus.bind(null, i), 5000);
  1485. };
  1486. return {
  1487. run: run
  1488. };
  1489. }
  1490. };
  1491. /**
  1492. * Prevents alert popups to be able to reload the faucet if invisible captcha validation fails
  1493. */
  1494. function overrideSelectNativeJS_Functions () {
  1495. window.alert = function alert (message) {
  1496. console.log (message);
  1497. }
  1498. }
  1499. function addJS_Node (text, s_URL, funcToRun) {
  1500. var scriptNode= document.createElement ('script');
  1501. scriptNode.type= "text/javascript";
  1502. if (text)scriptNode.textContent= text;
  1503. if (s_URL)scriptNode.src= s_URL;
  1504. if (funcToRun)scriptNode.textContent = '(' + funcToRun.toString() + ')()';
  1505. var element = document.getElementsByTagName ('head')[0] || document.body || document.documentElement;
  1506. element.appendChild (scriptNode);
  1507. }
  1508. function detectWeb() {
  1509. // Now detecting based on host to handle automatic redirects (for example: login request)
  1510. if(!shared.isOpenedByManager(window.location.host)) {
  1511. return;
  1512. }
  1513. let currentFromManager = shared.getCurrent();
  1514. if (currentFromManager.type == WebType.STORMGAIN) {
  1515. SGProcessor = objectGenerator.createSGProcessor();
  1516. setTimeout(SGProcessor.run, helpers.randomMs(10000, 20000));
  1517. return;
  1518. }
  1519. if (currentFromManager.type == WebType.CRYPTOSFAUCETS) {
  1520. let expectedCfUrlType = helpers.cf.getUrlType(currentFromManager.url);
  1521. let realCfUrlType = helpers.cf.getUrlType(window.location.href);
  1522. switch(expectedCfUrlType) {
  1523. case CFUrlType.FREE:
  1524. switch(realCfUrlType) {
  1525. case CFUrlType.FREE:
  1526. if(localeConfig.setToEnglish) {
  1527. let refValue = $('.nav-item a')[4].innerHTML;
  1528. if (refValue != 'Settings') {
  1529. window.location.href = '/set-language/en';
  1530. }
  1531. }
  1532. addJS_Node (null, null, overrideSelectNativeJS_Functions);
  1533. CFProcessor = objectGenerator.createCFProcessor();
  1534. interactions = objectGenerator.createInteractions();
  1535. setTimeout(CFProcessor.run, helpers.randomMs(1000, 3000));
  1536. break;
  1537. case CFUrlType.CONTACTTWITTER:
  1538. //TODO: mark as possibly banned
  1539. break;
  1540. case CFUrlType.HOME:
  1541. if (config.cf.autologin) {
  1542. addJS_Node (null, null, overrideSelectNativeJS_Functions);
  1543. CFProcessor = objectGenerator.createCFProcessor();
  1544. setTimeout(CFProcessor.doLogin, helpers.randomMs(1000, 3000));
  1545. } else {
  1546. shared.closeWithError('NEED_TO_LOGIN', '');
  1547. }
  1548. break;
  1549. default:
  1550. break;
  1551. }
  1552. break;
  1553. case CFUrlType.PROMOTION:
  1554. CFProcessor = objectGenerator.createCFProcessor();
  1555. interactions = objectGenerator.createInteractions();
  1556. setTimeout(CFProcessor.runPromotion, helpers.randomMs(5000, 10000));
  1557. break;
  1558. }
  1559. return;
  1560. }
  1561. if (currentFromManager.type == WebType.FREEBITCOIN) {
  1562. FBProcessor = objectGenerator.createFBProcessor();
  1563. setTimeout(FBProcessor.run, helpers.randomMs(2000, 5000));
  1564. return;
  1565. }
  1566. }
  1567. function init() {
  1568. shared = objectGenerator.createShared();
  1569. persistence = objectGenerator.createPersistence();
  1570. if(window.location.host === 'satology.onrender.com') {
  1571. manager = objectGenerator.createManager();
  1572. CFPromotions = objectGenerator.createCFPromotions();
  1573. ui = objectGenerator.createUi();
  1574. CFHistory = objectGenerator.createCFHistory();
  1575. manager.init();
  1576. } else {
  1577. detectWeb();
  1578. }
  1579. }
  1580. init();
  1581. })();

comments powered by Disqus