Skip to content

Commit cfca189

Browse files
committed
Land rapid7#7702, persistence script platform fix
2 parents f0dca7a + 462e91e commit cfca189

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/meterpreter/persistence.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"-T" => [ true, "Alternate executable template to use"],
4141
"-P" => [ true, "Payload to use, default is windows/meterpreter/reverse_tcp."]
4242
)
43-
meter_type = client.platform
4443

4544
################## Function Declarations ##################
4645

@@ -54,7 +53,7 @@ def usage
5453

5554
# Wrong Meterpreter Version Message Function
5655
#-------------------------------------------------------------------------------
57-
def wrong_meter_version(meter = meter_type)
56+
def wrong_meter_version(meter)
5857
print_error("#{meter} version of Meterpreter is not supported with this Script!")
5958
raise Rex::Script::Completed
6059
end
@@ -227,7 +226,10 @@ def install_as_service(script_on_target)
227226
}
228227

229228
# Check for Version of Meterpreter
230-
wrong_meter_version(meter_type) if meter_type !~ /win32|win64/i
229+
unless client.platform == 'windows' && [ARCH_X86, ARCH_X64].include?(client.arch)
230+
wrong_meter_version(client.session_type)
231+
end
232+
231233
print_status("Running Persistence Script")
232234
# Create undo script
233235
@clean_up_rc = log_file()

0 commit comments

Comments
 (0)