用tcpdump  抓取 mysql客户端与服务器端的交互

1开启tcpdump

 tcpdump -i eth0 -s 3000 port 3306 -w ~/sql.pcap

先故意输入一个错误的密码

[root@localhost ~]# 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语句。

最新文章

  1. 《转载》跟我学SpringMVC
  2. Docker:Ubuntu下的安装
  3. BZOJ3331: [BeiJing2013]压力
  4. 错误 1 error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. d:\users\vs2013\le
  5. AWS助理架构师认证考经
  6. VS使用WinRAR软件以命令行方式打包软件至一个exe
  7. poj1236 强连通缩点
  8. jenkins结合ansible用shell实现自动化部署和回滚
  9. 【转载】cocs2dx中c++与c#互调
  10. WebView中Js与Android本地函数的相互调用
  11. A Tour of Go Variables with initializers
  12. android的color整理(一)
  13. OOAD-设计模式(二)之GRASP模式与GOF设计模式概述
  14. 机器学习数学|偏度与峰度及其python实现
  15. 在web应用中使用Log4j 2
  16. webgl之绘图要点
  17. 【Win32 API】利用SendMessage实现winform与wpf之间的消息传递
  18. Codeforces 847E - Packmen
  19. 20145311实验二 "Java面向对象程序设计"
  20. 简单使用dom4j

热门文章

  1. 程序中实现两个DataTable的Left Join效果(修改了,网上第二个DataTable为空,所处的异常)
  2. Avito Cool Challenge 2018 C. Colorful Bricks 【排列组合】
  3. mac 系统安装selenium注意事项
  4. 如何将编写好的CS文件做成exe可执行文件
  5. 51Nod - 1205 (流水先调度)超级经典的贪心 模板题
  6. Asp.net MVC 自定义错误页面以及return HttpNotFound遇到的问题
  7. GoBelieve,IMSDK android版开发环境问题
  8. Oracle记录类型(record)和%rowtype
  9. c#一个日志类(log4net)
  10. Linux 实时查看进程网络的使用情况