My MySQL was installed on a remote host, I am interactive with Mysql by PHP PDO. I want to check the SQL statements I have executed. So I search on google and use tcpdump. here are the codes what get on web.
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.=" $_";
}
}'
but I found it can show the utf8 words.
This post Make sure your terminal supports outputting UTF-8 notice me that I should check if my terminal supports outputting UTF-8.
but My terminal does support utf8.
I alse try the recommaned solution above, but It still does not work.
tcpdump -lnpi lo tcp port 80 -s 16000 -w - | tr -t '[^[:print:]]' ''
tcpdump -lnpi lo tcp port 80 -s 16000 -w - | strings -e S -n 1
so I wonder How to display utf8 characters captured by tcpdump?