피싱 링크 차단기

@ 포함된 http/https 링크 중 피싱 목적 링크만 [Blocked URL]로 대체

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         피싱 링크 차단기
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  @ 포함된 http/https 링크 중 피싱 목적 링크만 [Blocked URL]로 대체
// @icon         https://raw.githubusercontent.com/githubkorean/Link-Blocker/refs/heads/main/icon.png
// @author       [email protected]
// @match        *://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    const customUrl = 'https://www.google.com';  // 커스텀 리디렉션 링크

    document.querySelectorAll('a[href]').forEach(link => {
        const href = link.getAttribute('href');
        if (!href) return;
        if (href.startsWith('mailto:')) return;

        if ((href.startsWith('http://') || href.startsWith('https://')) && href.includes('@')) {
            try {
                const url = new URL(href, window.location.href);
                const userInfoExists = url.username || href.match(/https?:\/\/[^\/]+@/);

                if (userInfoExists) {
                    // 피싱 가능성이 있는 링크만 차단
                    const overlay = document.createElement('a');
                    overlay.href = customUrl;
                    overlay.target = '_blank';
                    overlay.textContent = '[Blocked URL]';
                    overlay.style.color = 'red';
                    overlay.style.fontWeight = 'bold';
                    overlay.style.textDecoration = 'underline';
                    overlay.style.cursor = 'pointer';

                    link.replaceWith(overlay);
                }
            } catch (e) {
                // URL 파싱 실패 시 무시
            }
        }
    });

})();