千家信息网

tcpdump抓取mysql sql语句

发表于:2025-02-02 作者:千家信息网编辑
千家信息网最后更新 2025年02月02日,#!/bin/bash#this script used montor mysql network traffic.echo sqltcpdump -i bond0 -s 0 -l -w - dst
千家信息网最后更新 2025年02月02日tcpdump抓取mysql sql语句

#!/bin/bash
#this script used montor mysql network traffic.echo sql
tcpdump -i bond0 -s 0 -l -w - dst port 3307 | 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.=" $_";
}
}'

0