1、依赖文件安装
依赖glib2-devel、libpcap-devel、libnet-devel [root@VMUest ~]# yum install cmake [root@VMUest ~]# yum install libpcap-devel [root@VMUest ~]# yum install glib2-devel [root@VMUest ~]# yum install libnet-devel #使用epel源 [root@VMUest ~]# yum list libnet-devel [root@VMUest ~]# yum search libnet-devel [root@VMUest ~]# yum remove libnet-devel 如果没有对应的yum源,就去下载相关的rmp包,经常rmp会依赖其他rmp包 [root@VMUest ~]# wget ftp://ftp.pbone.net/mirror/rnd.rajven.net/centos/6.4/os/i386/libnet-devel-1.1.6-5cnt6.i686.rpm [root@VMUest ~]# rpm -ivh libnet-devel-1.1.6-5cnt6.i686.rpm
2、sniffer下载、安装
[root@VMUest ~]# cd /tools [root@VMUest tools]# wget https://codeload.github.com/Qihoo360/mysql-sniffer/zip/master [root@VMUest tools]# unzip master [root@VMUest tools]# cd mysql-sniffer-master 或者使用git获取 [root@VMUest tools]# yum install -y git [root@VMUest tools]# git --version [root@VMUest tools]# git clone https://github.com/Qihoo360/mysql-sniffer.git [root@VMUest tools]# cd mysql-sniffer [root@VMUest mysql-sniffer]# mkdir proj [root@VMUest mysql-sniffer]# cd proj [root@VMUest proj]# cmake ../ [root@VMUest proj]# make [root@VMUest proj]# cd bin/
3、使用
[root@VMUest bin]# ./mysql-sniffer -h [root@VMUest bin]# ./mysql-sniffer -i eth0 -p 3306 -e stderr FILE: /tools/mysql-sniffer/src/session.cpp LINE: 109 in add_mysql_resume_session:"adding resume session: 22390976:51130 -> -2125092672:3306" FILE: /tools/mysql-sniffer/src/mysql-dissector.c LINE: 170 in mysql_dissect_greet:"Server: Greet " packet len: 78 N 5.6.35-logefQA2snP$^3PJd9,rz1mysql_native_password FILE: /tools/mysql-sniffer/src/mysql-dissector.c LINE: 419 in handle_server_msg:"get a wrong state when handling server msg. current state: SESSION_STATE_LOGIN_REQUEST" FILE: /tools/mysql-sniffer/src/mysql-dissector.c LINE: 484 in handle_resume_state:"handle resume state: current state: SESSION_STATE_RESUME_START msg_type: server " FILE: /tools/mysql-sniffer/src/mysql-dissector.c LINE: 538 in mysql_dissector:"handle canceled due to resume state"
不知道为什么不带-e参数,窗口不会显示任何信息。。。
修改yum源
1、备份 [root@VMUest ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2、下载新的yum源到/etc/yum.repos.d/,选一个即可 [root@VMUest ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo #aliyun [root@VMUest ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo #163 [root@VMUest ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/epel-6.repo #epel 3、之后运行yum makecache生成缓存 [root@VMUest ~]# cd /etc/yum.repos.d/ [root@VMUest yum.repos.d]# more CentOS-Base.repo [root@VMUest yum.repos.d]# yum clean all [root@VMUest yum.repos.d]# yum makecache