zoukankan      html  css  js  c++  java
  • 利用dsniff的tcpkill杀TCP连接

    利用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的连接被杀掉后,它又重新尝试新的连接。

  • 相关阅读:
    C# Process.Start()方法详解 .
    任务管理器
    20160113 js中选择多个check一块删除
    20160113 JS中CheckBox如何控制全选
    20151217JS便签
    20151216Repeater
    20151215单选按钮列表,复选框列表:CheckBoxList
    20151214下拉列表:DropDownList
    !!!SqlHelper 传智!
    !!! SQL 数据库开发基础 传智!
  • 原文地址:https://www.cnblogs.com/archoncap/p/5125180.html
Copyright © 2011-2022 走看看