allow process architecture to be a string (allow more than x86)

bug/bundler_fix
Brent Cook 2016-07-24 22:11:54 -05:00 committed by Brent Cook
parent 952c2f9d1e
commit 9cb4880747
3 changed files with 11 additions and 9 deletions

View File

@ -224,13 +224,15 @@ class Process < Rex::Post::Process
response.each(TLV_TYPE_PROCESS_GROUP) { |p|
arch = ""
pa = p.get_tlv_value( TLV_TYPE_PROCESS_ARCH )
if( pa != nil )
pa = p.get_tlv_value(TLV_TYPE_PROCESS_ARCH)
if !pa.nil?
if pa == 1 # PROCESS_ARCH_X86
arch = ARCH_X86
elsif pa == 2 # PROCESS_ARCH_X64
arch = ARCH_X86_64
end
else
arch = p.get_tlv_value(TLV_TYPE_PROCESS_ARCH_NAME)
end
processes <<

View File

@ -156,6 +156,7 @@ TLV_TYPE_PROCESS_ARGUMENTS = TLV_META_TYPE_STRING | 2305
TLV_TYPE_PROCESS_ARCH = TLV_META_TYPE_UINT | 2306
TLV_TYPE_PARENT_PID = TLV_META_TYPE_UINT | 2307
TLV_TYPE_PROCESS_SESSION = TLV_META_TYPE_UINT | 2308
TLV_TYPE_PROCESS_ARCH_NAME = TLV_META_TYPE_STRING | 2309
TLV_TYPE_IMAGE_FILE = TLV_META_TYPE_STRING | 2400
TLV_TYPE_IMAGE_FILE_PATH = TLV_META_TYPE_STRING | 2401

View File

@ -65,9 +65,9 @@ class Console::CommandDispatcher::Stdapi::Sys
@@ps_opts = Rex::Parser::Arguments.new(
"-S" => [ true, "String to search for (converts to regex)" ],
"-h" => [ false, "Help menu." ],
"-A" => [ true, "Filters processes on architecture (x86 or x86_64)" ],
"-A" => [ true, "Filters processes on architecture" ],
"-s" => [ false, "Show only SYSTEM processes" ],
"-U" => [ true, "Filters processes on the user using the supplied RegEx" ])
"-U" => [ true, "Filters processes on the user using the supplied RegEx"])
#
# Options for the 'suspend' command.
@ -445,8 +445,7 @@ class Console::CommandDispatcher::Stdapi::Sys
searched_procs = Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList.new
processes.each do |proc|
next if proc['arch'].nil? or proc['arch'].empty?
if val.nil? or val.empty? or !(val == "x86" or val == "x86_64")
print_line "You must select either x86 or x86_64"
if val.nil? or val.empty?
return false
end
searched_procs << proc if proc["arch"] == val