当前位置:Gxlcms > 数据库问题 > 用wireshark查看 tcpdump 抓取的mysql交互数据

用wireshark查看 tcpdump 抓取的mysql交互数据

时间:2021-07-01 10:21:17 帮助过:2人阅读

mysql -h192.168.100.206 -uroot -p Enter password: ERROR 1045 (28000): Access denied for user ‘root‘@‘192.168.11.201‘ (using password: YES)

输入正确的密码进入并进行一系列操作

[root@localhost ~]# mysql -h192.168.100.206 -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 442447
Server version: 5.5.25-log Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> use jwbx;
Database changed
mysql> select * from jwbx_customer limit 10;

 

用wireshark 打开sql.pcap 文件

技术分享

 

输入的错误密码

Request   6 0.001146 192.168.11.201 192.168.100.206 MySQL 128 Login Request user=root

Response 8 0.001636 192.168.100.206 192.168.11.201 MySQL 147 Response Error 1045

技术分享

 

 

登陆成功

17 4.953321 192.168.11.201 192.168.100.206 MySQL 128 Login Request user=root

来自服务器端的问候

15 4.952968 192.168.100.206 192.168.11.201 MySQL 148 Server Greeting proto=10 version=5.5.25-log

技术分享

服务器端的状态

技术分享

访问

select @@version_comment limit 1  返回 Source distribution

SELECT DATABASE() 

USE DataBase 返回数据库名

访问的sql

技术分享

Return

技术分享

 

技术分享

 

同样可以在抓取程序访问mysql的数据,可以查看执行了哪些sql语句

也可以不用wireshark 方式如下:

#tcpdump -i any -A -s 3000 port 3306 >~/sql.log
#grep "select * from " ~/
sql.log|head


备注:-A 以ASCII格式打印出所有分组,并将链路层的头最小化。向mysql服务端传输的sql语句就是以ASCII码形式进行传输。我们就可以使用-A参数查看传输的具体sql语句。

 

用wireshark查看 tcpdump 抓取的mysql交互数据

标签:

人气教程排行