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

@ -225,12 +225,14 @@ class Process < Rex::Post::Process
arch = "" arch = ""
pa = p.get_tlv_value(TLV_TYPE_PROCESS_ARCH) pa = p.get_tlv_value(TLV_TYPE_PROCESS_ARCH)
if( pa != nil ) if !pa.nil?
if pa == 1 # PROCESS_ARCH_X86 if pa == 1 # PROCESS_ARCH_X86
arch = ARCH_X86 arch = ARCH_X86
elsif pa == 2 # PROCESS_ARCH_X64 elsif pa == 2 # PROCESS_ARCH_X64
arch = ARCH_X86_64 arch = ARCH_X86_64
end end
else
arch = p.get_tlv_value(TLV_TYPE_PROCESS_ARCH_NAME)
end end
processes << 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_PROCESS_ARCH = TLV_META_TYPE_UINT | 2306
TLV_TYPE_PARENT_PID = TLV_META_TYPE_UINT | 2307 TLV_TYPE_PARENT_PID = TLV_META_TYPE_UINT | 2307
TLV_TYPE_PROCESS_SESSION = TLV_META_TYPE_UINT | 2308 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 = TLV_META_TYPE_STRING | 2400
TLV_TYPE_IMAGE_FILE_PATH = TLV_META_TYPE_STRING | 2401 TLV_TYPE_IMAGE_FILE_PATH = TLV_META_TYPE_STRING | 2401

View File

@ -65,7 +65,7 @@ class Console::CommandDispatcher::Stdapi::Sys
@@ps_opts = Rex::Parser::Arguments.new( @@ps_opts = Rex::Parser::Arguments.new(
"-S" => [ true, "String to search for (converts to regex)" ], "-S" => [ true, "String to search for (converts to regex)" ],
"-h" => [ false, "Help menu." ], "-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" ], "-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"])
@ -445,8 +445,7 @@ class Console::CommandDispatcher::Stdapi::Sys
searched_procs = Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList.new searched_procs = Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList.new
processes.each do |proc| processes.each do |proc|
next if proc['arch'].nil? or proc['arch'].empty? next if proc['arch'].nil? or proc['arch'].empty?
if val.nil? or val.empty? or !(val == "x86" or val == "x86_64") if val.nil? or val.empty?
print_line "You must select either x86 or x86_64"
return false return false
end end
searched_procs << proc if proc["arch"] == val searched_procs << proc if proc["arch"] == val