首页 > 其他 > 详细

利用dsniff的tcpkill杀TCP连接

时间:2016-01-12 19:19:09      阅读:263      评论:0      收藏:0      [点我收藏+]

利用dsniff的tcpkill杀TCP连接

Linux连接久久不能释放的现象不常见,但偶然也会发生。进程虽不复存在,但是客户端的连接咬定青山不放松,死活也不肯吐出连接,导致重启进程时因操作系统判断监听端口被占用而无法启动。常规手段已经束手无策,这时候不得不想办法杀连接。
一、tcpkill介绍
tcpkill是网络嗅探工具包dsniff其中提供的一个利器,用于杀掉TCP连接。因此事先要安装dsniff。如rhel5中,搜索下载dsniff-2.4-0.1.b1.el5.rf.rpm,rpm -ivh安装后,很容易调出tcpkill命令。我们可以先看看manual:
[root@xxxx ~]# man tcpkill
TCPKILL(8)                                                          TCPKILL(8)
NAME
       tcpkill - kill TCP connections on a LAN
 
SYNOPSIS
       tcpkill [-i interface] [-1...9] expression
 
DESCRIPTION
       tcpkill kills specified in-progress TCP connections (useful for libnids-based applications which require a full
       TCP 3-whs for TCB creation).
 
OPTIONS
       -i interface
              Specify the interface to listen on.
 
       -1...9 Specify the degree of brute force to use in killing a connection. Fast connections may require a  higher
              number in order to land a RST in the moving receive window. Default is 3.
 
       expression
              Specify a tcpdump(8) filter expression to select the connections to kill.
 
SEE ALSO
       dsniff(8), tcpnice(8)
 
AUTHOR
       Dug Song <dugsong@monkey.org>                                         
                           TCPKILL(8)
二、tcpkill实战
在该示例中,FIN_WAIT1 的TCP连接一直无法释放,顽强无比。
技术分享

进程监听端口16000,客户端连接端口43255。

使用tcpkill的效果又是如何呢?

 命令如下:tcpkill -9 host 客户端连接ip

可以看到客户端140.4:43255的连接被杀掉后,它又重新尝试新的连接。

技术分享

利用dsniff的tcpkill杀TCP连接

原文:http://www.cnblogs.com/archoncap/p/5125180.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!