mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
o [NSE] Added stop function to crawler so that scripts can properly shutdown
the crawler in case they want to end early. [Patrik]
This commit is contained in:
parent
3e8440f5f6
commit
74b53a6a14
2 changed files with 19 additions and 0 deletions
|
|
@ -1,5 +1,8 @@
|
|||
# Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o [NSE] Added stop function to crawler so that scripts can properly shutdown
|
||||
the crawler in case they want to end early. [Patrik]
|
||||
|
||||
o [NSE] Fixed issue in path encoding in the http-backup-finder script. [Patrik]
|
||||
|
||||
o [NSE] Added the script http-backup-finder that searches for backup copies
|
||||
|
|
|
|||
|
|
@ -561,6 +561,12 @@ Crawler = {
|
|||
end
|
||||
|
||||
while(true) do
|
||||
|
||||
if ( self.quit ) then
|
||||
table.insert(response_queue, {false, { err = false, msg = "Quit signalled by crawler" } })
|
||||
break
|
||||
end
|
||||
|
||||
-- in case the user set a max page count to retrieve check how many
|
||||
-- pages we have retrieved so far
|
||||
local count = self:getPageCount()
|
||||
|
|
@ -607,6 +613,7 @@ Crawler = {
|
|||
end
|
||||
condvar "signal"
|
||||
end
|
||||
condvar "signal"
|
||||
end,
|
||||
|
||||
-- Loads the argument set on a script level
|
||||
|
|
@ -690,5 +697,14 @@ Crawler = {
|
|||
end
|
||||
end,
|
||||
|
||||
-- signals the crawler to stop
|
||||
stop = function(self)
|
||||
local condvar = nmap.condvar(self.response_queue)
|
||||
self.quit = true
|
||||
condvar "signal"
|
||||
condvar "wait"
|
||||
end
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue