Overview of nmap.inc

Public Function Summary

Public functions are intended to be called by the code that imports this library.

Name Summary
nmap_nse_get_results
nmap_nse_register

Public Function Details

nmap_nse_get_results

Named Parameters

script

Code

function nmap_nse_get_results(script) {
    res = make_array();

    # Gather portscript results
    ports = get_kb_list("NmapNSE/results/" + script);
    if (!isnull(ports)) {
        foreach port (ports) {
            output = get_kb_item("NmapNSE/results/" + script + "/" + port);
            if (!isnull(output)) {
                res[port] = output;
            }
        }
    }

    # Gather hostscript results
    output = get_kb_item("NmapNSE/results/hostscripts/" + script);
    if (!isnull(output)) {
        # port 0 is used as "general/tcp"
        res[0] = output;
    }

    return res;
}



		
top

nmap_nse_register

Named Parameters

args
ports
script

Code

function nmap_nse_register(script, args, ports) {
    set_kb_item(name:"NmapNSE/scripts", value:script);
    set_kb_item(name:"NmapNSE/registered/" + script, value:"1");
    if (!isnull(args)) {
        foreach argname (keys(args)) {
            set_kb_item(name:"NmapNSE/arguments", value:argname + "=" + args[argname]);
        }
    }
    if (!isnull(ports)) {
        set_kb_item(name:"NmapNSE/ports", value:ports);
    }
}

function nmap_nse_get_results(script) {

		
top