Created
October 20, 2016 21:35
-
-
Save gnilchee/da6f77bd2e882b49d704b27d3fa74cd3 to your computer and use it in GitHub Desktop.
Simple way to view all unencrypted MySQL traffic from client host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tcpdump -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)/i) { | |
if (defined $q) { print "$q\n"; } | |
$q=$_; | |
} else { | |
$_ =~ s/^[ \t]+//; $q.=" $_"; | |
} | |
}' | tee -a /tmp/out.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment