Greasy Fork

Greasy Fork is available in English.

Instagram Virus Link Killer

检查并修改Twitter页面中的高危链接

当前为 2024-05-14 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Instagram Virus Link Killer
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  检查并修改Twitter页面中的高危链接
// @author       SKW_Official_2
// @match        *://*.x.com/*
// @match        *://*.twitter.com/*
// @grant        none
// @license      GPLv3
// ==/UserScript==


(function() {
    'use strict';

    function checkAndModifyLinks() {
        // 获取所有的 a 标签
        const links = document.querySelectorAll('a');

        links.forEach(link => {
            const href = link.href;
            const textContent = link.textContent;

            // 检查 a 标签的 textContent 是否包含 l.instagram.com
            if (!textContent.includes(" [高危链接]")) {
                if (textContent.includes("l.instagram.com")) {
                    console.log("找到了 l.instagram.com 文本");

                    // 检查 textContent 是否包含 business.instagram.com 或 www.facebook.com/ads
                    if (textContent.includes("business.instagram.com") || textContent.includes("www.facebook.com/ads")) {
                        console.log("找到了 business.instagram.com 或 www.facebook.com/ads 文本");
                        // 将链接颜色改为红色
                        link.style.color = "red";
                        // 添加高危链接的标记
                        link.textContent += " [高危链接]";
                        // 修改链接目标为 127.0.0.1
                        link.href = "http://127.0.0.1";
                    }
                }
            }
        });
    }

    const observer = new MutationObserver(checkAndModifyLinks);

    observer.observe(document.body, { childList: true, subtree: true });

    checkAndModifyLinks();
})();