2007年11月14日 星期三 11:35
1. ´´½¨sqlfilter.py
#cat sqlfilter.py
#!/bin/python
import sys
def isKey(s):
#Èç¹ûÏë¼àÌýÆäËûµÄ¹Ø¼ü×Ö£¬¿ÉÒÔÔÚÏÂÃæÌí¼Ó
for k in ["SELECT","INSERT","UPDATE","DELETE"]:
pos=s.find(k)
if pos>=0:
return pos
return -1
while True:
line = sys.__stdin__.readline().strip()
if not line:
continue
pos=isKey(line.upper())
if pos>=0:
sys.__stdout__.write("%s\n" % (line[pos:]))
sys.__stdout__.flush()
2. ¼àÌýÍøÂçÖеÄÊý¾Ý
#time tcpdump -i eth0 -s 1500 src host hostIp -A|python sqlfilter.py|tee
sql.out
3.·ÖÎöÊý¾Ý
sql.outÖаüº¬ËùÓз¢Ë͸ø·þÎñ¶ËµÄsql£¬Ôõô·ÖÎö£¬Çë×Ô±ã
;-)
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071114/7ebd441a/attachment.html
Zeuux © 2025
京ICP备05028076号