Greasy Fork is available in English.

乌云网漏洞及知识库链接转换器

将原乌云网漏洞及知识库链接转换为指定的镜像站链接,实现无缝浏览!

目前为 2016-09-04 提交的版本。查看 最新版本

// ==UserScript==
// @name         乌云网漏洞及知识库链接转换器
// @namespace    http://www.freebuf.com/author/hktk_hrl
// @version      0.1
// @description  将原乌云网漏洞及知识库链接转换为指定的镜像站链接,实现无缝浏览!
// @author       hktk_hrl
// @include      *
// @require      http://code.jquery.com/jquery-2.1.4.min.js
// @grant        none
// ==/UserScript==

var mirrorHostName = 'http://192.168.162.138:5000';    //乌云镜像站地址,请根据实际情况改写为自己可用的地址
var mirrorUrlPrefix = mirrorHostName + '/static';      //乌云镜像站URL前缀,默认为http://mirrorHostName/static
var bugsReg = /http:\/\/www\.wooyun\.org(\/bugs\/wooyun-\d+-\d+)/;    //乌云漏洞页面URL匹配规则
var dropsReg = /http:\/\/drops\.wooyun\.org\/(.+)\/(\d+)/;            //乌云知识库页面URL匹配规则

$('body').on('click', 'a', function () {
    var target = this;
    var oldUrl = this.href;
    var arr, newUrl;
    //漏洞页面规则:http://www.wooyun.org/bugs/wooyun-2012-011833 --> http://192.168.162.138:5000/static/bugs/wooyun-2012-011833.html
    if (bugsReg.test(oldUrl)) {
        arr = bugsReg.exec(oldUrl);
        newUrl = mirrorUrlPrefix + arr[1] + '.html';
        this.href = newUrl;
    }
    //知识库页面规则:http://drops.wooyun.org/category/12345 --> http://192.168.162.138:5000/static/drops/category-12345.html
    else if (dropsReg.test(oldUrl)) {
        arr = dropsReg.exec(oldUrl);
        newUrl = mirrorUrlPrefix + '/drops/' + arr[1] + '-' + arr[2] + '.html';
        this.href = newUrl;
    }
});