Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Python±à³ÌÎÊÌ⣬¿ÒÇë¸ßÊÖ½â»ó

×î½üÃÔÉÏÁËPython£¬ÔÚ˼¿¼ÔõÑùÓÃPythonд¸ö³ÌÐòʵÏÖ¶ÔÖ¸¶¨ÍøÂç¶Ë¿ÚµÄÊý¾Ý°üµÄץȡºÍ½âÎö£¬¿ÒÇë¸ßÊÖÖ¸½Ì£¡£¡

ÄãºÃ£¡
Ê×ÏÈ£¬ÊµÏÖ²¶°üµÄ¹¦ÄÜÐèҪʹÓÃwincap£¨windowsÏ£©£¬»òÕßlibpcap£¨LinuxÏ£©¡£
¶øPythonÌṩÁ˼¸¸ölibpcap bind£¬²»È磺http://monkey.org/~dugsong/pypcap/£¬ÕâÀïÓÐÒ»¸ö×î¼òµ¥µÄ¡£
ÔÚwindowsƽ̨ÉÏ,ÄãÐèÒªÏÈ°²×°winpcap¡£

ÏÂÃæÊÇÒ»¸ö¹æ·¶µÄ×¥°ü¹ý³ÌÀý×Ó£º

import pcap
import dpkt
pc=pcap.pcap() #×¢£¬²ÎÊý¿ÉΪÍø¿¨Ãû£¬Èçeth0
pc.setfilter('tcp port 80') #ÉèÖüàÌý¹ýÂËÆ÷
for ptime,pdata in pc: #ptimeΪÊÕµ½Ê±¼ä£¬pdataΪÊÕµ½Êý¾Ý
  print ptime,pdata #...

¶Ô×¥µ½µÄÒÔÌ«ÍøV2Êý¾Ý°ü(raw packet)½øÐнâ°ü

p=dpkt.ethernet.Ethernet(pdata)
if p.data.__class__.__name__=='IP':
  ip='%d.%d.%d.%d'%tuple(map(ord,list(p.data.dst)))
  if p.data.data.__class__.__name__=='TCP':
  if data.dport==80:
  print p.data.data.data # by gashero

һЩÏÔʾ²ÎÊý

nrecv,ndrop,nifdrop=pc.stats()
·µ»ØµÄÔª×éÖУ¬µÚÒ»¸ö²ÎÊýΪ½ÓÊÕµ½µÄÊý¾Ý°ü£¬(by gashero)µÚ¶þ¸ö²ÎÊýΪ±»ºËÐĶªÆúµÄÊý¾Ý°ü¡£
good luck£¡


¸ÐлÈý¥ǰ±²µÄ°ïÖú£¬´ýÎÒÏû»¯Ò»Ï°¡£¬Èç¹ûÓв»Ã÷°×µÄµØ·½£¬Ï£ÍûÄÜÔٵõ½ÄãµÄÖ¸µ¼£¡¸Ðл£¡

½¨ÒéLZ¿´PythonÍøÂç±à³Ì»ù´¡

´óÏÀÓÐÖÐÎÄ°æµÄ²»£¿
ÒýÓÃ
½¨ÒéLZ¿´PythonÍøÂç±à³Ì»ù´¡


Èç¹ûÏë¸úÉÏʱ´úµÄ·¢Õ¹£¬ ¾Í¶ÈÓ¢ÎÄ°æµÄ°Ñ£¬ Â¥ÉÏΪÄãÍƼöµÄºÜºÃ¡£


Ïà¹ØÎÊ´ð£º

eric4ÔõôÔËÐÐpython³ÌÐò£¿

pythonºÍpyqtÒÔ¼°Eric4¶¼ÒѾ­ÅäÖúÃÁË£¬´ò¿ªEric4д¸öpython³ÌÐò±ÈÈç¼òµ¥µÄ
print¡°hello£¬world¡±£¬Ôõô±àÒëÔËÐÐÁË£¬Start²Ëµ¥µÄËùÓÐÃüÁ³öÏÖºÍͼÖв¶àµÄ¶Ô»°¿ò£¬Ó¦µ±ÔõôÔËÐÐÁË£¿

Çó´ó¼ÒÖ¸½Ì

ûÓÐÈËÓà ......

python PILÄ£¿é´ò¿ªÍ¼Æ¬ÎÊÌâ

ÇëÎÊÏ£¬ÎÒµÄÊÇpython2.5°²×°ÁËPILÄ£¿é£¬È»ºó±àд³ÌÐò´ò¿ª±¾»úÉϵÄÒ»¸öͼƬʱ£¬ÎªÊ²Ã´ÀϳöÏÖ´íÎóÄØ£¬ÀÏÊÇÕÒ²»µ½Í¼Æ¬£¬´íÎóÌáʾÈçÏ£ºFile "C:\Python25\Lib\site-packages\PIL\Image.py", line 1888, in o ......

Ë­ÍƼöÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл

Ë­ÍƼöÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·

×÷Ϊϵͳ¹ÜÀí·½Ã棬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg

ÒýÓÃ
×÷Î ......

pythonÔõôprint 'hello world'

´ó¼ÒºÃ£¬ÎÒÊÇÒ»¸öÐÂÊÖ£¬¸Õ¿ªÊ¼Ñ§python£¬µ«ÊǸտªÊ¼µÄhelloworld¶¼Ã»·¨´òÓ¡£¬ÈÃÎÒºÜÎÞÄΡ£
ÎÒµÄpython°²×°Â·¾¶Îªf:\python31¡£ÔÚpathÖÐÒ²ÉèÖöÔÁË£¬ÔÚwindowsÏÂÔËÐÐÊÇÕâÑùÏÔʾµÄ£¬Ï£Íû¸÷λǰ±²Ö¸µãһϡ£Ð»Ð»
Pyth ......

python ÕýÔòÆ¥ÅäÖÐÎÄ

ÔÚÎı¾ÎļþÖÐÆ¥ÅäÏî°üº¬ÖÐÎÄ
ÈçÄÚÈÝΪ£ºgamename=ÖÐÎÄ 
  key=ÌìÏÂ
Îı¾ÎļþµÄ±àÂëµÄÎļþΪutf-8
python´úÂëÈçÏ£º
# -*- coding:UTF-8 -*-
  contents=open(from_pa ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