Automatically login and click faucet
当前为
// ==UserScript==
// @name New altcryp.com auto faucet
// @namespace bekerja pada tampermonkey maupun violentmonkey
// @version 0.1
// @description Automatically login and click faucet
// @grant unsafeWindow
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @grant window.onurlchange
// @grant GM_registerMenuCommand
// @require https://update.greasyfork.org/scripts/439099/1203718/MonkeyConfig%20Modern%20Reloaded.js
// @match https://altcryp.com/*
// @license Copyright OjoNgono
// ==/UserScript==
const cfg = new MonkeyConfig({
title: 'Input Email Faucetpay:',
menuCommand: true,
params: {
Email: {
label: "Email Faucetpay",
type: "text",
default: ''
},
}
});
(function() {
'use strict';
window.addEventListener('load', () => {
const email = cfg.get('Email');
console.log('Email retrieved from configuration:', email);
if (!email || email.trim() === '') {
enforceLogoutWithWarning();
} else {
enforceReferralUrl();
setTimeout(() => {
clickLoginRegisterButton();
}, 1000);
const loginInterval = setInterval(() => {
handleLoginPopup();
}, 1000);
setTimeout(() => {
clearInterval(loginInterval);
if (document.querySelector("#logoutModal")) {
// Jika sudah login, lanjutkan dengan rotasi URL dan klaim faucet
rotateUrls();
checkTurnstileAndClick();
}
}, 1000);
}
});
function enforceReferralUrl() {
if (window.location.href === "https://altcryp.com" && !window.location.href.includes("?r=25368")) {
const loggedIn = document.querySelector("#logoutModal");
if (!loggedIn) {
window.location.replace("https://altcryp.com/?r=25368");
}
}
}
function enforceLogoutWithWarning() {
const loggedIn = document.querySelector("#logoutModal");
if (loggedIn) {
alert('Please enter your email in the settings menu before using my script.');
const logoutButton = document.querySelector('a[href="https://altcryp.com/auth/logout"]');
if (logoutButton) {
logoutButton.click();
} else {
window.location.replace("https://altcryp.com/auth/logout");
}
}
}
function clickLoginRegisterButton() {
const loginButton = document.querySelector('span.mb-0');
if (loginButton && loginButton.textContent.includes('Login / Register')) {
console.log('Clicking Login / Register button');
loginButton.click();
}
}
function handleLoginPopup() {
const modalTitle = document.querySelector('.modal-title');
if (modalTitle && modalTitle.textContent.includes('Login')) {
const emailInput = document.querySelector('#InputEmail');
if (emailInput) {
emailInput.value = cfg.get('Email');
console.log('Email filled:', emailInput.value);
}
const loginButton = document.querySelector('button[type="submit"].d-flex.align-items-center.btn.btn-outline.border.text-secondary');
const captchaResponse = document.querySelector('textarea[name="g-recaptcha-response"]');
const checkCaptchaAndLogin = setInterval(() => {
const captchaResponse = document.querySelector('textarea[name="g-recaptcha-response"]');
if (captchaResponse && captchaResponse.value.trim().length > 0) {
console.log('reCAPTCHA completed, clicking Login button');
loginButton.click();
clearInterval(checkCaptchaAndLogin);
} else {
console.log('Waiting for reCAPTCHA to complete...');
}
}, 1000);
}
}
// Daftar URL faucet yang akan dirotasi
const urls = [
"https://altcryp.com/faucet/currency/ltc",
"https://altcryp.com/faucet/currency/usdt",
"https://altcryp.com/faucet/currency/bnb",
"https://altcryp.com/faucet/currency/bch",
"https://altcryp.com/faucet/currency/dash",
"https://altcryp.com/faucet/currency/doge",
"https://altcryp.com/faucet/currency/dgb",
"https://altcryp.com/faucet/currency/matic",
"https://altcryp.com/faucet/currency/sol",
"https://altcryp.com/faucet/currency/trx",
"https://altcryp.com/faucet/currency/xrp",
"https://altcryp.com/faucet/currency/zec",
"https://altcryp.com/faucet/currency/pepe",
"https://altcryp.com/faucet/currency/shib",
"https://altcryp.com/faucet/currency/ton"
];
let currentIndex = parseInt(localStorage.getItem('currentIndex')) || 0;
const rotateUrls = () => {
if (window.location.href === "https://altcryp.com/") {
window.location.href = urls[currentIndex];
currentIndex = (currentIndex + 1) % urls.length;
localStorage.setItem('currentIndex', currentIndex);
}
};
const scrollToButton = () => {
const submitButton = document.querySelector(".btn.btn-primary");
if (submitButton) {
submitButton.scrollIntoView({
behavior: 'smooth',
block: 'center'
});
}
};
// Function to check if the Turnstile validation has completed
function checkTurnstile() {
let turnstileResponse = document.querySelector('input[name="cf-turnstile-response"]');
return turnstileResponse && turnstileResponse.value !== '';
}
// Function to click the "Claim Now" button
function clickClaimNow() {
let claimNowButton = document.querySelector('#subbutt');
if (claimNowButton && claimNowButton.innerText.includes('Claim Now')) {
claimNowButton.click();
}
}
// Function to click the "Unlock" button
function clickUnlock() {
let unlockButton = document.querySelector('button.btn.btn-primary.w-md');
if (unlockButton && unlockButton.innerText.includes('Unlock')) {
unlockButton.click();
}
}
// Monitor the Turnstile response and click the buttons when ready
let intervalId = setInterval(function() {
if (checkTurnstile()) {
clickClaimNow();
clickUnlock();
clearInterval(intervalId); // Stop the interval once the buttons are clicked
}
}, 1000); // Check every second
// Fungsi untuk cek pesan setelah klaim berhasil
function checkForMessage() {
const swalContainer = document.querySelector('#swal2-html-container');
if (swalContainer && swalContainer.style.display === 'block') {
const pageText = swalContainer.innerText || "";
const successMessage1 = "has been sent to your FaucetPay account!";
const successMessage2 = "has been added to your Main account!"; // Pesan baru
const invalidCaptchaMessage = "Invalid Captcha";
console.log("Checking for messages...");
setTimeout(() => {
const cleanedText = cleanText(pageText);
// Periksa jika pesan keberhasilan atau pesan captcha invalid ada
if (cleanedText.includes(successMessage1) || cleanedText.includes(successMessage2) || cleanedText.includes(invalidCaptchaMessage)) {
console.log("Relevant message found. Redirecting...");
window.location.replace("https://altcryp.com/"); // Ganti dengan replace
} else {
console.log("No relevant message found.");
}
}, 1000);
} else {
console.log("swalContainer not found or not visible.");
}
}
function cleanText(text) {
return text.replace(/\s+/g, ' ').trim();
}
setInterval(checkForMessage, 1000);
// Fungsi untuk membersihkan teks dari spasi berlebihan
function cleanText(text) {
return text.replace(/\s+/g, ' ').trim();
}
// Jalankan pengecekan pesan setiap detik
setInterval(checkForMessage, 1000);
})();