Skip to content

Commit 60111ad

Browse files
committed
Land #2, OSX support tweaks and improvements to extension suffix handling.
2 parents 48975a4 + ce9d2af commit 60111ad

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

lib/msf/base/sessions/meterpreter.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ def binary_suffix
647647
["#{self.arch}.dll"]
648648
when 'linux' , 'aix' , 'hpux' , 'irix' , 'unix'
649649
['bin', 'elf']
650+
when 'osx'
651+
['elf']
650652
when 'android', 'java'
651653
['jar']
652654
when 'php'

lib/rex/post/meterpreter/client_core.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,17 @@ def load_library(opts)
249249
# path of the local and target so that it gets loaded with a random
250250
# name
251251
if opts['Extension']
252-
if client.binary_suffix.size > 1
252+
if client.binary_suffix and client.binary_suffix.size > 1
253253
m = /(.*)\.(.*)/.match(library_path)
254254
suffix = $2
255+
elsif client.binary_suffix.size == 1
256+
suffix = client.binary_suffix[0]
255257
else
256258
suffix = client.binary_suffix
257259
end
258260

259261
library_path = "ext#{rand(1000000)}.#{suffix}"
260-
target_path = library_path
262+
target_path = "/tmp/#{library_path}"
261263
end
262264
end
263265

@@ -305,7 +307,9 @@ def use(mod, opts = { })
305307

306308
modnameprovided = mod
307309
suffix = nil
308-
if client.binary_suffix.size > 1
310+
if not client.binary_suffix
311+
suffix = ''
312+
elsif client.binary_suffix.size > 1
309313
client.binary_suffix.each { |s|
310314
if (mod =~ /(.*)\.#{s}/ )
311315
mod = $1

lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ def cmd_load(*args)
11781178
md = m.downcase
11791179
modulenameprovided = md
11801180

1181-
if client.binary_suffix.size > 1
1181+
if client.binary_suffix and client.binary_suffix.size > 1
11821182
client.binary_suffix.each { |s|
11831183
if (md =~ /(.*)\.#{s}/ )
11841184
md = $1

0 commit comments

Comments
 (0)