Nmap Development mailing list archives

Re: [NSE] Dependencies not working


From: Patrick Donnelly <batrick () batbytes com>
Date: Mon, 13 Dec 2010 08:25:35 -0500

On Sun, Dec 12, 2010 at 10:17 PM, Ron <ron () skullsecurity net> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,

In the current HEAD version (and I'm not sure how far back), it looks like script dependencies aren't working. 
Scripts are put in the right order, and it goes through the runlevels in the right order, but the runlevels end and 
the new ones start before the scripts have a chance to finish.

I believe this patch fixes the problem:

batrick@batbytes:~/nmap/svn/nmap$ svn diff
Index: nse_main.lua
===================================================================
--- nse_main.lua        (revision 21299)
+++ nse_main.lua        (working copy)
@@ -962,12 +962,11 @@
     end);
   end

-  -- This iterator is passed to the run function. It returns one new script
-  -- thread on demand until exhausted.
-  local function threads_iter ()
-    -- activate prerule scripts
-    for runlevel, scripts in ipairs(runlevels) do
-      print_verbose(1, "Starting runlevel %u (of %u) scan.",
runlevel, #runlevels);
+  for runlevel, scripts in ipairs(runlevels) do
+    -- This iterator is passed to the run function. It returns one new script
+    -- thread on demand until exhausted.
+    local function threads_iter ()
+      -- activate prerule scripts
       if (scantype == NSE_PRE_SCAN) then
         print_verbose(1, "Script Pre-scanning.");
         for script in runlevel_scripts(scripts) do
@@ -1017,10 +1016,10 @@
         end
       end
     end
+    print_verbose(1, "Starting runlevel %u (of %u) scan.", runlevel,
#runlevels);
+    run(wrap(threads_iter), scantype)
   end

-  run(wrap(threads_iter), scantype)
-
   collectgarbage "collect";
 end



-- 
- Patrick Donnelly
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: