From e41406d478a0753517b59c7b45d901507e4006b3 Mon Sep 17 00:00:00 2001 From: adfoster-r7 Date: Wed, 11 Aug 2021 15:42:27 +0100 Subject: [PATCH] Patch meterpreter scripts to work again --- lib/rex/script/meterpreter.rb | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/rex/script/meterpreter.rb b/lib/rex/script/meterpreter.rb index 092c4d433c..c6f57df95d 100644 --- a/lib/rex/script/meterpreter.rb +++ b/lib/rex/script/meterpreter.rb @@ -4,17 +4,24 @@ module Rex module Script class Meterpreter < Base -begin - include Msf::Post::Windows::Priv - include Msf::Post::Windows::Eventlog - include Msf::Post::Common - include Msf::Post::Windows::Registry - include Msf::Post::File - include Msf::Post::Windows::Services - include Msf::Post::Windows::Accounts -rescue ::LoadError -end + begin + include Msf::Post::Windows::Priv + include Msf::Post::Windows::Eventlog + include Msf::Post::Common + include Msf::Post::Windows::Registry + include Msf::Post::File + include Msf::Post::Windows::Services + include Msf::Post::Windows::Accounts + rescue ::LoadError + end + def initialize(client, path) + # The mixins for `Msf::Post::*` now assume a single info argument is present, + # whilst `::Rex::Script::Base` assumes client and path are provided. Directly call + # the `::Rex::Script::Base` initialize method for now. In the future Rex scripts + # will need to be migrated to use post modules + ::Rex::Script::Base.instance_method(:initialize).bind(self).call(client, path) + end end end end