I was able to start a session using metasploit framework (msf6) with an android but after a while being in the session, the meterpreter session closes. Luckily however after a few seconds, another stage payload gets sent out, giving me access to another meterpreter session. I could login AGAIN using
I'm trying to run a session script using the
run command and I want to catch this error:
[-] Error running command print_status: Rex::TimeoutError Operation timed out.
when my meterpreter sessions get closed to automatically open a new session again using
For example, I am running this ruby script in the session, but general Ruby syntax error catching doesn't work.
<ruby> begin while true print_status("Hello world") end rescue => e print_status("This is where I want to catch when my session gets closed") print_status("The print_status doesn't work once meterpreter prompt closes") end </ruby>
Is it normal for meterpreter sessions to timeout after a while? Because I've learned to live with it, but it would be nice if I don't have to keep typing in
sessions <new id> to get a new session after every session use.