Merge pull request #21418 from kx7m2qd/fix-get-os-architecture

Fix get_os_architecture for Linux/BSD shell sessions
This commit is contained in:
Spencer McIntyre
2026-05-08 09:33:45 -04:00
committed by GitHub
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -499,7 +499,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rex-arch (0.1.19)
rex-arch (0.1.20)
rex-text
rex-bin_tools (0.1.16)
metasm
+5 -1
View File
@@ -4,6 +4,7 @@ module Msf::Post::Architecture
# Get the architecture of the target's operating system.
# @return [String, Nil] Returns a string containing the target OS architecture if known, or Nil if its not known.
#
def get_os_architecture
if session.type == 'meterpreter'
os_architecture = sysinfo['Architecture']
@@ -31,7 +32,10 @@ module Msf::Post::Architecture
print_error('Target is running Windows on an unsupported architecture!')
return nil
end
when 'linux', 'bsd', 'osx'
uname_m = cmd_exec('uname -m').to_s.strip
Rex::Arch.from_uname(uname_m)
end
end
end
end
end