日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

利用tcpdump抓取mysql sql语句

發布時間:2025/5/22 数据库 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 利用tcpdump抓取mysql sql语句 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

這個腳本是我之前在網上無意間找個一個利用tcpdump 抓包工具獲取mysql流量,并通過過濾把sql 語句輸入。

腳本不是很長,但是效果很好。

#!/bin/bash #this script used montor mysql network traffic.echo sql tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | perl -e ' while(<>) { chomp; next if /^[^ ]+[ ]*$/;if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i){if (defined $q) { print "$q\n"; }$q=$_;} else {$_ =~ s/^[ \t]+//; $q.=" $_";} }'

下面是執行腳本的輸出:

?

SELECT b.id FROM module as a,rights as b where a.id=b.module_id and b.sid='179' and a.pname like 'vip/member_order_manage.php%' SELECT count(id) as cc,sum(cash) as total from morder_stat_all where (ymd BETWEEN '1312214400' and '1312336486') and depart_id=5 an d order_class=2 select id,name from media where symd='0000-00-00' select id,name from depart where s_flag=' ' and onoff=1 order by sno select id,name from plank where depart_id=5 and onoff=1 order by no select id,name from grp where plank_id=0 and onoff=1 order by no select id,CONCAT(pname,'-',name) as name from pvc order by pname select id,CONCAT(no,'-',name) as name from local where pvc_id=0 order by no select id,name from product_breed select color_name from product_color where id=5 select id,name from product where id = '0' select * from morder_stat_all where (ymd BETWEEN '1312214400' and '1312336486') and depart_id=5 and order_class=2 order by ymd DESCLIMIT 0,50 select urlkey from sys_config where id=1 select name from morder where id=7195793 select no,name from staff where id=5061 select product_id,amt,price0 from order_product where order_id = 7195793 select concat_ws('/',name,NULLIF((select color_name as cn from product_color where id=color_id),''),NULLIF((select style_name from p roduct_style where id=style_id),'')) as name,spec,weight,price from product where id = 16938 select concat_ws('/',name,NULLIF((select color_name as cn from product_color where id=color_id),''),NULLIF((select style_name from p roduct_style where id=style_id),'')) as name,spec,weight,price from product where id = 19005 select name from morder where id=7195768 select no,name from staff where id=221 select product_id,amt,price0 from order_product where order_id = 7195768 select concat_ws('/',name,NULLIF((select color_name as cn from product_color where id=color_id),''),NULLIF((select style_name from p roduct_style where id=style_id),'')) as name,spec,weight,price from product where id = 18978 select concat_ws('/',name,NULLIF((select color_name as cn from product_color where id=color_id),''),NULLIF((select style_name from p roduct_style where id=style_id),'')) as name,spec,weight,price from product where id = 18282 select concat_ws('/',name,NULLIF((select color_name as cn from product_color where id=color_id),''),NULLIF((select style_name from p roduct_style where id=style_id),'')) as name,spec,weight,price from product where id = 19740

?

從上面的日志可以看出,腳本的功能還是很強大吧 。

轉載于:https://www.cnblogs.com/ylqmf/archive/2012/07/11/2586741.html

總結

以上是生活随笔為你收集整理的利用tcpdump抓取mysql sql语句的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。