🏠 返回首頁 

Greasy Fork is available in English.

DirectLink Censys

add direct links to censys


安装此脚本?
// ==UserScript==
// @name         DirectLink Censys
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  add direct links to censys
// @author       SH3LL
// @match        https://search.censys.io/search*
// ==/UserScript==
(function() {
'use strict';
const topMenu = document.querySelector('ul.nav-topmenu');
const r###ltSet = document.getElementById('r###ltset');
if (!topMenu || !r###ltSet) {
console.log("Error: 'ul.nav-topmenu' or 'r###ltset' not found on this page.");
return;
}
let port = "";
// PORT QUERY
const portPrompt = prompt("Port number to append in the url (empty=none/80):");
if (portPrompt !== null) {
port = portPrompt.trim();
if (!isNaN(port) && port !== "") {
port = ":" + port;
} else if (port !== ""){
alert("Invalid port number");
port = ""; // Reset port if invalid
}
}
// OPEN ALL BUTTON
const openAllLink = document.createElement('a');
openAllLink.href = '#'; //  Set an empty href (or a meaningful one if needed)
openAllLink.textContent = '🌍️ Open All Links';
openAllLink.style.color='red'
openAllLink.style.marginLeft = '10px'; // Add some margin for better spacing
openAllLink.addEventListener('click', openAllDirectLinks);
topMenu.appendChild(openAllLink); // Aggiunge il link a ul.nav-topmenu
// LINK GENERATION
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.addedNodes.length > 0) {
addAllDirectLinks();
}
});
});
const config = { childList: true, subtree: true };
observer.observe(r###ltSet, config);
function addAllDirectLinks() {
observer.disconnect();
const searchR###ltLinks = r###ltSet.querySelectorAll('.SearchR###lt.r###lt a.SearchR###lt__title-text');
searchR###ltLinks.forEach(link => {
let host_url = link.children[1].innerText; // Assumes the host URL is in the second child element.  Check your HTML!
if (!host_url) {
console.warn("Host URL not found in link element. Skipping.");
return; // Skip if host_url is not found.
}
const MyDirectLink = document.createElement('a');
MyDirectLink.href = "http://" + host_url + port;
MyDirectLink.innerText = '🌍️->Direct';
MyDirectLink.style.color='green'
MyDirectLink.style.marginLeft = '5px';
MyDirectLink.classList.add('my-direct-link');
MyDirectLink.target="_blank"; // Opens in new tab
link.parentNode.insertBefore(MyDirectLink, link.nextSibling);
});
observer.observe(r###ltSet, config);
}
function openAllDirectLinks(event) {
event.preventDefault();
r###ltSet.querySelectorAll('a.my-direct-link').forEach(link => {
window.open(link.href, '_blank');
});
}
addAllDirectLinks();
})();