From e765af410327ae925c2e01e60371ec0d2fdf251f Mon Sep 17 00:00:00 2001 From: stoiko Date: Thu, 16 Aug 2007 10:51:27 +0000 Subject: [PATCH] added --script-args to the usage-text (nmap.cc) fixed to typos in error messages (nse_nsock.cc) added a short description of --script-args to refguide.xml --- docs/refguide.xml | 29 +++++++++++++++++++++++++++++ nmap.cc | 4 +++- nse_nsock.cc | 4 ++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/docs/refguide.xml b/docs/refguide.xml index 8f0338a98..c9de49185 100644 --- a/docs/refguide.xml +++ b/docs/refguide.xml @@ -1942,6 +1942,35 @@ way. + + + + + + + --script-args + + + lets you provide arguments to NSE-scripts. Arguments are passed as + name=value pairs. The provided argument is processed and stored + inside a lua-table, to which all scripts have access. The names are + taken as strings (which have to be alphanumeric values) and used as + keys inside the argument-table. Values are either strings or tables + themselves (starting with a '{' and ending with a '}'). Subtables make + it possible to override arguments for specific scripts (e.g. when you + want to provide different login/password pairs for different scripts). + An argument of + user=bar,password=foo,anonFTP={password=nobody@foobar.com} + for example results in the following table provided to + NSE-scripts: + t={user="bar",password="foo",anonFTP={password="nobody@foobar.com"}. + Note, that if you want to override an option to a script, you should + index the subtable with the script's id, since this + is the only way the script can "know" about it's special argument. + + + + diff --git a/nmap.cc b/nmap.cc index f22a86bf2..cccdd29f9 100644 --- a/nmap.cc +++ b/nmap.cc @@ -256,7 +256,9 @@ printf("%s %s ( %s )\n" #ifndef NOLUA "SCRIPT SCAN:\n" " -sC: equivalent to --script=safe,intrusive\n" - " --script=: is a comma separated list of dirs or scripts\n" + " --script=: is a comma separated list of \n" + " directories, script-files or script-categories\n" + " --script-args=: provide arguments to scripts\n" " --script-trace: Show all data sent and received\n" " --script-updatedb: Update the script database.\n" #endif diff --git a/nse_nsock.cc b/nse_nsock.cc index 1e1e8fc5d..45fb2581a 100644 --- a/nse_nsock.cc +++ b/nse_nsock.cc @@ -652,7 +652,7 @@ int l_nsock_check_buf(lua_State* l ){ lua_pushvalue(l,2); /*the pattern we are searching for */ if(lua_pcall(l,2,2,0)!=0){ lua_pushboolean(l,false); - lua_pushstring(l,"error in string.find (nsockobj:receive_buf)!"); + lua_pushstring(l,"Error in string.find (nsockobj:receive_buf)!"); return NSOCK_WRAPPER_BUFFER_OK; } }else{ @@ -673,7 +673,7 @@ int l_nsock_check_buf(lua_State* l ){ lua_settop(l,0); /* clear the stack for returning */ if(startpos>endpos){ lua_pushboolean(l,false); - lua_pushstring(l,"delimter has negative size!"); + lua_pushstring(l,"delimiter has negative size!"); return NSOCK_WRAPPER_BUFFER_OK; }else if(startpos==endpos){ /* if the delimter has a size of zero we keep it, since otherwise