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: 80.1 kB

HITS: 1223

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

comments powered by Disqus