Skip to content

Commit 717879f

Browse files
committed
Downcase targets and current proc name
1 parent 8e8e724 commit 717879f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

modules/post/windows/manage/priv_migrate.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def initialize(info={})
4646
def run
4747
# Get current process information
4848
@original_pid = client.sys.process.open.pid
49-
@original_name = client.sys.process.open.name
49+
@original_name = client.sys.process.open.name.downcase
5050
print_status("Current session process is #{@original_name} (#{@original_pid}) as: #{client.sys.config.getuid}")
5151
unless migrate_admin
5252
if is_admin? && !datastore['NOFAIL']
@@ -66,7 +66,7 @@ def run
6666
def get_pid(proc_name)
6767
processes = client.sys.process.get_processes
6868
processes.each do |proc|
69-
if proc['name'] == proc_name && proc['user'] != ""
69+
if proc['name'].downcase == proc_name && proc['user'] != ""
7070
return proc['pid']
7171
end
7272
end
@@ -127,9 +127,10 @@ def migrate(target_pid, proc_name, current_pid)
127127
# @return [FalseClass] if it failed to migrate
128128
def migrate_admin
129129
if is_admin?
130-
# Populate target array
130+
# Populate target array and Downcase all Targets
131131
admin_targets = DEFAULT_ADMIN_TARGETS.dup
132132
admin_targets.unshift(datastore['ANAME']) if datastore['ANAME']
133+
admin_targets.map!(&:downcase)
133134

134135
if is_system?
135136
print_status("Session is already Admin and System.")
@@ -157,9 +158,11 @@ def migrate_admin
157158
# @return [TrueClass] if it successfully migrated
158159
# @return [FalseClass] if it failed to migrate
159160
def migrate_user
160-
# Populate Target Array
161+
# Populate Target Array and Downcase all Targets
161162
user_targets = DEFAULT_USER_TARGETS.dup
162163
user_targets.unshift(datastore['NAME']) if datastore['NAME']
164+
user_targets.map!(&:downcase)
165+
163166
print_status("Will attempt to migrate to a User level process.")
164167

165168
# Try to migrate to user level processes in the list. If it does not exist or cannot migrate, try spawning it then migrating.

0 commit comments

Comments
 (0)