netcat is mostly used for reverse connection but it's limited to handling only one connection at a time. This utility offers a more convenient way to manage multiple sessions within a single terminal, allowing you to listen for and handle incoming connections simultaneously.
cd TCPServerCLI && mkdir build && cd build
cmake ..
cmake --build . --config Release
You can specify the cmake-generator to create configuration files for your build system. some examples are given below
cmake -G "Visual Studio 16 2019" -A x64 ..
cmake -A x64 ..
cmake -A Win32 ..
TCPServerCLI.exe [PortNumber]
The tool accepts two commands
# Specify the [id] of the connected client/session
1) select client [id]
# Disconnect from client/session
2) exit
Waiting for clients to connect, two clients are shown below as connected
Client 0 is selected for communication
Upgrading a simple reverse shell to a fully interactive tty on client 1
It is better to use MINGW/GIT/WSL terminal because it can handle interactive shell for all OS's, while the native Windows command prompt i.e. cmd and PowerShell environments do not natively support PTYs in the same way as Linux. They use different mechanisms for terminal emulation and may not fully support all PTY features expected by applications like pty.spawn()