Below you will find pages that utilize the taxonomy term “抓包”
May 28, 2016
利用tcpdump抓取MySQL执行的SQL
"\u003cp\u003e\u003ca href=\"http://ourmysql.com/archives/1358\"\u003ehttp://ourmysql.com/archives/1358\u003c/a\u003e\n编写脚本文件dumpsql.sh,内容如下:\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e#!/bin/bash\n#this script used montor mysql network traffic.echo sql\ntcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | perl -e \u0026#39;\nwhile(\u0026lt;\u0026gt;) { chomp; next if /^[^ ]+[ ]*$/;\n if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i)\n {\n if (defined $q) { print \u0026#34;$q\\n\u0026#34;; }\n $q=$_;\n } else {\n $_ =~ s/^[ \\t]+//; $q.=\u0026#34; $_\u0026#34;;\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e运行并抓去sql的执行。\u003c/p\u003e\n\u003cp\u003e抓取后在当前目录出现out.log文件,执 …\u003c/p\u003e"