1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00
Commit Graph

93 Commits

Author SHA1 Message Date
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
fyodor
f025e86b0b merge soc07 r5085:5094 - removed a period which could lead to slightly confusing output such as 'Read data files from: ..' when they are read from the current directory; Always print a message when the script database is updated successfully; Added a whole bunch of entries to the CHANGELOG in preparation for the first soc07 release; latest auto-generated files; add a question mark to a textual question 2007-08-11 05:14:52 +00:00
fyodor
a09a6e2007 merge soc07 r4994:5001 - Adding <portused> element for the open TCP port used when performing OS Detection. Only closed TCP and UDP were being printed; I guess it was just an oversight; Call endTask() in process_mainloop() in nse_main.cc so task ending information (like the <taskend> element) are printed; old_locale is allocated on the STACK not the HEAP; NULL is NOT a valid PCRE pointer. 2007-08-11 04:42:31 +00:00
fyodor
65e680a634 merge soc07 r4939 - fixed a small bug in formatscriptoutput (output.cc) which caused a core dump 2007-08-11 04:25:05 +00:00
fyodor
58522c59f6 merge soc07 r4822 - Reduce the number of build dependencies. 2007-08-11 03:35:46 +00:00
fyodor
cb8101dbcc merge soc07 r4821 - fix nse build system issues 2007-08-11 03:35:12 +00:00
fyodor
b361685be8 NSE committed 2006-12-11 00:34:26 +00:00