batrick
07cfc5aee4
Corrected many #includes for header files (where they are included).
...
Moved the includes for Lua headers to the .cc files so they are
not needlessly, repeatedly included.
Similarly, moved some standard headers to the .cc files and reorganized
includes to be uniform for all nse_* source files.
Fixed whitespace (removed tabs).
2009-03-10 05:56:10 +00:00
david
111146a717
Use script ids instead of full paths in NSE start/finish/error debug output.
2009-02-16 17:40:55 +00:00
david
0b3ff10e1d
Simplify the retrieval of script ids. Make get_id a method of struct
...
thread_record. Pass that directly to ScritpResult::set_id. The function
process_getScriptId is no longer needed.
2009-02-16 17:37:14 +00:00
david
40878cecf9
Change the pattern used to decide which NSE output characters to escape. It was
...
"[^%w%s%p]"; it's now "[^\t\r\n\032-\126]". The old pattern missed the form
feed character, ASCII 12, which is illegal in XML.
2009-02-10 05:57:51 +00:00
david
3c4f855e6d
Print NSE event messages with --script-trace also.
2009-01-07 19:50:25 +00:00
david
37913d1986
Add times to the NSE event messages.
2009-01-07 04:12:00 +00:00
david
13b7a324e8
Include the script file name, target, and port in the debug messages for each
...
script event: start, finish, timeout, and error. The file name is now stored as
a std::string in struct thread_record so we have it when we don't have access
to the thread's environment.
2009-01-07 00:10:10 +00:00
david
57efc72d8d
Reformat script event debugging output slightly. Handle the formatting of the
...
script target in a dedicated function. Print the thread address only at -d2 and
above.
2009-01-06 22:14:10 +00:00
david
5a745de5c7
Put the "SCRIPT ENGINE:" prefix before NSE script start/stop messages.
2009-01-06 21:57:51 +00:00
david
1c936c60cd
Break out NSE event reporting into separate functions. Include the script file
...
name when a script fails without error. In that case we can grab the file name
directly from the thread.
2009-01-06 21:54:59 +00:00
david
a1631b4d6b
Commit Patrick's NSE patch from http://seclists.org/nmap-dev/2008/q4/0750.html . This provides a -d1 message whenever a script begins or ends.
2009-01-06 21:19:32 +00:00
david
dde1d7aac3
Remove a declaration of the function cleanup_threads, which doesn't exist.
2009-01-02 19:32:05 +00:00
david
db9e8e751c
Add some more documentation to process_preparethread to note what's on the
...
thread's stack when it is initialized.
2009-01-02 19:21:27 +00:00
batrick
38394e9f24
Corrected an output line that Ron left in from a patch I gave him.
...
The script's filename cannot be acessed when a thread's target times out
because we do not have access to the thread's environment when it is yielded.
All we can do is print out which target timed out. This output can
unfortunately be printed out many times for each thread (it is currently
difficult to track).
2008-12-24 08:40:03 +00:00
ron
773000b65a
Merging changes from my experimental branch; the new versions of this scripts, which have significant changes to their core functionality, managed to hold their own against Brandon's network. More testing would be very helpful, though, especially with credentials (most of Brandon's scans were anonymous).
2008-12-24 00:53:01 +00:00
david
c561222685
Fix spelling in some identifiers. wierd_responses -> weird_responses,
...
printStatsIfNeccessary -> printStatsIfNecessary.
2008-12-04 17:04:48 +00:00
david
bb8be37ece
Use a longer name (L_script_scan) for the persistent Lua state variable.
2008-11-19 01:51:25 +00:00
david
3dd89201dc
Initialize one global Lua state for running script scans, and reuse it in calls
...
to script_scan. This makes the NSE registry persist though all host groups.
2008-11-19 01:44:09 +00:00
david
f14d86eccb
Rearrange and comment the code that initializes the lists of host and port
...
rules.
2008-11-19 01:14:32 +00:00
batrick
085eecbac7
Removed some old debug code no longer used/needed. Added a new stack dump
...
function that provides a clean output of the stack with positive
and negative stack indices.
2008-11-18 23:24:17 +00:00
david
20cf487b33
Replace the mix of spaces and tabs in the main NSE files with uniform two-space
...
indents, which seems to be the dominant style.
2008-11-18 21:11:27 +00:00
david
5464198f6b
Remove the feature that showed the full path of a script when debugging was 2
...
or higher. Nmap already shows "Will run" messages with the full paths. This is
so that script ids are consistent in XML output.
2008-11-17 21:50:51 +00:00
david
4863d506c1
Remove script ids. Scripts are identified by file name in output (just the
...
basename without ".nse", or the full path with debugging level 2 or higher).
This includes documentation changes in scripting.xml.
2008-11-05 00:52:55 +00:00
batrick
20ff1375d5
Fix for scripts returning multiple results causing the getting of the script's
...
ID to fail.
2008-08-18 00:34:09 +00:00
batrick
35553f80bd
[NSE] Added fix for deadlocks on sockets. Now, 10 or max.parallelism threads
...
can have as many sockets open as they need. Previously, only 10 sockets could
be open.
See: http://seclists.org/nmap-dev/2008/q3/0130.html
2008-07-31 07:35:19 +00:00
batrick
e74d43097d
Fixed some poor grammar in a comment.
2008-07-29 05:12:34 +00:00
batrick
909b47f492
[NSE] Unprintable characters are now printed as "\xXX" where XX is the hexidecimal
...
representation of the character. (See: http://seclists.org/nmap-dev/2008/q3/0180.html )
2008-07-29 03:48:06 +00:00
batrick
5c79c3585a
Removed heap allocation (malloc) of struct run_record and included it
...
in the thread_record structure.
2008-07-07 17:50:47 +00:00
batrick
13452505a5
Added ScriptResult class change in order to avoid managing string memory
...
created via strdup(). Script output and id (strings) are now C++ std::string.
2008-07-07 17:37:08 +00:00
batrick
f9e6d7d01a
Adapted current nse_main to use the new action closure change discussed here:
...
(http://seclists.org/nmap-dev/2008/q2/0549.html ).
2008-07-07 17:34:37 +00:00
batrick
f424fd21b2
Updated some macros to clean up code. Moved
...
porttests and hosttests to Lua's registry where they belong.
2008-07-07 17:33:36 +00:00
batrick
3ae4bcfa9e
Removed nse_string. Equivalent procedures are placed in
...
nse_main and nse_nsock. nse_main now uses Lua to create printable output
while a cleaner hexify procedure has been placed in nsock.
nse_string is removed as a result.
2008-07-07 17:31:38 +00:00
batrick
fa93527653
Changed waiting2running to push threads to the back of running, it
...
caused some nasty bugs when a thread would yield and pop front (a
thread just added).
2008-06-21 18:52:08 +00:00
batrick
f117619044
Added mutex code.
2008-06-20 07:19:37 +00:00
batrick
0564b25559
Added jah's patch to fix Script Database bug: http://seclists.org/nmap-dev/2008/q2/0623.html
2008-06-09 19:46:54 +00:00
kris
743eb48856
o Fixed some memory leaks in NSE found with Valgrind. [Kris]
2008-06-09 16:54:08 +00:00
batrick
d0bc640db8
Large recode of nse_init.cc
...
Now does most of it's work through Lua:
From Nmap-dev: "Many of the changes consist of changing how Nmap interfaces
with Lua that were sometimes awkward or inflexible. Most of the functions
have been made to be callable directly by Lua which offers many technical
advantages: stack management is alleviated, errors are handled cleanly and
are more descriptive, and there is increased reusability."
Additionally:
-- Moved all lua_State * symbols from "l" to "L". This is to maintain
consistency with other Lua libraries (convention) and to make our macros portable.
-- Moved file system manipulation over to nse_fs.cc (from nse_init.cc)
2008-05-31 02:39:27 +00:00
batrick
742ff67100
Removed nse_auxiliar. Updated Script Argument parsing. Fixed typos in
...
documentation. Improved MySQLinfo.nse. Nsock/dnet metatabels are now
protected.
2008-05-31 02:19:24 +00:00
kris
44a4cb90e6
Fixing the assertion failure: "Target.cc:396: void Target::stopTimeOutClock(const timeval*): Assertion 'htn.toclock_running == true' failed." This was caused when a target had scripts in multiple run levels. The problem was the time-out clocks added for --host-timeout support in NSE (r6657--appears to be present since 4.52). Now the time-out clocks are started before each runlevel execution, which (besides not failing assert) makes more sense because the timer would have been counting even when the target had no scripts in the current runlevel.
2008-04-16 17:56:48 +00:00
kris
fa9bd6be6e
Allow unfiltered ports to be selected in NSE
2008-04-09 01:54:14 +00:00
fyodor
d3d97d934b
print host name and IP in a script engine status message, rather than just hostname (which Nmap sometimes does not know). Patch from Jah
2008-04-05 23:52:41 +00:00
majek04
caf8008940
Previously, process_mainloop() assumed that there can occur only one event for l_nsock_loop(). This is obviously wrong. This caused that some lua threads wakeups (when multiple events happend for one nsock_loop) were delayed. They were handled but way after real events happened. This patch changes the handing of events. Now we execute every lua thread which is in running_scripts(). I hope that every thread will be scheduled in nsock and removed from running_scripts and added to waiting_scripts.
2008-02-27 00:56:19 +00:00
doug
da39aace20
NSE run-time interaction support
2007-12-30 03:26:43 +00:00
doug
4a2ca9b350
NSE --host-timeout support
2007-12-30 03:17:57 +00:00
fyodor
09512ff092
o Fix a bunch of warning/error messages which contained an extra
...
newline. Thanks to Brandon Enright for the patch.
2007-12-21 03:38:04 +00:00
kris
6d09f60956
From r6465, pass 0 as the third arg of lua_gc() instead of NULL. gcc gave me a warning because the argument is an int and not a pointer. I grepped in liblua/ and saw usage in there using 0 as well.
2007-12-09 00:50:33 +00:00
stoiko
c30adcd5bf
perform lua-garbage collection everytime a script finishes excecution
...
(should solve the endless loops of NSE)
2007-12-08 17:23:38 +00:00
stoiko
91e7ed8aa6
a quick hack to the scheduling algorithm of scripts, which allows scripts to
...
finish execution earlier (and thus close the sockets earlier)
2007-08-30 18:35:32 +00:00
stoiko
4767dd8c70
script arguments now get checked before nmap starts scanning
2007-08-20 21:56:36 +00:00
fyodor
d7f207450c
merge soc07 r5279 - nse fixes
2007-08-11 06:03:25 +00:00