0

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?

innerpeace
  • 112
  • 3
  • 9
  • What do you get instead? Question marks? Black diamonds? Mojibake? – Rick James Jun 02 '17 at 04:03
  • I got Mojibake for none English world, but get English words and punctuation such '%' and ',' correctly – innerpeace Jun 02 '17 at 05:09
  • 1
    [_This_](https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored) discusses Mojibake (and other things) in a context of MySQL and some client -- focus on the non-mysql suggestions. – Rick James Jun 02 '17 at 22:07

0 Answers0