Greasy Fork

Greasy Fork is available in English.

Fofa.so 搜索结果页面“使用API”优化

修改了Fofa.so 搜索结果页面“使用API”界面,对原有api增加了size和filed参数,并增加了powershell下载命令。

// ==UserScript==
// @name         Fofa.so 搜索结果页面“使用API”优化
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  修改了Fofa.so 搜索结果页面“使用API”界面,对原有api增加了size和filed参数,并增加了powershell下载命令。
// @author       mark0smith
// @match        https://fofa.so/result?*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var selector = "#apiInfoModal > div > div > div.modal-body > div:nth-child(1)";
    var original_api = document.querySelector(selector).innerText.trim();


    var replace_text = ""
    replace_text += "原始api为:\n"
    replace_text += original_api + "\n\n";

    replace_text += "修改后api为:\n"
    var new_api = original_api + "&size=10000&fields=ip"
    replace_text += new_api + "\n\n";

    replace_text += "使用PowerShell下载数据:\n"
    var output_filename = Date.now().toString() + ".json"
    var powershell_download_command = 'Invoke-WebRequest -Uri "'+ new_api +'" -OutFile ' + output_filename;
    replace_text += powershell_download_command + "\n"

    document.querySelector(selector).innerText = replace_text
})();