Crypto Faucet Rotator
// ==UserScript==
// @name Hourly Faucets Crypto Rotator
// @namespace Hourly Faucets Crypto Rotator
// @version 0.5
// @description Auto Login Hourly Faucet Rotator
// @author engageub
// @match https://coinfaucet.io/*
// @match https://freecardano.com/*
// @match https://freenem.com/*
// @match https://freebitcoin.io/*
// @match https://freesteam.io/*
// @match https://freetether.com/*
// @match https://freeusdcoin.com/*
// @match https://freebinancecoin.com/*
// @match https://free-tron.com/*
// @match https://freeethereum.com/*
// @match https://freedash.io/*
// @match https://freeneo.io/*
// @match https://free-doge.com/*
// @match https://free-ltc.com/*
// @match https://freechainlink.io/*
// @match https://freeshibainu.com/*
// @match https://www.free-litecoin.com/*
// @match https://www.free-ethereum.io/*
// @match https://free-litecoin.com/*
// @match https://free-ethereum.io/*
// @match https://litking.biz/*
// @match https://bitking.biz/*
// @match https://freebitco.in/*
// @match https://snowusd.com/*
// @match https://www.flashfaucet.com/*
// @match https://darkusd.com/*
// @match https://grab.tc/*
// @match https://gramfree.cc/*
// @match https://gramfree.today/*
// @connect gramfree.cc
// @connect gramfree.today
// @connect coinfaucet.io
// @connect freecardano.com
// @connect freenem.com
// @connect freebitcoin.io
// @connect freesteam.io
// @connect freetether.com
// @connect freeusdcoin.com
// @connect freebinancecoin.com
// @connect free-tron.com
// @connect freeethereum.com
// @connect freedash.io
// @connect freeneo.io
// @connect free-doge.com
// @connect free-ltc.com
// @connect freechainlink.io
// @connect freeshibainu.com
// @connect free-litecoin.com
// @connect free-ethereum.io
// @connect litking.biz
// @connect bitking.biz
// @connect freebitco.in
// @connect snowusd.com
// @connect www.flashfaucet.com
// @connect darkusd.com
// @connect grab.tc
// @noframes
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
//Do not run if it is a pop up window
if(window.name){
return;
}
//==========================================================================================================================
//List of the faucet websites
//Comment the lines of url if you don't use them
//Enter your login and password if you wish you login automatically
//You need to be careful while inputting the login and password in order to avoid account locks
var websiteData = [
{url : "https://coinfaucet.io", login: "", password: ""}, // Ex: login: "test@gmail.com", password: "test@123"
{url : "https://freecardano.com", login: "", password: ""},
{url : "https://freenem.com", login: "", password: ""},
{url : "https://freebitcoin.io", login: "", password: ""},
{url : "https://freesteam.io", login: "", password: ""},
{url : "https://freetether.com", login: "", password: ""},
{url : "https://freeusdcoin.com", login: "", password: ""},
{url : "https://freebinancecoin.com", login: "", password: ""},
{url : "https://free-tron.com", login: "", password: ""},
{url : "https://freeethereum.com", login: "", password: ""},
{url : "https://freedash.io", login: "", password: ""},
{url : "https://freeneo.io", login: "", password: ""},
{url : "https://free-doge.com", login: "", password: ""},
{url : "https://free-ltc.com", login: "", password: ""},
{url : "https://freechainlink.io", login: "", password: ""},
{url : "https://freeshibainu.com", login: "", password: ""},
{url : "https://www.free-litecoin.com", login: "", password: ""},
{url : "https://www.free-ethereum.io", login: "", password: ""},
{url : "https://litking.biz", login: "", password: ""},
{url : "https://bitking.biz", login: "", password: ""},
{url : "https://freebitco.in", login: "", password: ""},
{url : "https://snowusd.com/faucet", login: "", password: ""},
{url : "https://www.flashfaucet.com/faucet", login: "", password: ""},
{url : "https://darkusd.com/faucet", login: "", password: ""},
{url : "https://grab.tc", login: "", password: ""},
{url : "https://gramfree.today/free", login: "", password: ""},
];
//==========================================================================================================================
//Message selectors are for success or failure to move on to the next website
//Add only domain name in website as mentioned below. Follow the same pattern.
//Use arrays wherever it is required
//Login Selectors are in the format email,password and button
var websiteMap = [
{website : ["coinfaucet.io","freecardano.com", "freenem.com", "freebitcoin.io", "freesteam.io", "freetether.com",
"freeusdcoin.com", "freebinancecoin.com", "free-tron.com", "freeethereum.com", "freedash.io", "freeneo.io",
"free-doge.com", "free-ltc.com", "freechainlink.io", "freeshibainu.com"],
defaultButtonSelectors: [".main-button-2.roll-button.bg-2"],
loginSelectors:[".form-control.email",".form-control.password",".main-button.main-button-yellow.login.bg-3"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: [".timeout-wrapper .seconds .digits", ".timeout-wrapper .minutes .digits"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received", "countdown to next roll"]},
{website : ["free-litecoin.com","free-ethereum.io"],
loginSelectors:["#loginform .form-control[type=email]","#loginform .form-control[type=password]","#loginbutton"],
loginCaptcha : true,
captchaButtonSubmitSelectors: ["#loginbutton","#roll",".btn.btn-success"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: ["#cislo1","#cislo2"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"]},
{website : ["litking.biz","bitking.biz"],
loginSelectors:["#inputEmail","#inputPassword","#login_button"],
loginCaptcha : true,
captchaButtonSubmitSelectors: ["#login_button",".btn.btn-info:last-of-type"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result", "#modal_header_msg"],
timeoutMessageSelectors: ["#cislo1","#cislo2"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"]},
{website : ["freebitco.in"],
loginSelectors:["#login_form_btc_address","#login_form_password","#login_button"],
captchaButtonSubmitSelectors: ["#free_play_form_button"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: ["#time_remaining"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"]},
{website : ["snowusd.com", "flashfaucet.com", "darkusd.com"],
defaultButtonSelectors: ["a[href='login']"],
loginSelectors:["input[type=text]","input[type=password]","input[type=submit]"],
captchaButtonSubmitSelectors: [".btn.btn-primary"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger", "#newClaim"],
timeoutMessageSelectors: ["#time_remaining"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","You have won","You have received"],
additionalFunctions: usdFaucets},
{website : ["grab.tc"],
beforeLoginButton: ["#navbarsExampleDefault > ul.nav.navbar-nav.navbar-right > li:nth-child(3) > a"],
loginSelectors: ["input[type=text]", "input[type=password]", "button[type=submit]"],
loginCaptcha : true,
defaultButtonSelectors: [],
toggleCaptchaSelector:[".form-control.form-control-sm.custom-select.mb-1"],
toggleCaptchaSelectorIndex: 1,
captchaButtonSubmitSelectors: ["button[type=submit]","button[type=button]", ".btn.btn-danger.btn-md.w-100.mt-2",".btn.btn-primary.btn-block.btn-lg"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger"],
messagesToCheckBeforeMovingToNextUrl: ["can claim again","you won"],
timeoutbeforeMovingToNextUrl: 160000},
{website : ["gramfree.today"],
defaultButtonSelectors:["#roll-button"],
allMessageSelectors: [".alert.alert-success",".alert.alert-danger",".result"],
timeoutMessageSelectors: ["#time_remaining"],
messagesToCheckBeforeMovingToNextUrl: ["You must to wait","has been sent","You have received"],
timeoutbeforeMovingToNextUrl: 16000},
];
//HtmlEvents dispatcher
function triggerEvent(el, type) {
try{
var e = document.createEvent('HTMLEvents');
e.initEvent(type, false, true);
el.dispatchEvent(e);
}catch(exception){
console.log(exception);
}
}
function toggleCaptcha(selector, index){
if( document.querySelector(selector)){
document.querySelector(selector).selectedIndex = index;
}
var targetNode = document.querySelector(selector);
if (targetNode) {
setTimeout(function() {
triggerEvent(targetNode, 'change');
}, 5000);
}
}
//Check if a string is present in Array
String.prototype.includesOneOf = function(arrayOfStrings) {
//If this is not an Array, compare it as a String
if (!Array.isArray(arrayOfStrings)) {
return this.toLowerCase().includes(arrayOfStrings.toLowerCase());
}
for (var i = 0; i < arrayOfStrings.length; i++) {
if (this.toLowerCase().includes(arrayOfStrings[i].toLowerCase())) {
return true;
}
}
return false;
}
var websiteDataValues = {};
//Get selector details from the websiteMap
for (let value of Object.values(websiteMap)) {
if(window.location.href.includesOneOf(value.website)){
websiteDataValues.beforeLoginButton = value.beforeLoginButton;
websiteDataValues.inputTextSelector= value.inputTextSelector;
websiteDataValues.inputTextSelectorButton = value.inputTextSelectorButton;
websiteDataValues.defaultButtonSelectors = value.defaultButtonSelectors;
websiteDataValues.claimButtonSelector = value.claimButtonSelector;
websiteDataValues.captchaButtonSubmitSelectors = value.captchaButtonSubmitSelectors;
websiteDataValues.loginSelectors = value.loginSelectors;
websiteDataValues.loginCaptcha = value.loginCaptcha;
websiteDataValues.allMessageSelectors = value.allMessageSelectors;
websiteDataValues.messagesToCheckBeforeMovingToNextUrl = value.messagesToCheckBeforeMovingToNextUrl;
websiteDataValues.withdrawPageUrl = value.withdrawPageUrl;
websiteDataValues.withdrawEnabled = value.withdrawEnabled;
websiteDataValues.balanceSelector = value.balanceSelector;
websiteDataValues.withdrawMinAmount = value.withdrawMinAmount;
websiteDataValues.successMessageSelectors = value.successMessageSelectors;
websiteDataValues.toggleCaptchaSelector = value.toggleCaptchaSelector;
websiteDataValues.toggleCaptchaSelectorIndex = value.toggleCaptchaSelectorIndex;
websiteDataValues.timeoutbeforeMovingToNextUrl = value.timeoutbeforeMovingToNextUrl;
websiteDataValues.timeoutMessageSelectors = value.timeoutMessageSelectors;
websiteDataValues.additionalFunctions = value.additionalFunctions;
break;
}
}
//Identify which coin to input, based on the url input
//If the URL does not contain the coin, then use the default from the domain name
var count = 0;
var addressAssigned = false;
for (let value of Object.values(websiteData)) {
count = count + 1;
if(window.location.href.includes("/" + value.regex)){
addressAssigned = true;
break;
}
}
var login = "";
var password = "";
//If URL does not have coin, check the default from the domain name
if(!addressAssigned){
count = 0;
for (let value of Object.values(websiteData)) {
count = count + 1;
if(value.url.includes(window.location.hostname)){
login = value.login;
password = value.password;
break;
}
}
}
//Get the next Url from the website data map
async function getNextUrl(){
//Go to the beginning if the end of the array is reached
if(count >= websiteData.length){
websiteDataValues.nextUrl = websiteData[0].url;
}else{
websiteDataValues.nextUrl = websiteData[count].url;
}
//Ping Test to check if a website is up before proceeding to next url
pingTest(websiteDataValues.nextUrl);
}
var isNextUrlReachable = false;
//Get the next Url from the website
function pingTest(websiteUrl) {
GM_xmlhttpRequest({
method: "GET",
url: websiteUrl,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
timeout: 5000,
onload: function(response) {
//Website is reachable
isNextUrlReachable = true;
},
onerror: function(e) {
count=count+1;
getNextUrl();
},
ontimeout: function() {
count=count+1;
getNextUrl();
},
});
}
async function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
var movingToNextUrl = false;
async function goToNextUrl() {
if(!movingToNextUrl){
movingToNextUrl = true;
getNextUrl();
while (!isNextUrlReachable) {
await delay(3000);
}
window.location.href = websiteDataValues.nextUrl;
}
}
async function goToWithdrawPage() {
if(!movingToNextUrl){
movingToNextUrl = true;
window.location.href = websiteDataValues.withdrawPageUrl;
}
}
//Default Setting: After 120 seconds go to next Url
var delayBeforeMovingToNextUrl = 120000;
if(websiteDataValues.timeoutbeforeMovingToNextUrl){
delayBeforeMovingToNextUrl = websiteDataValues.timeoutbeforeMovingToNextUrl;
}
setTimeout(function(){
goToNextUrl();
},delayBeforeMovingToNextUrl);
function checkTimeoutMessageSelectors(){
if(websiteDataValues.timeoutMessageSelectors){
var checkTimeoutInterval = setInterval(function(){
for(let i=0; i< websiteDataValues.timeoutMessageSelectors.length; i++){
if(document.querySelector(websiteDataValues.timeoutMessageSelectors[i]) &&
document.querySelector(websiteDataValues.timeoutMessageSelectors[i]).innerText.length > 1) {
goToNextUrl();
clearInterval(checkTimeoutInterval);
break;
}
}
},5000);
}
}
//Returns true if message selectors are present
function messageSelectorsPresent(){
if(websiteDataValues.allMessageSelectors){
for(var j=0;j 0 && password.length > 0){
//Input Login
document.querySelector(websiteDataValues.loginSelectors[0]).value = login;
//Input Password
document.querySelector(websiteDataValues.loginSelectors[1]).value = password;
//Click Login Button (No Captcha before login button)
if(!websiteDataValues.loginCaptcha){
movingToNextUrl = true;
document.querySelector(websiteDataValues.loginSelectors[2]).click();
}
}
}
}
}
//Special Usecase for Recaptcha Login
var callbackDefinedForRecaptcha = false;
for(let i=0; i< document.querySelectorAll(".g-recaptcha").length;i++){
if(document.querySelectorAll(".g-recaptcha")[i].getAttribute("data-callback")){
var currentCallback = document.querySelectorAll(".g-recaptcha")[i].getAttribute("data-callback");
let script_callback= document.createElement('script');
script_callback.type= 'text/javascript';
script_callback.innerText = 'var recaptcha_callback' + i + ' = function(response){currentCallback(response); document.querySelector(".g-recaptcha").setAttribute("value",response)}';
let body = document.getElementsByTagName('body')[0];
body.appendChild(script_callback);
document.querySelectorAll(".g-recaptcha")[i].setAttribute("data-callback","recaptcha_callback"+i);
}else{
if(!callbackDefinedForRecaptcha){
callbackDefinedForRecaptcha = true;
let script_callback= document.createElement('script');
script_callback.type= 'text/javascript';
script_callback.innerText = 'var recaptcha_callback = function(response){ document.querySelector(".g-recaptcha").setAttribute("value",response)}';
let body = document.getElementsByTagName('body')[0];
body.appendChild(script_callback);
}
document.querySelectorAll(".g-recaptcha")[i].setAttribute("data-callback","recaptcha_callback");
}
}
checkTimeoutMessageSelectors();
function usdFaucets(){
if(window.location.href.includes("dashboard")){
if(document.querySelector("a[href='faucet']")){
movingToNextUrl = true;
document.querySelector("a[href='faucet']").click();
}
}
}
setTimeout(function(){
if(!movingToNextUrl && websiteDataValues.beforeLoginButton){
for(let i=0;i websiteDataValues.withdrawMinAmount && !window.location.href.includes(websiteDataValues.withdrawPageUrl)) {
goToWithdrawPage();
}
}else{
if(successMessageSelectorsPresent()){
goToWithdrawPage();
}
}
}
//Look for all the default messages or errors before proceeding to next url
//For other languages difference in the length of the strings can be compared or visibility of the style element
if(!movingToNextUrl && messageSelectorsPresent()){
goToNextUrl();
}
//Check for all the default button selectors and click
//This will only click the first selector found, so mention the selectors with parent element wherever required
if(!movingToNextUrl && websiteDataValues.defaultButtonSelectors){
for(let i=0;i 0 || document.querySelector(".g-recaptcha").getAttribute("value").length > 0){
if(websiteDataValues.captchaButtonSubmitSelectors){
for(let i=0;i< websiteDataValues.captchaButtonSubmitSelectors.length;i++){
if(document.querySelector(websiteDataValues.captchaButtonSubmitSelectors[i])){
document.querySelector(websiteDataValues.captchaButtonSubmitSelectors[i]).click();
}
}
}
clicked = true;
clearInterval(captchaInterval);
setTimeout(function(){
if(messageSelectorsPresent()){
goToNextUrl();
}
},5000);
}
}catch(e){
}
for(var hc=0; hc < document.querySelectorAll("iframe").length; hc++){
if(! clicked && document.querySelectorAll("iframe")[hc] &&
document.querySelectorAll("iframe")[hc].getAttribute("data-hcaptcha-response") &&
document.querySelectorAll("iframe")[hc].getAttribute("data-hcaptcha-response").length > 0) {
if(websiteDataValues.captchaButtonSubmitSelectors){
for(let i=0;i< websiteDataValues.captchaButtonSubmitSelectors.length;i++){
if(document.querySelector(websiteDataValues.captchaButtonSubmitSelectors[i])){
document.querySelector(websiteDataValues.captchaButtonSubmitSelectors[i]).click();
}
}
}
clicked = true;
clearInterval(captchaInterval);
setTimeout(function(){
if(messageSelectorsPresent()){
goToNextUrl();
}
},5000);
}
}
},5000);
},7000);
})();