2006-09-19 03:15:25 +00:00
|
|
|
#
|
|
|
|
# Simple example script that migrates to a specific process by name.
|
|
|
|
# This is meant as an illustration.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Get the target process name
|
2008-11-08 19:39:06 +00:00
|
|
|
if (args)
|
|
|
|
target = args[0]
|
|
|
|
else
|
|
|
|
target = "lsass.exe"
|
|
|
|
end
|
2006-09-19 03:15:25 +00:00
|
|
|
|
|
|
|
print_status("Migrating to #{target}...")
|
|
|
|
|
|
|
|
server = client.sys.process.open
|
|
|
|
|
|
|
|
print_status("Current server process: #{server.name} (#{server.pid})")
|
|
|
|
|
|
|
|
# Get the target process pid
|
|
|
|
target_pid = client.sys.process[target]
|
|
|
|
|
|
|
|
if target_pid.nil?
|
|
|
|
raise ArgumentError, "Could not find target process: #{target}"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Do the migration
|
|
|
|
client.core.migrate(target_pid)
|
|
|
|
|
|
|
|
server = client.sys.process.open
|
|
|
|
|
2008-11-04 06:57:26 +00:00
|
|
|
print_status("New server process: #{server.name} (#{server.pid})")
|