Skip to content

Commit 9cb4880

Browse files
busterbBrent Cook
authored andcommitted
allow process architecture to be a string (allow more than x86)
1 parent 952c2f9 commit 9cb4880

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,15 @@ def Process.get_processes
224224
response.each(TLV_TYPE_PROCESS_GROUP) { |p|
225225
arch = ""
226226

227-
pa = p.get_tlv_value( TLV_TYPE_PROCESS_ARCH )
228-
if( pa != nil )
227+
pa = p.get_tlv_value(TLV_TYPE_PROCESS_ARCH)
228+
if !pa.nil?
229229
if pa == 1 # PROCESS_ARCH_X86
230230
arch = ARCH_X86
231231
elsif pa == 2 # PROCESS_ARCH_X64
232232
arch = ARCH_X86_64
233233
end
234+
else
235+
arch = p.get_tlv_value(TLV_TYPE_PROCESS_ARCH_NAME)
234236
end
235237

236238
processes <<

lib/rex/post/meterpreter/extensions/stdapi/tlv.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ module Stdapi
156156
TLV_TYPE_PROCESS_ARCH = TLV_META_TYPE_UINT | 2306
157157
TLV_TYPE_PARENT_PID = TLV_META_TYPE_UINT | 2307
158158
TLV_TYPE_PROCESS_SESSION = TLV_META_TYPE_UINT | 2308
159+
TLV_TYPE_PROCESS_ARCH_NAME = TLV_META_TYPE_STRING | 2309
159160

160161
TLV_TYPE_IMAGE_FILE = TLV_META_TYPE_STRING | 2400
161162
TLV_TYPE_IMAGE_FILE_PATH = TLV_META_TYPE_STRING | 2401

lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ class Console::CommandDispatcher::Stdapi::Sys
6363
# Options for the 'ps' command.
6464
#
6565
@@ps_opts = Rex::Parser::Arguments.new(
66-
"-S" => [ true, "String to search for (converts to regex)" ],
67-
"-h" => [ false, "Help menu." ],
68-
"-A" => [ true, "Filters processes on architecture (x86 or x86_64)" ],
69-
"-s" => [ false, "Show only SYSTEM processes" ],
70-
"-U" => [ true, "Filters processes on the user using the supplied RegEx" ])
66+
"-S" => [ true, "String to search for (converts to regex)" ],
67+
"-h" => [ false, "Help menu." ],
68+
"-A" => [ true, "Filters processes on architecture" ],
69+
"-s" => [ false, "Show only SYSTEM processes" ],
70+
"-U" => [ true, "Filters processes on the user using the supplied RegEx"])
7171

7272
#
7373
# Options for the 'suspend' command.
@@ -445,8 +445,7 @@ def cmd_ps(*args)
445445
searched_procs = Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList.new
446446
processes.each do |proc|
447447
next if proc['arch'].nil? or proc['arch'].empty?
448-
if val.nil? or val.empty? or !(val == "x86" or val == "x86_64")
449-
print_line "You must select either x86 or x86_64"
448+
if val.nil? or val.empty?
450449
return false
451450
end
452451
searched_procs << proc if proc["arch"] == val

0 commit comments

Comments
 (0)