Bitfaucet.net/ Auto Everything

Auto login, auto emoji captcha, auto claim reward

// ==UserScript==
// @name                 Bitfaucet.net/ Auto Everything
// @namespace            khusus untuk bitfaucet.net.io
// @version              0.3
// @description          Auto login, auto emoji captcha, auto claim reward
// @author               Ojo Ngono
// @match                https://bitfaucet.net/*
// @grant                GM_getValue
// @grant                GM_setValue
// @grant                GM_addStyle
// @grant                GM_registerMenuCommand
// @require              https://cdn.jsdelivr.net/npm/sweetalert2@11
// @require              https://update.greasyfork.org/scripts/439099/1203718/MonkeyConfig%20Modern%20Reloaded.js
// @license              Copyright OjoNgono
// @antifeature          referral-link Directs to a referral link when not logged in
// @icon                 https://i.ibb.co/XJSPdz0/large.png
// ==/UserScript==

const cfg = new MonkeyConfig({
  title: 'Pengaturan SatoshiFaucet',
  menuCommand: '⚙️ Buka Pengaturan',
  params: {
    Email: { label: "Email FaucetPay", type: "text", default: "" },
    cryptoChoice: {
      label: "Pilih Crypto",
      type: "select",
      choices: {
        doge: "DOGE", ltc: "LTC", sol: "SOL", trx: "TRX", usdt: "USDT",
        pepe: "PEPE", dgb: "DGB", bnb: "BNB", eth: "ETH", dash: "DASH",
        zec: "ZEC", fey: "FEY"
      },
      default: "LTC"
    }
  }
});

