1、首先输入  tcpdump -X -s 0 -i 2 -w(如果想写到文件中,必须有-w,之后控制台并不会显示) captcha.cap(自动生成到同当前文件夹统计目录中) host xxx.xxx.xxx.xxx(自己的服务器ip) and tcp(按自己需求来我需要抓tcp包) port 8080(需要监控的端口)

    tcpdump是Linux系统中抓包工具

    Ctrl + c是退出键

2、如果在输入1中的命令时,出现Permission denied,那么输入grep tcpdump /sys/kernel/security/apparmor/profiles

    查看你得tcpdump命令是什么模式

    如果是/usr/sbin/tcpdump (enforce)

    输入aa-complain /usr/sbin/tcpdump,将模式改为complain

    当你想换回来那么可以输入aa-enforce /usr/sbin/tcpdump,改回来

    如果还是报无权限的错误,执行下面的步骤

3、输入命令apt install apparmor-utils 或者用apt-get apparmor-utils

    如果在这报错

    

    就是说你的脚本有问题,比如我的两个

    insserv: warning: script 'tomcat' missing LSB tags and overrides

    insserv: warning: script 'tomcat8' missing LSB tags and overrides

    那么进入你的两个脚本文件中

    /etc/init.d/tomcat

    在上方添加如下代码

    ### BEGIN INIT INFO

    # Provides: bbzhh.com

    # Required-Start: $local_fs $network

    # Required-Stop: $local_fs

    # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6

    # Short-Description: tomcat service

    # Description: tomcat service daemon

    ### END INIT INFO

    

4、然后继续执行第三步开头代码

5、如果成功,那么就可以执行第二步

    aa-complain /usr/sbin/tcpdump,更改tcpdump模式

6、然后既可以返回执行第一步,抓包

7、如果还是不能用,那么直接输入apt-get remove insserv,慎用,博主也没有用过

8、最后成功输入是下面的图片样式 

    同级目录下会出现一个文件

    

    如果你想解析captcha.cap文件,你可以下载wireshark解析

    https://www.wireshark.org/#download

9、选择下载可以使用的版本以后直接安装,将*.cap文件通过wireshark打开,然后就可以了

Logo

更多推荐