1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-04 13:49:03 +00:00

Sort script names and categories when writing them to script.db.

This commit is contained in:
david
2009-04-24 18:44:12 +00:00
parent 8e09b0362e
commit 071046e385

View File

@@ -324,7 +324,9 @@ int script_updatedb (void)
"local db = assert(open(path..'script.db', 'w'),\n"
" 'could not open database for writing')\n"
/* dump the scripts/categories */
"for i, script in ipairs(nse.dump_dir(path)) do\n"
"local scripts = nse.dump_dir(path)\n"
"table.sort(scripts)\n"
"for i, script in ipairs(scripts) do\n"
" local env = setmetatable({}, {__index = _G})\n"
" local thread = create(setfenv(assert(loadfile(script)), env))\n"
" assert(resume(thread))\n"
@@ -332,6 +334,7 @@ int script_updatedb (void)
" assert(type(categories) == 'table', script.."
" ' categories field is not a table')\n"
" local basename = assert(match(script, '([^\\/]-%.nse)$'))\n"
" table.sort(categories)\n"
" for j, category in ipairs(categories) do\n"
" db:write('Entry { category = \"', lower(category),"
" '\", filename = \"', basename, '\" }\\n')\n"