ensure cleanup commands only get invoked once

GSoC/Meterpreter_Web_Console
Brent Cook 2018-01-10 03:42:39 -05:00
parent 7a95024062
commit b20666656f
1 changed files with 8 additions and 2 deletions

View File

@ -165,9 +165,15 @@ class CommandShell
def cleanup
if rstream
if !@cleanup_command.blank?
shell_command_token(@cleanup_command, 10)
# this is a best effort, since the session is possibly already dead
shell_command_token(@cleanup_command) rescue nil
# we should only ever cleanup once
@cleanup_command = nil
end
rstream.close
# this is also a best-effort
rstream.close rescue nil
rstream = nil
end
super