I am troubleshooting a problem with a telnet server on an embedded device and I need to recreate a specific process where a client closes the socket before the server has completed the initial connection setup/handshake.
Specifically, I need to send a TCP ACK immediately followed by a FIN at a specific point in the communication. I have found some tools that allow me to replay captured packets but I need to actually send my packets in response to the embedded server's packets.
Is there any tool that already has this capability to customize responses or is there a way to use something like Python or C# to create a custom TCP client where I can control the TCP connection at the level of seeing and manipulating the SYN/ACK/FIN packets?