Always clone modules before running them via the simplified wrappers.

This prevents changes to the datastore or instance variables from
being carried over into a second run
This commit is contained in:
HD Moore 2012-02-29 01:34:29 -06:00
parent d9788db7bb
commit 9975d5a220
4 changed files with 12 additions and 0 deletions

View File

@ -42,6 +42,9 @@ module Auxiliary
#
def self.run_simple(mod, opts = {})
# Clone the module to prevent changes to the original instance
mod = mod.replicant
# Import options from the OptionStr or Option hash.
mod._import_extra_options(opts)

View File

@ -58,6 +58,9 @@ module Exploit
# Trap and print errors here (makes them UI-independent)
begin
# Clone the module to prevent changes to the original instance
exploit = exploit.replicant
# Import options from the OptionStr or Option hash.
exploit._import_extra_options(opts)

View File

@ -42,6 +42,9 @@ module Payload
#
def self.generate_simple(payload, opts)
# Clone the module to prevent changes to the original instance
payload = payload.replicant
# Import any options we may need
payload._import_extra_options(opts)
framework = payload.framework

View File

@ -38,6 +38,9 @@ module Post
#
def self.run_simple(mod, opts = {})
# Clone the module to prevent changes to the original instance
mod = mod.replicant
# Import options from the OptionStr or Option hash.
mod._import_extra_options(opts)