Move the binary suffix stuff to a better location
parent
786600bd09
commit
ca377cadd7
|
@ -457,11 +457,6 @@ class Meterpreter < Rex::Post::Meterpreter::Client
|
|||
|
||||
sock = net.socket.create(param)
|
||||
|
||||
# sf: unsure if we should raise an exception or just return nil. returning nil for now.
|
||||
#if( sock == nil )
|
||||
# raise Rex::UnsupportedProtocol.new(param.proto), caller
|
||||
#end
|
||||
|
||||
# Notify now that we've created the socket
|
||||
notify_socket_created(self, sock, param)
|
||||
|
||||
|
@ -473,22 +468,40 @@ class Meterpreter < Rex::Post::Meterpreter::Client
|
|||
# Get a string representation of the current session platform
|
||||
#
|
||||
def platform
|
||||
# TODO: talk about this with the devs because we seem to rely on this
|
||||
# value when populating the DB before the session is even fully established.
|
||||
if self.payload_uuid
|
||||
# return the actual platform of the current session if it's there
|
||||
self.payload_uuid.to_platform
|
||||
else
|
||||
# otherwise just use the base for the session type tied to this handler
|
||||
# otherwise just use the base for the session type tied to this handler.
|
||||
# If we don't do this, storage of sessions in the DB dies
|
||||
self.base_platform
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Get the value to use for file suffixes based on the platform
|
||||
# Generate a binary suffix based on arch
|
||||
#
|
||||
def binary_suffix
|
||||
self.payload_uuid.binary_suffix
|
||||
# generate a file/binary suffix based on the current platform
|
||||
case self.payload_uuid.platform
|
||||
when 'windows'
|
||||
# with windows, we also need to care about arch
|
||||
if self.payload_uuid.arch == ARCH_X86
|
||||
'x86.dll'
|
||||
else
|
||||
'x64.dll'
|
||||
end
|
||||
when 'android', 'java'
|
||||
'jar'
|
||||
when 'linux' , 'aix' , 'hpux' , 'irix' , 'unix'
|
||||
'lso'
|
||||
when 'php'
|
||||
'php'
|
||||
when 'python'
|
||||
'py'
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
# This is the base platform for the original payload, required for when the
|
||||
|
|
|
@ -19,8 +19,7 @@ class Meterpreter_armle_Linux < Msf::Sessions::Meterpreter
|
|||
end
|
||||
def initialize(rstream, opts={})
|
||||
super
|
||||
self.platform = 'armle/linux'
|
||||
self.binary_suffix = 'lso'
|
||||
self.platform = 'armle/linux'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -19,8 +19,7 @@ class Meterpreter_mipsle_Linux < Msf::Sessions::Meterpreter
|
|||
end
|
||||
def initialize(rstream, opts={})
|
||||
super
|
||||
self.platform = 'mipsle/linux'
|
||||
self.binary_suffix = 'lso'
|
||||
self.platform = 'mipsle/linux'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -311,33 +311,6 @@ class Msf::Payload::UUID
|
|||
"#{arch}/#{self.platform}"
|
||||
end
|
||||
|
||||
#
|
||||
# TODO: Not sure if this is the best place for this to go. Open to
|
||||
# suggestions for moving it elsewhere
|
||||
#
|
||||
def binary_suffix
|
||||
# generate a file/binary suffix based on the current platform
|
||||
case self.platform
|
||||
when 'windows'
|
||||
# with windows, we also need to care about arch
|
||||
if self.arch == ARCH_X86
|
||||
'x86.dll'
|
||||
else
|
||||
'x64.dll'
|
||||
end
|
||||
when 'android', 'java'
|
||||
'jar'
|
||||
when 'linux' , 'aix' , 'hpux' , 'irix' , 'unix'
|
||||
'lso'
|
||||
when 'php'
|
||||
'php'
|
||||
when 'python'
|
||||
'py'
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Provides a hash representation of a UUID
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue