Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I break an arbitrary TCP/IP connection on Linux?

Tags:

linux

tcp

Is there any command that can be used to break an existing TCP/IP connection from some program?

Is there anything in a TCP connection the OS is aware of, or do the OS only see TCP transfer on local sockets and doensn't know which request is served to which socket?

For example, if Firefox sends a request to some server's port 80 and is waiting for the answer. Is it possible then to find Firefox listening port and trick Firefox into showing ERR_CONNECTION_REFUSED or something similar.

I would like a solution that does not prevent the data flow and lets the application handle this situation in its way, but rather close the socket or the TCP/IP connection (which should be possible as the socket is something the OS is responsible for I think? Is the connection also a OS property or just something the application does?) so the application would react immediately.

like image 446
dronus Avatar asked Jun 03 '11 12:06

dronus


2 Answers

Use tcpkill.

like image 54
vitaut Avatar answered Nov 27 '22 14:11

vitaut


Cutter

Cutter will send packets to both ends of a TCP/IP connection to close the connection. It is designed to be used on a Linux router to disconnect unwanted connections.

Website: http://www.digitage.co.uk/digitage/software/linux-security/cutter

Debian has a package of it: https://packages.debian.org/stable/cutter

like image 37
PF4Public Avatar answered Nov 27 '22 14:11

PF4Public