Universal Shortlink Auto-Bypasser

Auto-detects and bypasses ANY shortlink site - no updates needed!

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Universal Shortlink Auto-Bypasser
// @namespace    http://tampermonkey.net/
// @version      4.0
// @description  Auto-detects and bypasses ANY shortlink site - no updates needed!
// @author       You
// @match        *://*/*
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// @grant        GM_notification
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // ==========================================
    // SETTINGS
    // ==========================================
    const defaultSettings = {
        enableLogging: true,
        enableNotifications: true,
        autoRedirect: true,
        redirectDelay: 500,
        maxRedirects: 5,
        minConfidence: 2  // How many shortlink indicators needed to activate
    };

    let settings = {};
    for (let key in defaultSettings) {
        settings[key] = GM_getValue(key, defaultSettings[key]);
    }

    // Settings menu
    GM_registerMenuCommand('⚙️ Configure Bypasser', () => {
        const newLogging = confirm('Enable detailed logging?\n\nCurrent: ' + settings.enableLogging);
        const newNotifications = confirm('Enable notifications?\n\nCurrent: ' + settings.enableNotifications);
        const newAutoRedirect = confirm('Enable auto-redirect?\n\nCurrent: ' + settings.autoRedirect);
        const newDelay = prompt('Redirect delay (ms):', settings.redirectDelay);
        const newMaxRedirects = prompt('Max redirects (1-10):', settings.maxRedirects);

        GM_setValue('enableLogging', newLogging);
        GM_setValue('enableNotifications', newNotifications);
        GM_setValue('autoRedirect', newAutoRedirect);
        GM_setValue('redirectDelay', parseInt(newDelay) || 500);
        GM_setValue('maxRedirects', parseInt(newMaxRedirects) || 5);

        alert('✓ Settings saved! Reload page.');
        location.reload();
    });

    GM_registerMenuCommand('📊 Statistics', () => {
        alert(`Bypasser Stats:\n\n` +
              `Attempts: ${attempts}\n` +
              `Redirects: ${redirectCount}/${settings.maxRedirects}\n` +
              `Confidence: ${confidenceScore}/5\n` +
              `URL: ${window.location.href}`);
    });

    // ==========================================
    // LOGGING
    // ==========================================
    const Logger = {
        log: (msg, data = '') => {
            if (settings.enableLogging) {
                console.log(`%c[Bypasser] ${msg}`, 'color: #4CAF50; font-weight: bold', data);
            }
        },
        error: (msg, data = '') => {
            if (settings.enableLogging) {
                console.error(`%c[Bypasser ERROR] ${msg}`, 'color: #f44336; font-weight: bold', data);
            }
        },
        success: (msg, data = '') => {
            if (settings.enableLogging) {
                console.log(`%c[Bypasser ✓] ${msg}`, 'color: #2196F3; font-weight: bold', data);
            }
        },
        warn: (msg, data = '') => {
            if (settings.enableLogging) {
                console.warn(`%c[Bypasser ⚠] ${msg}`, 'color: #FF9800; font-weight: bold', data);
            }
        },
        notify: (title, text) => {
            if (settings.enableNotifications) {
                GM_notification({ title, text, timeout: 3000 });
            }
        }
    };

    // ==========================================
    // MULTI-REDIRECT HANDLER
    // ==========================================
    let redirectCount = 0;
    const redirectHistory = [];

    function handleRedirect(url) {
        if (redirectCount >= settings.maxRedirects) {
            Logger.error('Max redirects reached!', redirectHistory);
            Logger.notify('❌ Bypass Failed', 'Too many redirects');
            return false;
        }

        redirectCount++;
        redirectHistory.push({ url, time: new Date().toISOString() });
        Logger.log(`Redirect #${redirectCount}/${settings.maxRedirects}:`, url);

        if (settings.autoRedirect) {
            setTimeout(() => {
                Logger.success('Redirecting...', url);
                Logger.notify('🔄 Redirecting', `Step ${redirectCount}`);
                window.location.href = url;
            }, settings.redirectDelay);
        }
        return true;
    }

    // ==========================================
    // SMART SHORTLINK DETECTION
    // ==========================================
    let confidenceScore = 0;

    function detectShortlinkPage() {
        confidenceScore = 0;
        const indicators = [];

        // Indicator 1: Countdown timer in text
        const bodyText = document.body.innerText.toLowerCase();
        if (bodyText.match(/wait\s+\d+\s+second|please wait|redirect.*\d+|countdown|timer/i)) {
            confidenceScore++;
            indicators.push('Countdown text detected');
        }

        // Indicator 2: Continue/Proceed button
        const buttons = Array.from(document.querySelectorAll('button, a, input[type="submit"]'));
        const hasButton = buttons.some(btn => {
            const text = (btn.innerText || btn.value || '').toLowerCase();
            return text.match(/continue|proceed|next|get link|skip|verify|claim|retry/);
        });
        if (hasButton) {
            confidenceScore++;
            indicators.push('Continue button found');
        }

        // Indicator 3: URL patterns
        const url = window.location.href.toLowerCase();
        const urlPatterns = /\/go\/|\/link\/|\/url\/|short|redirect|forward|safelink|bypass|ad\.fly|shrink/;
        if (urlPatterns.test(url)) {
            confidenceScore++;
            indicators.push('Shortlink URL pattern');
        }

        // Indicator 4: Meta refresh or JavaScript redirect
        const hasMetaRefresh = document.querySelector('meta[http-equiv="refresh"]');
        const scriptsText = Array.from(document.querySelectorAll('script'))
            .map(s => s.textContent)
            .join(' ');
        if (hasMetaRefresh || scriptsText.includes('location.href') || scriptsText.includes('window.location')) {
            confidenceScore++;
            indicators.push('Redirect mechanism found');
        }

        // Indicator 5: Typical shortlink page elements
        const hasAdFrame = document.querySelector('iframe[src*="ad"], iframe[src*="ads"]');
        const hasLoader = document.querySelector('.loader, .spinner, .loading, #timer, .countdown');
        if (hasAdFrame || hasLoader) {
            confidenceScore++;
            indicators.push('Typical shortlink elements');
        }

        Logger.log(`Confidence Score: ${confidenceScore}/5`, indicators);

        // Only activate if confidence is high enough
        return confidenceScore >= settings.minConfidence;
    }

    // ==========================================
    // URL EXTRACTION
    // ==========================================
    function extractURLFromSource() {
        Logger.log('🔍 Scanning for destination URL...');

        const patterns = [
            /(?:url|link|destination|target|final_url|goto|next_url|continue_url)\s*[:=]\s*["']([^"']+)["']/gi,
            /window\.location\.href\s*=\s*["']([^"']+)["']/gi,
            /window\.location\s*=\s*["']([^"']+)["']/gi,
            /location\.replace\(["']([^"']+)["']\)/gi,
            /redirect_url\s*=\s*["']([^"']+)["']/gi
        ];

        const scripts = Array.from(document.querySelectorAll('script'));
        
        for (let script of scripts) {
            for (let pattern of patterns) {
                const matches = [...script.textContent.matchAll(pattern)];
                for (let match of matches) {
                    const url = match[1];
                    if (isValidURL(url)) {
                        Logger.success('✓ URL found in script:', url);
                        Logger.notify('✓ URL Extracted!', 'Bypassing...');
                        return url;
                    }
                }
            }
        }

        // Check meta refresh
        const meta = document.querySelector('meta[http-equiv="refresh"]');
        if (meta) {
            const content = meta.getAttribute('content');
            const urlMatch = content.match(/url=(.+)/i);
            if (urlMatch && isValidURL(urlMatch[1])) {
                Logger.success('✓ URL in meta:', urlMatch[1]);
                return urlMatch[1];
            }
        }

        // Check data attributes
        const dataElems = document.querySelectorAll('[data-url], [data-link], [data-destination]');
        for (let elem of dataElems) {
            const url = elem.dataset.url || elem.dataset.link || elem.dataset.destination;
            if (url && isValidURL(url)) {
                Logger.success('✓ URL in data attr:', url);
                return url;
            }
        }

        // Check hidden inputs
        const inputs = document.querySelectorAll('input[type="hidden"]');
        for (let input of inputs) {
            if (isValidURL(input.value)) {
                Logger.success('✓ URL in hidden input:', input.value);
                return input.value;
            }
        }

        Logger.warn('No URL found');
        return null;
    }

    function isValidURL(url) {
        try {
            if (!url || typeof url !== 'string') return false;
            if (!url.startsWith('http')) return false;
            if (url.includes(window.location.hostname)) return false;
            
            const blacklist = ['facebook.com', 'twitter.com', 'google.com', 'javascript:', 'about:', '#'];
            return !blacklist.some(item => url.includes(item));
        } catch {
            return false;
        }
    }

    // ==========================================
    // BYPASS LOGIC
    // ==========================================
    let attempts = 0;
    const maxAttempts = 120;

    function getCountdownTime() {
        const text = document.body.innerText;
        const patterns = [
            /wait\s+(\d+)\s+second/i,
            /(\d+)\s+second/i,
            /retry.*in\s+(\d+)\s+second/i,
            /please\s+wait[^\d]*(\d+)/i
        ];

        for (let pattern of patterns) {
            const match = text.match(pattern);
            if (match) {
                Logger.log(`⏱️ Countdown: ${match[1]}s`);
                return parseInt(match[1]);
            }
        }
        return 0;
    }

    function clickButton() {
        const buttons = Array.from(document.querySelectorAll('button, a, input[type="submit"], div[role="button"]'));
        
        for (let btn of buttons) {
            const text = (btn.innerText || btn.value || '').toLowerCase();
            if (text.match(/retry|continue|proceed|get link|next|skip|claim|verify/)) {
                if (btn.offsetParent !== null && !btn.disabled) {
                    Logger.success('🖱️ Clicking:', btn.innerText || btn.value);
                    setTimeout(() => {
                        btn.click();
                        Logger.notify('✓ Clicked', text);
                    }, 300);
                    return true;
                }
            }
        }
        return false;
    }

    function attemptBypass() {
        if (attempts++ > maxAttempts) {
            Logger.error('Max attempts exceeded');
            return;
        }

        Logger.log(`Attempt #${attempts}`);

        // Try URL extraction
        const url = extractURLFromSource();
        if (url) {
            handleRedirect(url);
            return;
        }

        // Check countdown
        const countdown = getCountdownTime();
        if (countdown > 0) {
            Logger.log(`Waiting ${countdown}s...`);
            setTimeout(() => clickButton(), (countdown + 1) * 1000);
            return;
        }

        // Try clicking
        if (!clickButton()) {
            setTimeout(attemptBypass, 500);
        }
    }

    // ==========================================
    // INITIALIZATION
    // ==========================================
    
    // Only run if this looks like a shortlink page
    if (detectShortlinkPage()) {
        Logger.success(`🎯 Shortlink detected! Confidence: ${confidenceScore}/5`);
        Logger.notify('🚀 Bypasser Active', 'Processing...');
        setTimeout(attemptBypass, 1000);

        // Monitor changes
        new MutationObserver(() => clickButton()).observe(document.body, {
            childList: true,
            subtree: true
        });
    } else {
        Logger.log('Not a shortlink page, staying idle');
    }

})();