Skip to content

Commit 9268f66

Browse files
author
Brent Cook
committed
auto-set the meterpreter platform based on the sysinfo os
1 parent 805f98f commit 9268f66

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/msf/base/sessions/meterpreter.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,20 @@ def update_session_info
323323
username = self.sys.config.getuid
324324
sysinfo = self.sys.config.sysinfo
325325

326+
self.platform = self.platform.split('/')[0] + '/' +
327+
case self.sys.config.sysinfo['OS']
328+
when /windows/i
329+
Msf::Module::Platform::Windows
330+
when /darwin/i
331+
Msf::Module::Platform::OSX
332+
when /freebsd/i
333+
Msf::Module::Platform::FreeBSD
334+
when /openbsd/i, /netbsd/i
335+
Msf::Module::Platform::BSD
336+
else
337+
Msf::Module::Platform::Linux
338+
end.realname.downcase
339+
326340
safe_info = "#{username} @ #{sysinfo['Computer']}"
327341
safe_info.force_encoding("ASCII-8BIT") if safe_info.respond_to?(:force_encoding)
328342
# Should probably be using Rex::Text.ascii_safe_hex but leave

0 commit comments

Comments
 (0)