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

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
This commit is contained in:
stoiko
2007-08-16 10:51:27 +00:00
parent d073a19105
commit e765af4103
3 changed files with 34 additions and 3 deletions

View File

@@ -1942,6 +1942,35 @@ way.</para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--script-args=&lt;name1=value1,name2={name3=value3},name4=value4&gt;</option></term>
<listitem>
<indexterm>
<primary>--script-args</primary>
</indexterm>
<para>
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
<literal>user=bar,password=foo,anonFTP={password=nobody@foobar.com}
</literal> for example results in the following table provided to
NSE-scripts:
<literal>t={user="bar",password="foo",anonFTP={password="nobody@foobar.com"}</literal>.
Note, that if you want to override an option to a script, you should
index the subtable with the script's <literal>id</literal>, since this
is the only way the script can "know" about it's special argument.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--script-trace</option></term>

View File

@@ -256,7 +256,9 @@ printf("%s %s ( %s )\n"
#ifndef NOLUA
"SCRIPT SCAN:\n"
" -sC: equivalent to --script=safe,intrusive\n"
" --script=<lua scripts>: <lua scripts> is a comma separated list of dirs or scripts\n"
" --script=<lua scripts>: <lua scripts> is a comma separated list of \n"
" directories, script-files or script-categories\n"
" --script-args=<n1=v1,[n2=v2,[n3=v3]]>: provide arguments to scripts\n"
" --script-trace: Show all data sent and received\n"
" --script-updatedb: Update the script database.\n"
#endif

View File

@@ -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