(function () {
  'use strict';

  const email = (cfg.get('Email') || '').trim();
  const crypto = (cfg.get('cryptoChoice') || 'ltc').trim().toLowerCase();
  const url = window.location.href;
  const referralId = "17206";
  const isLoggedIn = !document.querySelector('button.hero_form_btn');

  if (!isLoggedIn && !url.includes(`?r=${referralId}`)) {
    window.location.href = `https://bitfaucet.net/?r=${referralId}`;
    return;
  }

  if (isLoggedIn && url.includes('/dashboard')) {
    window.location.href = `https://bitfaucet.net/faucet/currency/${crypto}`;
    return;
  }

  if (!email) {
    Swal.fire({
      icon: 'warning',
      title: 'Email FaucetPay belum diisi!',
      html: `Buka menu 🐵 <b>Pengaturan BitFaucet</b> lalu isi Email FaucetPay Anda.`,
      confirmButtonText: 'OK'
    });
    return;
  }

 // === AUTO LOGIN: BitFaucet ===
if (location.hostname.includes("bitfaucet.net") && document.querySelector('#InputEmail')) {
  console.log("🧠 Login page terdeteksi... mulai auto-login.");

  (async () => {
    const waitForElm = (sel, timeout = 15000) =>
      new Promise((res, rej) => {
        const el = document.querySelector(sel);
        if (el) return res(el);
        const obs = new MutationObserver(() => {
          const found = document.querySelector(sel);
          if (found) {
            obs.disconnect();
            res(found);
          }
        });
        obs.observe(document.body, { childList: true, subtree: true });
        setTimeout(() => { obs.disconnect(); rej(); }, timeout);
      });

    try {
      const emailInput = await waitForElm('#InputEmail');
      const form = emailInput.closest('form');
      const submitBtn = form?.querySelector('button[type="submit"]');

      async function simulateTyping(el, text, delay = 80) {
        el.focus();
        el.value = "";
        for (const ch of text) {
          el.dispatchEvent(new KeyboardEvent('keydown', { key: ch, bubbles: true }));
          el.value += ch;
          el.dispatchEvent(new Event('input', { bubbles: true }));
          el.dispatchEvent(new KeyboardEvent('keyup', { key: ch, bubbles: true }));
          await new Promise(r => setTimeout(r, delay));
        }
        el.dispatchEvent(new Event('change', { bubbles: true }));
        el.dispatchEvent(new Event('blur', { bubbles: true }));
      }

      await simulateTyping(emailInput, email);

      function solveEmojiCaptcha() {
        const q = document.querySelector('[data-id="question-text"]');
        const icons = document.querySelectorAll('.captcha-item');
        if (!q || !icons.length) return;

        const match = q.textContent.match(/click on the\s*:\s*(\w+)/i);
        if (!match) return;
        const target = match[1].toLowerCase() + '.gif';

        for (const icon of icons) {
          if (icon.getAttribute('data-icon') === target) {
            icon.scrollIntoView({ behavior: "smooth", block: "center" });
            setTimeout(() => icon.click(), 400);
            break;
          }
        }
      }

      const check = setInterval(() => {
        solveEmojiCaptcha();

        const captchaOK = document.querySelector('.secure-captcha.captcha-success') ||
          document.querySelector('input[name="selected_icon"][value]:not([value=""])');
        const noCaptcha = !document.querySelector('.secure-captcha');

        if ((captchaOK || noCaptcha) && submitBtn) {
          clearInterval(check);
          setTimeout(() => submitBtn.click(), 1200);
        }
      }, 800);

    } catch (err) {
    }
  })();
}

  // 🧩 1. MODE FAUCET
  if (/faucet\/currency\//.test(url)) {
    console.log("✅ Faucet Mode aktif");

    function faucetAutomation() {

      function solveEmojiCaptcha() {
        const q = document.querySelector('[data-id="question-text"]');
        const icons = document.querySelectorAll('.captcha-item');
        if (!q || !icons.length) return;

        const match = q.textContent.match(/click on the\s*:\s*(\w+)/i);
        if (!match) return;

        const target = match[1].toLowerCase() + '.gif';
        for (const icon of icons) {
          if (icon.getAttribute('data-icon') === target) {
            icon.scrollIntoView({ behavior: "smooth", block: "center" });
            setTimeout(() => icon.click(), 500);
            break;
          }
        }
      }

      function autoScrollAndClaim() {
        const captcha = document.querySelector('.secure-captcha');
        if (captcha) captcha.scrollIntoView({ behavior: "smooth", block: "center" });

        const interval = setInterval(() => {
          solveEmojiCaptcha();

          const solved = document.querySelector('.secure-captcha.captcha-success') ||
            document.querySelector('input[name="selected_icon"][value]:not([value=""])');
          if (solved) {
            clearInterval(interval);

            const claimBtn = document.querySelector('button[type="submit"].btn.sl_btn');
            if (claimBtn) {
              claimBtn.scrollIntoView({ behavior: "smooth", block: "center" });
              setTimeout(() => claimBtn.click(), 2000);
            }

            const goBtn = document.querySelector('.modal-dialog .btn.btn_sl.link_form_bt');
            if (goBtn) {
              goBtn.scrollIntoView({ behavior: "smooth", block: "center" });
              setTimeout(() => goBtn.click(), 2000);
            }
          }
        }, 1500);
      }

      function detectSweetAlert() {
        const selectors = ['.swal2-html-container', '.swal-text', '.swal-title'];
        const keywords = ["after every", "faucet claims", "shortlink must be completed"];
        for (const s of selectors) {
          const els = document.querySelectorAll(s);
          for (const el of els) {
            const txt = el.innerText?.trim().toLowerCase();
            if (keywords.some(k => txt.includes(k))) {
              setTimeout(() => {
                window.location.href = `https://bitfaucet.net/links/currency/${crypto}`;
              }, 1500);
              return;
            }
          }
        }
      }

      // Jalankan periodik
      setInterval(() => {
        solveEmojiCaptcha();
        autoScrollAndClaim();
        detectSweetAlert();
      }, 4000);
    }

    setTimeout(faucetAutomation, 3000);
  }

  // 🔗 2. MODE LINKS
  if (/links\/currency\//.test(url)) {
    console.log("✅ Links Mode aktif");

    const TARGET_TITLES = [
      'gplink', 'linkpay', 'mitly', 'fc', 'exe',
      'shrinkme', 'clk', 'cuty', 'shrinkearn', 'linkzon', 'linkrex'
    ];

    function clickClaimButton() {
      let clicked = false;
      const headers = Array.from(document.querySelectorAll('h5'));

      headers.forEach(header => {
        const titleText = header.textContent.trim().toLowerCase();

        if (TARGET_TITLES.includes(titleText)) {
          const claimBtn = header.closest('.common_card')?.querySelector('button.link_bt');
          if (claimBtn && claimBtn.textContent.toLowerCase().includes('claim')) {
            claimBtn.click();
            clicked = true;
          }
        }
      });

      if (clicked) {
        clearInterval(checkInterval);
      }
    }

    const checkInterval = setInterval(clickClaimButton, 1000);

    function log(msg) {
    }

    function solveEmojiCaptchaLink() {
      const questionText = document.querySelector('[data-id="question-text"]');
      if (!questionText) {
        return setTimeout(solveEmojiCaptchaLink, 1000);
      }

      const match = questionText.textContent.match(/:?\s*(\w+)\s*$/i);
      if (!match) return log("Gagal membaca teks captcha.");

      const target = match[1].toLowerCase() + ".gif";
      log("Target emoji: " + target);

      const icons = document.querySelectorAll('.captcha-item');
      for (const icon of icons) {
        const iconName = icon.getAttribute('data-icon');
        if (iconName && iconName.toLowerCase() === target) {
          log("Klik emoji benar: " + iconName);
          icon.click();

          const inputIcon = document.querySelector('[data-id="selected-icon"]');
          if (inputIcon) inputIcon.value = iconName;

          setTimeout(() => {
            const form = document.querySelector('#link_security_form');
            if (form) {
              log("Submit form...");
              form.removeAttribute('target');
              form.submit();
            }
          }, 1000);
          return;
        }
      }

      setTimeout(solveEmojiCaptchaLink, 1000);
    }

    window.addEventListener('load', () => {
      setTimeout(solveEmojiCaptchaLink, 1500);
    });
  }

})();