1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Include the "scripts" and "nselib" directory paths in XML --script-help

output.
This commit is contained in:
david
2011-01-28 04:15:21 +00:00
parent 31d164ccf5
commit 5fa2e66900
2 changed files with 17 additions and 1 deletions

View File

@@ -1,7 +1,11 @@
<!-- DTD for Nmap XML -&#45;script-help output.
nmap -&#45;script-help "<rules>" -oX - -->
<!ELEMENT nse-scripts (script*)>
<!ELEMENT nse-scripts (directory*, script*)>
<!ELEMENT directory EMPTY>
<!ATTLIST directory name (scripts|nselib) #REQUIRED path CDATA #REQUIRED>
<!ELEMENT script (categories?, description?)>

View File

@@ -850,6 +850,18 @@ local function script_help_xml(chosen_scripts)
cnse.xml_start_tag("nse-scripts");
cnse.xml_newline();
local t, scripts_dir, nselib_dir
t, scripts_dir = cnse.fetchfile_absolute("scripts/")
assert(t == 'directory', 'could not locate scripts directory');
t, nselib_dir = cnse.fetchfile_absolute("nselib/")
assert(t == 'directory', 'could not locate nselib directory');
cnse.xml_start_tag("directory", { name = "scripts", path = scripts_dir });
cnse.xml_end_tag();
cnse.xml_newline();
cnse.xml_start_tag("directory", { name = "nselib", path = nselib_dir });
cnse.xml_end_tag();
cnse.xml_newline();
for i, script in ipairs(chosen_scripts) do
cnse.xml_start_tag("script", { filename = script.filename });
cnse.xml_newline();