mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
Sort script names and categories when writing them to script.db.
This commit is contained in:
parent
8e09b0362e
commit
071046e385
1 changed files with 4 additions and 1 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue