Nmap Development mailing list archives

[NSE][PATCH] initialize NSE sockets based on timing_level


From: Sven Klemm <sven () c3d2 de>
Date: Wed, 17 Sep 2008 10:28:46 +0200

Hi everyone,

currently all NSE sockets get initialized with a 30 second timeout. A lot of scripts override this with a static value while the DNS and HTTP library override based on nmap.timing_level(). The attached patch initializes all NSE sockets with a value based on nmap.timing_level().
The values used are 60s,30s,15s,10s,5s,3s.

Cheers,
Sven

--
Sven Klemm
http://cthulhu.c3d2.de/~sven/

Index: nse_nsock.cc
===================================================================
--- nse_nsock.cc        (revision 10218)
+++ nse_nsock.cc        (working copy)
@@ -32,8 +32,6 @@
 #define FROM   1
 #define TO     2
 
-#define DEFAULT_TIMEOUT 30000
-
 extern NmapOps o;
 
 // defined in nse_main.cc but also declared here
@@ -390,7 +388,7 @@
     lua_setmetatable(L, -2);
        udata->nsiod = NULL;
        udata->ssl_session = NULL;
-       udata->timeout = DEFAULT_TIMEOUT;
+       udata->timeout = ((int[]){60000,30000,15000,10000,5000,3000})[o.timing_level % 6];
        udata->bufidx = LUA_NOREF;
        udata->bufused= 0;
        udata->ncap_socket      = NULL;

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

Current thread: