2

I'm trying to figure out why msfconsole is exiting when started from with a detached screen, but not when started from a non detached screen.

Here are the steps:

screen -d -m -S msf
screen -S msf -p 0 -X stuff "msfconsole\n"
screen -R -S msf

msfconsole exits right after loading where:

screen -S msf
msfconsole  <-from within screen

allows it to actually run without exiting after loading. How do I fix this?

nKn
  • 5,549
  • 6
  • 32
  • 38
Zack
  • 21
  • 2

1 Answers1

0

I've found a solution that helped me .

A simple approach is to: ssh in to your metasploit box, run screen -dRR, and in the resulting shell run msfconsole. Then, in the future, if you disconnect your ssh client and reconnect, just run screen -dRR again and you'll be connected back w/your screen session running msfconsole. The screen -dRR command also creates a screen session if one does not exist, which is why it works even when there is no existing screen session.

just open an other ssh session or terminal then run screen -d or just screen -d if running a single screen.

Regards

Shen
  • 1
  • Perhaps I’m misunderstanding, but it seems to me that this is at best a workaround.  If this is an actual solution, please explain how it answers the question. … … … … … … … … … … … … … … … … Do not respond in comments; [edit] your answer to make it clearer and more complete. – G-Man Says 'Reinstate Monica' Nov 30 '17 at 13:39
  • Yes that's a work around... I need it to start in detached mode and run that command. – Zack Dec 01 '17 at 14:38