[Premium] Faucet Monitor with Faucetpay ReCaptcha/Antibot Rotator

Automates form filling and button clicking on Faucetpay Faucet websites, with ReCaptcha/Antibot handling.

当前为 2024-01-22 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         [Premium] Faucet Monitor with Faucetpay ReCaptcha/Antibot Rotator
// @namespace    https://greasyfork.org/users/1162863
// @version      1.7
// @description  Automates form filling and button clicking on Faucetpay Faucet websites, with ReCaptcha/Antibot handling.
// @author       Andrewblood
// @match        https://www.coinfinity.top/downloads.php
// @match        https://sollcrypto.com/home/page/*
// @match        https://cryptoclaps.com/earn/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=faucetpay.io
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @antifeature  referral-code
// @license      Andrewblood
// ==/UserScript==
/*

Automates form filling and button clicking on Faucetpay Faucet websites, with ReCaptcha/Antibot handling.

Features:
- Automatically fills and clicks buttons on supported Faucetpay Faucet websites.
- If the claim is done, it redirects to the next supported Faucet URL.
- Saves empty pages with timestamps to prevent revisiting within 6 hours.
- Provides an overlay for managing saved pages, clearing stored pages, displaying them, and saving Faucetpay email.

*/
(function() {
    'use strict';

    // Function to click a button
    function clickButton(selector) {
        var button = document.querySelector(selector);
        if (button) {
            button.click();
        }
    }

    // Function to check if an element is visible
    function isElementVisible(selector) {
        var element = document.querySelector(selector);
        return element && element.offsetWidth > 0 && element.offsetHeight > 0;
    }

    var urls = [
        "https://sollcrypto.com/home/page/bitcoin/",
        "https://sollcrypto.com/home/page/doge/",
        "https://sollcrypto.com/home/page/tron/",
        "https://sollcrypto.com/home/page/digibyte/",
        "https://sollcrypto.com/home/page/litecoin/",
        "https://sollcrypto.com/home/page/binance/",
        "https://sollcrypto.com/home/page/solana/",
        "https://sollcrypto.com/home/page/ethereum/",
        "https://sollcrypto.com/home/page/bch/",
        "https://sollcrypto.com/home/page/xrp/",
        "https://sollcrypto.com/home/page/dash/",
        "https://sollcrypto.com/home/page/zcash/",
        "https://cryptoclaps.com/earn/dogecoin/",
        "https://cryptoclaps.com/earn/tron/",
        "https://cryptoclaps.com/earn/digibyte/",
        "https://cryptoclaps.com/earn/litecoin/",
        "https://cryptoclaps.com/earn/binance/",
        "https://cryptoclaps.com/earn/solana/",
        "https://cryptoclaps.com/earn/ethereum/",
        "https://cryptoclaps.com/earn/bch/",
        "https://cryptoclaps.com/earn/xrp/",
        "https://cryptoclaps.com/earn/dash/",
        "https://cryptoclaps.com/earn/polygon/",
        "https://cryptoclaps.com/earn/usdt/",
        "https://cryptoclaps.com/earn/feyorra/",
        "https://cryptoclaps.com/earn/zcash/",
    ];

    // Email overlay creation
    var overlay = document.createElement('div');
    overlay.id = 'emailInputOverlay';
    overlay.style.position = 'fixed';
    overlay.style.bottom = '10px';
    overlay.style.right = '10px';
    overlay.style.zIndex = '10000';

    // Create a button for other requirements
    var otherRequirementsButton = document.createElement('button');
    otherRequirementsButton.id = 'otherRequirementsButton';
    otherRequirementsButton.style.padding = '5px';
    otherRequirementsButton.style.marginLeft = '5px';
    otherRequirementsButton.textContent = 'Other Requirements';

    // Add event listener for otherRequirementsButton
    otherRequirementsButton.addEventListener('click', function() {
        // Create an overlay for other requirements
        var otherRequirementsOverlay = document.createElement('div');
        otherRequirementsOverlay.style.position = 'fixed';
        otherRequirementsOverlay.style.top = '50%';
        otherRequirementsOverlay.style.left = '50%';
        otherRequirementsOverlay.style.transform = 'translate(-50%, -50%)';
        otherRequirementsOverlay.style.zIndex = '10001';
        otherRequirementsOverlay.style.backgroundColor = '#fff';
        otherRequirementsOverlay.style.border = '1px solid #ddd';
        otherRequirementsOverlay.style.padding = '20px';
        otherRequirementsOverlay.style.maxHeight = '80%';
        otherRequirementsOverlay.style.overflowY = 'auto';

        // Define the list of extensions and scripts with install buttons
        var requirementsList = [
            { name: '<b>ReCaptcha:</b> hektCaptcha: hCaptcha Solver', installUrl: 'https://github.com/Wikidepia/hektCaptcha-extension' },
            { name: '<b>Antibot Words:</b> AB Links Solver', installUrl: 'https://greasyfork.org/de/scripts/459453-ab-links-solver' }
        ];

        // Create a list element
        var list = document.createElement('ul');
        list.style.listStyleType = 'none';
        list.style.padding = '0';

        // Populate the list with requirements and install buttons
        requirementsList.forEach(function(requirement) {
            var listItem = document.createElement('li');

            var installButton = document.createElement('button');
            installButton.textContent = 'Install';
            installButton.addEventListener('click', function() {
                // Open a new tab with the install URL
                window.open(requirement.installUrl, '_blank');
            });

            // Create a span element for styling
            var styledText = document.createElement('span');
            styledText.innerHTML = requirement.name; // Use innerHTML to interpret HTML tags

            // Append the span and install button to the list item
            listItem.appendChild(styledText);
            listItem.appendChild(installButton);
            list.appendChild(listItem);
        });

        // Create a close button for the overlay
        var closeRequirementsButton = document.createElement('button');
        closeRequirementsButton.textContent = 'Close';
        closeRequirementsButton.style.padding = '8px';
        closeRequirementsButton.style.marginTop = '10px';
        closeRequirementsButton.addEventListener('click', function() {
            // Close the overlay when the close button is clicked
            document.body.removeChild(otherRequirementsOverlay);
        });

        // Append the list and close button to the overlay
        otherRequirementsOverlay.appendChild(list);
        otherRequirementsOverlay.appendChild(closeRequirementsButton);

        // Add the overlay to the body
        document.body.appendChild(otherRequirementsOverlay);
    });

    // Create a button to show stored URLs
    var showStoredUrlsButton = document.createElement('button');
    showStoredUrlsButton.id = 'showStoredUrlsButton';
    showStoredUrlsButton.style.padding = '5px';
    showStoredUrlsButton.style.marginLeft = '5px';
    showStoredUrlsButton.textContent = 'Show Sites';

    // Add an event listener for the showStoredUrlsButton
    showStoredUrlsButton.addEventListener('click', function() {
        // Display stored pages in an overlay
        var storedUrls = GM_getValue('storedUrls', []);

        // Combine stored URLs with the original URLs
        var allUrls = urls.map(function(url) {
            var storedUrlEntry = storedUrls.find(function(storedUrl) {
                return storedUrl.url === url;
            });

            return {
                url: url,
                timestamp: storedUrlEntry ? storedUrlEntry.timestamp : null
            };
        });

        // Create an overlay for the table
        var overlayTable = document.createElement('div');
        overlayTable.style.position = 'fixed';
        overlayTable.style.top = '50%';
        overlayTable.style.left = '50%';
        overlayTable.style.transform = 'translate(-50%, -50%)';
        overlayTable.style.zIndex = '10001';
        overlayTable.style.backgroundColor = '#fff';
        overlayTable.style.border = '1px solid #ddd';
        overlayTable.style.padding = '20px';
        overlayTable.style.maxHeight = '80%';
        overlayTable.style.overflowY = 'auto';

        // Create a close button for the overlay
        var closeButton = document.createElement('button');
        closeButton.textContent = 'Close';
        closeButton.style.padding = '8px';
        closeButton.style.marginTop = '10px';
        closeButton.addEventListener('click', function() {
            // Close the overlay when the close button is clicked
            document.body.removeChild(overlayTable);
        });

        // Create a button to delete all stored URLs
        var deleteAllButton = document.createElement('button');
        deleteAllButton.id = 'deleteAllButton';
        deleteAllButton.style.padding = '5px';
        deleteAllButton.style.marginLeft = '5px';
        deleteAllButton.style.float = 'right'; // Align the button to the right
        deleteAllButton.textContent = 'Delete All Times';

        // Add an event listener for the deleteAllButton
        deleteAllButton.addEventListener('click', function() {
            // Clear all stored URLs
            GM_deleteValue('storedUrls');

            // Refresh the table
            showStoredUrlsButton.click();
        });

        // Create a table element
        var table = document.createElement('table');
        table.style.borderCollapse = 'collapse';
        table.style.width = '100%';

        // Create table headers
        var headers = ['URL', 'Status', 'Delete'];
        var headerRow = table.insertRow();
        for (var i = 0; i < headers.length; i++) {
            var headerCell = headerRow.insertCell(i);
            headerCell.style.border = '1px solid #ddd';
            headerCell.style.padding = '8px';
            headerCell.style.textAlign = 'left';
            headerCell.textContent = headers[i];

            // Add click event for sorting
            if (i === 1 || i === 2) {
                headerCell.addEventListener('click', function() {
                    sortTable(table, this.cellIndex);
                });
            }
        }

        // Populate table with all URLs, timestamps, and delete buttons
        for (var j = 0; j < allUrls.length; j++) {
            var urlEntry = allUrls[j];
            var row = table.insertRow();

            var urlCell = row.insertCell(0);
            urlCell.style.border = '1px solid #ddd';
            urlCell.style.padding = '8px';
            urlCell.textContent = urlEntry.url;

            var statusCell = row.insertCell(1);
            statusCell.style.border = '1px solid #ddd';
            statusCell.style.padding = '8px';
            statusCell.style.color = getStatusColor(urlEntry);
            statusCell.textContent = getStatusText(urlEntry);

            var deleteCell = row.insertCell(2);
            deleteCell.style.border = '1px solid #ddd';
            deleteCell.style.padding = '8px';

            // Create delete button for each row
            var deleteButton = document.createElement('button');
            deleteButton.textContent = 'Delete Time';
            deleteButton.addEventListener('click', createDeleteHandler(urlEntry));

            deleteCell.appendChild(deleteButton);
        }

        // Append the table and close button to the overlay
        overlayTable.appendChild(table);
        overlayTable.appendChild(closeButton);
        overlayTable.appendChild(deleteAllButton);

        // Add the overlay to the body
        document.body.appendChild(overlayTable);
    });

    // Function to get the status text based on the urlEntry
    function getStatusText(urlEntry) {
        var currentTime = Date.now();

        if (urlEntry.timestamp) {
            var timestamp = Date.parse(urlEntry.timestamp.replace(/-/g, '/'));
            if (timestamp > currentTime) {
                // Not Active Until
                return 'Not Active Until ' + urlEntry.timestamp;
            } else {
                // Active
                return 'Active';
            }
        } else {
            return 'Active';
        }
    }

    // Function to get the status color based on the urlEntry
    function getStatusColor(urlEntry) {
        var currentTime = Date.now();

        if (urlEntry.timestamp) {
            var timestamp = Date.parse(urlEntry.timestamp.replace(/-/g, '/'));
            return (timestamp > currentTime) ? 'red' : 'green';
        } else {
            return 'green'; // Assuming 'Active' state when timestamp is not present
        }
    }

    // Function to create a delete handler with a specific urlEntry
    function createDeleteHandler(urlEntry) {
        return function() {
            // Find the corresponding URL and delete it from stored pages
            var urlToDelete = urlEntry.url;
            var storedUrls = GM_getValue('storedUrls', []);
            storedUrls = storedUrls.filter(function(storedUrl) {
                return storedUrl.url !== urlToDelete;
            });

            // Update stored pages
            GM_setValue('storedUrls', storedUrls);

            // Refresh the table
            showStoredUrlsButton.click();
        };
    }

    // Function to sort the table by column index
    function sortTable(table, columnIndex) {
        var rows = Array.from(table.rows).slice(1); // Exclude header row
        var sortOrder = 1;

        // Determine sorting order based on the current order of the column
        if (table.rows[0].cells[columnIndex].classList.contains('ascending')) {
            sortOrder = -1;
        }

        // Remove sorting classes from all columns
        for (var i = 0; i < table.rows[0].cells.length; i++) {
            table.rows[0].cells[i].classList.remove('ascending', 'descending');
        }

        // Sort the rows based on the content of the selected column
        rows.sort(function(a, b) {
            var textA = a.cells[columnIndex].textContent.trim().toUpperCase();
            var textB = b.cells[columnIndex].textContent.trim().toUpperCase();

            if (textA < textB) {
                return -1 * sortOrder;
            } else if (textA > textB) {
                return 1 * sortOrder;
            } else {
                return 0;
            }
        });

        // Clear and rebuild the table with the sorted rows
        while (table.rows.length > 1) {
            table.deleteRow(1);
        }

        for (var j = 0; j < rows.length; j++) {
            table.appendChild(rows[j]);
        }

        // Add sorting class to the header cell
        if (sortOrder === 1) {
            table.rows[0].cells[columnIndex].classList.add('ascending');
        } else {
            table.rows[0].cells[columnIndex].classList.add('descending');
        }
    }

    // Create an email input field
    var emailInput = document.createElement('input');
    emailInput.type = 'text';
    emailInput.id = 'emailInput';
    emailInput.placeholder = 'Faucetpay Email';
    emailInput.style.padding = '5px';

    // Create a save email button
    var saveEmailButton = document.createElement('button');
    saveEmailButton.id = 'saveEmailButton';
    saveEmailButton.style.padding = '5px';
    saveEmailButton.style.marginLeft = '5px';
    saveEmailButton.textContent = 'Save';

    // Add elements to the overlay
    overlay.appendChild(otherRequirementsButton);
    overlay.appendChild(showStoredUrlsButton);
    overlay.appendChild(emailInput);
    overlay.appendChild(saveEmailButton);

    // Add overlay to the body
    document.body.appendChild(overlay);

    // Get email value from Tampermonkey storage
    var storedEmail = GM_getValue('storedEmail', '');

    // Populate saved email address into the input field
    emailInput.value = storedEmail;

    // Add event listener for save email button
    saveEmailButton.addEventListener('click', function() {
        // Save entered email address
        var newEmail = emailInput.value;
        GM_setValue('storedEmail', newEmail);

        // Success notification (can be customized)
        alert('Email address saved successfully!');
    });

    var currentURL = window.location.href;
    if (currentURL.includes("https://sollcrypto.com/home/page/") || currentURL.includes("https://cryptoclaps.com/earn/")) {

        var currentPageUrl = window.location.href;

        var indexOfRParameter = currentPageUrl.indexOf("?r=");
        if (indexOfRParameter !== -1) {
            currentPageUrl = currentPageUrl.substring(0, indexOfRParameter);
        }

        var storedUrls = GM_getValue('storedUrls', []) || [];

        // Erster Selector: The faucet does not have sufficient funds for this transaction
        var selector1 = "body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > center > div.form > div.alert.alert-danger.fade.show";
        if (isElementVisible(selector1) && document.querySelector(selector1)?.innerText === ' The faucet does not have sufficient funds for this transaction.') {
            var reason1 = 'sufficient funds';
            var timestamp1 = new Date(new Date().getTime() + 12 * 60 * 60 * 1000).toISOString().slice(0, 19).replace('T', ' ');
            saveUrl(currentPageUrl, timestamp1, reason1);
        }

        // Zweiter Selector: Your daily claim limit has been reached. Please come back in tomorrow.
        var selector2 = "body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > center > div.alert.alert-danger.fade.show";
        if (isElementVisible(selector2) && document.querySelector(selector2)?.innerText === ' Your daily claim limit has been reached. Please come back in tomorrow.') {
            var reason2 = 'daily claim limit';
            var timestamp2 = new Date(new Date().getTime() + 3 * 60 * 60 * 1000).toISOString().slice(0, 19).replace('T', ' ');
            saveUrl(currentPageUrl, timestamp2, reason2);
        }

        function saveUrl(url, timestamp, reason) {
            var urlWithTimestamp = { url: url, timestamp: timestamp, reason: reason };

            var existingUrlIndex = storedUrls.findIndex(function (storedUrl) {
                return storedUrl.url === url;
            });

            if (existingUrlIndex !== -1) {
                storedUrls[existingUrlIndex].timestamp = timestamp;
                storedUrls[existingUrlIndex].reason = reason;
            } else {
                storedUrls.push(urlWithTimestamp);
            }

            GM_setValue('storedUrls', storedUrls);
        }

        // Check if the element with the text "satoshi" or specific error messages is visible
        if ((isElementVisible("body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > center > div.form > div.alert.alert-success.fade.show") &&
             document.querySelector("body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > center > div.form > div.alert.alert-success.fade.show").innerText.includes('satoshi')) ||
            (isElementVisible("body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > center > div.form > div.alert.alert-danger.fade.show") &&
             document.querySelector("body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > center > div.form > div.alert.alert-danger.fade.show").innerText === ' The faucet does not have sufficient funds for this transaction.') ||
            (isElementVisible("body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > center > div.alert.alert-danger.fade.show") &&
             document.querySelector("body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > center > div.alert.alert-danger.fade.show").innerText === ' Your daily claim limit has been reached. Please come back in tomorrow.')) {
            var currentURL = window.location.href;

            // Check if "?" exists in the URL
            var indexOfQuestionMark = currentURL.indexOf("?");
            if (indexOfQuestionMark !== -1) {
                // Take only the part of the URL before "?"
                currentURL = currentURL.substring(0, indexOfQuestionMark);
            }

            var urlIndex = 0;

            // Find the index of the current URL in the list
            for (var i = 0; i < urls.length; i++) {
                if (currentURL === urls[i]) {
                    urlIndex = i;
                    break;
                }
            }

            // Debugging: Output stored URLs before the loop
            var storedUrlsBefore = GM_getValue('storedUrls', []);
            console.log('Stored URLs before the loop:\n', JSON.stringify(storedUrlsBefore, null, 2));

            // Redirect to the next URL only if a valid URL is found
            var foundValidUrl = false;
            var attempts = 0;

            do {
                if (attempts > 0) {
                    console.log('No valid URL found in attempt', attempts);
                }

                if (attempts >= urls.length) {
                    console.log('Reached maximum attempts, no valid URL found.');
                    break;
                }

                var nextUrl = urls[urlIndex];

                // Check if the next URL is in the stored URLs with a timestamp and the timestamp is in the future
                var storedUrls = GM_getValue('storedUrls', []);
                var storedUrlEntry = storedUrls.find(function (storedUrl) {
                    return storedUrl.url === nextUrl;
                });

                if (!storedUrlEntry || new Date(storedUrlEntry.timestamp) <= new Date()) {
                    foundValidUrl = true;
                    console.log('Valid URL found:', nextUrl);

                    // Redirect to the next URL
                    window.location.href = nextUrl;
                } else {
                    console.log('Invalid URL, skipping:', nextUrl);
                    urlIndex = (urlIndex + 1) % urls.length; // Move to the next URL in the list
                    attempts++;
                }
            } while (!foundValidUrl);

            // Console logs for completion
            console.log('Redirecting to the next URL:', nextUrl);

            // Debugging: Output updated stored URLs after the loop
            var storedUrlsAfter = GM_getValue('storedUrls', []);
            console.log('Stored URLs after the loop:\n', JSON.stringify(storedUrlsAfter, null, 2));

        } else {
            // Element is not visible, so proceed with the actions
            // Check if the Referral Code is in the URL, if not, add it
            var currentURL = window.location.href;
            var referralCode = '[email protected]';

            if (!currentURL.includes(referralCode)) {
                currentURL += referralCode;
                window.location.href = currentURL; // Redirect with the updated URL
            } else {
                // Continue with actions as the Referral Code is already present
                // If the Faucetpay email field is found, fill it with the saved email address
                var faucetpayEmailInput = document.querySelector("#address");
                if (faucetpayEmailInput) {
                    faucetpayEmailInput.value = storedEmail;

                    // Click the button after inserting the email address
                    clickButton("body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > center > form > div:nth-child(4) > button");

                    // Check if the pop-up/overlay appears and click the login button if conditions are met
                    var intervalId = setInterval(function() {
                        var antibotLinksValue = document.querySelector("#antibotlinks").value.length;
                        var recaptchaResponseValue = document.querySelector("#g-recaptcha-response").value.length;

                        if (antibotLinksValue > 1 && recaptchaResponseValue > 1) {
                            clearInterval(intervalId);

                            // Click the login button
                            clickButton("#login");
                        }
                    }, 1000);
                }
            }
        }
    }



})();