Adds timed module support, fixes #97
git-svn-id: file:///home/svn/framework3/trunk@4857 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
56b74bb586
commit
4b42797768
|
@ -18,6 +18,7 @@ class Auxiliary < Msf::Module
|
||||||
require 'msf/core/auxiliary/scanner'
|
require 'msf/core/auxiliary/scanner'
|
||||||
require 'msf/core/auxiliary/report'
|
require 'msf/core/auxiliary/report'
|
||||||
require 'msf/core/auxiliary/dos'
|
require 'msf/core/auxiliary/dos'
|
||||||
|
require 'msf/core/auxiliary/timed'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns MODULE_AUX to indicate that this is an auxiliary module.
|
# Returns MODULE_AUX to indicate that this is an auxiliary module.
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
module Msf
|
||||||
|
|
||||||
|
###
|
||||||
|
#
|
||||||
|
# This module provides methods for time-limited modules
|
||||||
|
#
|
||||||
|
###
|
||||||
|
|
||||||
|
module Auxiliary::Timed
|
||||||
|
|
||||||
|
require 'timeout'
|
||||||
|
|
||||||
|
#
|
||||||
|
# Initializes an instance of a timed module
|
||||||
|
#
|
||||||
|
def initialize(info = {})
|
||||||
|
super
|
||||||
|
|
||||||
|
register_options(
|
||||||
|
[
|
||||||
|
OptInt.new('RUNTIME', [ true, "The number of seconds to run the test", 5 ] )
|
||||||
|
], Auxiliary::Timed)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# The command handler when launched from the console
|
||||||
|
#
|
||||||
|
def run
|
||||||
|
secs = datastore['RUNTIME']
|
||||||
|
print_status("Running module for #{secs} seconds...")
|
||||||
|
begin
|
||||||
|
timeout(secs) { self.run_timed }
|
||||||
|
rescue Timeout::Error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue