Gateway Mods

This script adds some functions to speed up HP operations

Fra 09.08.2015. Se den seneste versjonen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Gateway Mods
// @namespace    http://www.hacker-project.com/
// @version      1.9
// @description  This script adds some functions to speed up HP operations
// @author       Kevin Mitnick
// @match        http://www.hacker-project.com/*
// @match        http://hacker-project.com/*
// @grant        none
// @require      http://code.jquery.com/jquery-latest.js
// ==/UserScript==

function setup() {
    // Setup jQuery
    var jQueryScript = document.createElement("script");
    jQueryScript.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js");
    document.head.appendChild(jQueryScript);

    // COURIER NEW FONT
    var FONT = true;
    
    if (FONT) for (var x = 0; x < document.getElementsByTagName("td").length; x++) document.getElementsByTagName("td")[x].style.fontFamily="Courier New";

    if (new String(window.location).indexOf("&a2=run") > -1 && new String(window.location).indexOf("&sc=1") < 0) {
        
        // EXPERIMENTAL FEATURE. CAUSES EXTRA LOAD TIME FOR PROCESS PAGE. COMMENT OUT IF YOU WANT TO DISABLE
        addProcs();
        
        $(document).ready(function() {
            var table = document.getElementsByName("frm_files")[0].getElementsByTagName("table")[0];
            for (var numberOfRows = table.rows.length, i = 3; i<numberOfRows-2; i++) {
                var tr = table.getElementsByTagName("tbody")[0].getElementsByTagName("tr")[i];
                var tds = tr.getElementsByTagName("td");
                var content = tds[4].innerHTML;
                var owned = (content.indexOf("Owned")>-1);
                var complete = (content.indexOf("complete")>-1);
                var virus = (content.indexOf("virii")>-1);
                if (owned) tr.style.backgroundColor="#285166";
                if (virus) tr.style.backgroundColor="#E60000";
                if (virus && owned) tr.style.backgroundColor="#511400";
                if (owned && complete) tr.style.backgroundColor="#004400";
            }
        });
    }

    if (new String(window.location).indexOf("&a2=files") > -1) {

        // Batch script
        var batchScript = document.createElement("script");
        batchScript.setAttribute("type", "text/javascript");
        batchScript.innerHTML = "function runPWB(pid, times, rem) { for (var i = 0; i < times; i++) { var iframe = document.createElement('iframe'); iframe.src = 'index.php?action=gate&a2=run&pid='+pid+'&rem='+rem; iframe.style.display='none'; document.body.appendChild(iframe); } }";
        document.body.appendChild(batchScript);

        // Spec scan
        var psWindow = document.createElement("iframe");
        psWindow.src="/index.php?action=gate&a2=run";
        if (new String(window.location).indexOf("&rem=1")>-1) psWindow.src += "&rem=1";
        psWindow.style.display="none";
        psWindow.id = "psWindow";
        document.body.appendChild(psWindow);

        $("#psWindow").load(function() {
            var dc = psWindow.contentWindow.document || psWindow.contentDocument || psWindow.document;
            var dctds = dc.getElementsByTagName("td");
            var specTd;
            for (var dci = 0; dci < dctds.length; dci++) if (dctds[dci].getElementsByTagName("span").length==10) specTd = dctds[dci];
            var specSpans = specTd.getElementsByTagName("span");
            var usedCpu = parseFloat(removeComma(specSpans[1].innerHTML));
            var totalCpu = parseFloat(removeComma(specSpans[2].innerHTML));
            var usedMem = parseFloat(removeComma(specSpans[4].innerHTML));
            var totalMem = parseFloat(removeComma(specSpans[5].innerHTML));
            var usedBand = parseFloat(removeComma(specSpans[7].innerHTML));
            var totalBand = parseFloat(removeComma(specSpans[8].innerHTML));
            var table = document.getElementsByName("frm_files")[0].getElementsByTagName("table")[0];
            table.getElementsByTagName("tbody")[0].appendChild(specTd);
            var itd = document.createElement("td");
            itd.innerHTML = "Executable";
            itd.width="100";
            table.getElementsByTagName("tbody")[0].getElementsByTagName("tr")[2].appendChild(itd);
            for (var numberOfRows = table.rows.length, i = 1; i<numberOfRows-3; i++) {
                var itd2 = document.createElement("td");
                itd.width="100";
                var tr = table.getElementsByTagName("tbody")[0].getElementsByTagName("tr")[i*3];
                var tds = tr.getElementsByTagName("td");
                var versionPoint = 11;
                if (tds[11].innerHTML=="Password Break") versionPoint = 13;
                var content = tds[versionPoint].getElementsByTagName("small")[0].innerHTML;
                var cpuNeed = parseFloat(content.substring(0, content.indexOf(" M")));
                var memNeed = parseFloat(content.substring(content.indexOf("U, ")+3, content.indexOf(" k")));
                var bandNeed = 0;
                if (content.indexOf("Band")>-1) bandNeed = parseFloat(content.substring(content.indexOf("M, ")+3, content.length));
                itd2.innerHTML = "<b><p style='color: red'>No</p></b>";
                if (cpuNeed<=totalCpu-usedCpu && memNeed<=totalMem-usedMem && bandNeed<=totalBand-usedBand) itd2.innerHTML = "<b><p style='color: green'>Yes</p></b>";
                tr.appendChild(itd2);
            }
            if (FONT) for (var x = 0; x < document.getElementsByTagName("td").length; x++) document.getElementsByTagName("td")[x].style.fontFamily="Courier New";
        });

        var table = document.getElementsByName("frm_files")[0].getElementsByTagName("table")[0];
        for (var numberOfRows = table.rows.length, i = 1; i<numberOfRows-3; i++) {
            var tr = table.getElementsByTagName("tbody")[0].getElementsByTagName("tr")[i*3];
            var tds = tr.getElementsByTagName("td");
            var filename = tds[9].innerHTML;
            var versionPoint = 11;
            if (filename == "Password Break") versionPoint = 11;
            var version = parseFloat(tds[versionPoint].innerHTML);

            // File type testing and calculations
            var hd, cpu, mem, band;
            switch (filename) {
                case "Firewall Protect":{  hd = 7.50;  mem = 3000;  cpu = 50;  band = 0; break; }
                case "Firewall Bypass":{  hd = 37.50;  mem = 7000;  cpu = 80;  band = 0; break; }
                case "Password Protect":{  hd = 8.50;  mem = 5000;  cpu = 100;  band = 0; break; }
                case "Password Break":{  hd = 84.96;  mem = 12500;  cpu = 200;  band = 0; break; }
                case "Hide Files":{  hd = 100.00;  mem = 9000;  cpu = 100;  band = 0; break; }
                case "Unhide Files":{  hd = 200.00;  mem = 9000;  cpu = 100;  band = 0; break; }
                case "Encryptor":{  hd = 341.80;  mem = 30000;  cpu = 600;  band = 0; break; }
                case "Decryptor":{  hd = 439.45;  mem = 40000;  cpu = 900;  band = 0; break; }
                case "SpyWare":{  hd = 50.00;  mem = 900;  cpu = 300;  band = 0; break; }
                case "Anti-SpyWare":{  hd = 100.00;  mem = 22500;  cpu = 150;  band = 0; break; }
                case "Malware Logic Bomb":{  hd = 585.94;  mem = 5000;  cpu = 300;  band = 0; break; }
                case "Malware Overload Bomb":{  hd = 976.56;  mem = 7000;  cpu = 550;  band = 0; break; }
                case "Malware Anti-Virus":{  hd = 200.00;  mem = 1500;  cpu = 300;  band = 0; break; }
                case "Adware Spam Daemon":{  hd = 100.00;  mem = 5000;  cpu = 50;  band = 3; break; }
                case "Adware Anti-Virus":{  hd = 174.22;  mem = 10000;  cpu = 250;  band = 0; break; }
                case "File Share Virus":{  hd = 3200.00;  mem = 10000;  cpu = 250;  band = 50; break; }
                case "File Share Anti-Virus":{  hd = 1000.00;  mem = 20000;  cpu = 500;  band = 0; break; }
                case "Sniffer Daemon":{  hd = 151.17;  mem = 3000;  cpu = 50;  band = 0; break; }
                case "IP Cloaker":{  hd = 151.17;  mem = 6000;  cpu = 100;  band = 0; break; }
                case "IP Scanner":{  hd = 369.53;  mem = 10000;  cpu = 200;  band = 0; break; }
                case "Scan Blocker":{  hd = 200.00;  mem = 10000;  cpu = 200;  band = 0; break; }
                case "Data uplink hijack":{  hd = 395.31;  mem = 20000;  cpu = 300;  band = 0; break; }
                case "Data hijack Anti-Virus":{  hd = 200.00;  mem = 30000;  cpu = 500;  band = 0; break; }
                case "Log Deleter":{  hd = 5.00;  mem = 1000;  cpu = 30;  band = 0; break; }
                case "Log UnDeleter":{  hd = 15.00;  mem = 3000;  cpu = 50;  band = 0; break; }
                case "Virus break;er":{  hd = 174.21;  mem = 11500;  cpu = 300;  band = 0; break; }
                case "Faith Anti-Virus":{  hd = 20000.00;  mem = 1200000;  cpu = 20000;  band = 0; break; }
                case "Virus Identifier":{  hd = 17.42;  mem = 1150;  cpu = 30;  band = 0; break; }
                case "Process Tracer":{  hd = 174.22;  mem = 92000;  cpu = 2400;  band = 0; break; }
                case "Revelation Virus":{  hd = 20000.00;  mem = 600000;  cpu = 10000;  band = 400; break; }
                case "Robber Baron Virus":{  hd = 96000.00;  mem = 300000;  cpu = 7500;  band = 1500; break; }
                case "Robber Baron Anti-Virus":{  hd = 30000.00;  mem = 600000;  cpu = 15000;  band = 0; break; }
                case "Remote Attack Disruptor":{  hd = 174.22;  mem = 92000;  cpu = 2400;  band = 0; break; }
                case "IP Leech":{  hd = 75.00;  mem = 1350;  cpu = 450;  band = 0; break; }
                case "IP Leech Anti-Virus":{  hd = 150.00;  mem = 21600;  cpu = 225;  band = 0; break; }
                case "Remote Virus Injector":{  hd = 4000.00;  mem = 125000;  cpu = 2500;  band = 2; break; }
                case "RV Injector Anti-Virus":{  hd = 4000.00;  mem = 250000;  cpu = 5000;  band = 0; break; }
                case "Overload Signer":{  hd = 174.21;  mem = 92000;  cpu = 2400;  band = 0; break; }
                case "Mutant Revelation Virus":{  hd = 96000.00;  mem = 3000000;  cpu = 50000;  band = 2000; break; }
                case "MutantR Accelerator":{  hd = 174.21;  mem = 92000;  cpu = 2400;  band = 100; break; }
                case "MutantR Decelerator":{  hd = 174.21;  mem = 278000;  cpu = 9600;  band = 0; break; }
                case "MutantR Acc Stopper":{  hd = 174.21;  mem = 46000;  cpu = 1200;  band = 0; break; }
                case "MutantR Dec Stopper":{  hd = 174.21;  mem = 46000;  cpu = 1200;  band = 0; break; }
            }
            band = +band.toFixed(2);
            if (band===0) tds[versionPoint].innerHTML += ("<br/><small class='pi'> "+Math.round(version*cpu*10)+" MHz CPU, "+Math.round(version*mem*10)+" kB RAM</small>");
            else tds[versionPoint].innerHTML += ("<br/><small class='pi'> "+Math.round(version*cpu*10)+" MHz CPU, "+Math.round(version*mem*10)+" kB RAM, "+version*band*10+" kB/s Bandwidth</small>");

            if (filename == "Password Break") {
                var buttonBox = tds[0];
                var buttonBody = buttonBox.getElementsByTagName("tbody")[0];

                var tad1 = document.createElement("td");
                buttonBody.getElementsByTagName("tr")[0].appendChild(tad1);

                var tad2 = document.createElement("td");
                buttonBody.getElementsByTagName("tr")[1].appendChild(tad2);

                var bbutton = document.createElement("a");
                bbutton.innerHTML = "Batch";
                var bhref = buttonBody.getElementsByTagName("a")[0].getAttribute("href");
                var pid = bhref.substring(bhref.indexOf("pid=")+4);
                var rem = 0;
                if (bhref.indexOf("rem=1") > -1) rem = 1;
                var inputBox = document.createElement("input");
                inputBox.setAttribute("type", "number");
                inputBox.style.width = "50px";
                inputBox.id = "mpwb"+pid;
                tad1.appendChild(inputBox);
                bbutton.setAttribute("href", "javascript: runPWB("+pid+", document.getElementById('mpwb"+pid+"').value, "+rem+")");
                tad2.appendChild(bbutton);
            }
        }

    }
}
function removeComma(str) {
    while (str.indexOf(",") > -1) {
        var index = str.indexOf(",");
        var first = str.substring(0, index);
        var last = str.substring(index + 1, str.length);
        str = first + last;
    }
    return str;
}
function addProcs() {
    var toAdd = [];
    var parent = document;
    recurAdd(parent, toAdd);
}
function recurAdd(parent, toAdd) {
    var nextButton;
    var as = parent.getElementsByTagName("a");
    for (var i = 0; i < as.length; i++) if (as[i].childNodes[0].nodeValue == "Next") nextButton = as[i];
    var nBHref = nextButton.href;
    var table = parent.getElementsByName("frm_files")[0].getElementsByTagName("table")[0];
    var numProcs = 0;
    for (var numberOfRows = table.rows.length, i = 3; i<numberOfRows-2; i++) {
        if (parent != document) toAdd.push(table.getElementsByTagName("tr")[i]);
        numProcs++;
    }
    if (numProcs > 0) {
        var nextFrame = parent.createElement("iframe");
        nextFrame.src = nBHref+"&sc=1";
        nextFrame.style.display="none";
        nextFrame.onload = function() {
            recurAdd(nextFrame.contentWindow.document, toAdd);
        };
        parent.body.appendChild(nextFrame);
    }
    else {
        for (var i = 0; i < toAdd.length; i++) {
            var newNode = document.importNode(toAdd[i], true);
            var table = document.getElementsByName("frm_files")[0].getElementsByTagName("table")[0];
            var trs = table.getElementsByTagName("tr");
            var beforeNode;
            for (var l = 0; l < trs.length; l++) if (trs[l].innerHTML.indexOf("Tasks")>-1) beforeNode = trs[l];
            table.getElementsByTagName("tbody")[0].insertBefore(newNode, beforeNode);
        }
    }
}
setup();