ÎÒÔÚÓÃPYTHONдץ°ü³ÌÐò,Ò»Ö±Ìáʾģ¿éûÓб»µ÷ÓÃ
Ô´³ÌÈçÏÂ:
Python code:
import pcap
import dpkt
pc = pcap.pcap();
µÚÒ»ÐÐ,µÚ¶þÐж¼Ã»ÓÐÎÊÌâ,¾ÍÊǵÚÈýÐб¨´í,°¦,ÕÛÌںþÃÁË,ÕæÏë·ÅÆúPYTHON
E:\cmd>pcap.py
Traceback (most recent call last):
File "E:\cmd\pcap.py", line 3, in <module>
import pcap
File "E:\cmd\pcap.py", line 10, in <module>
pc = pcap.pcap();
TypeError: 'module' object is not callable
ÄãµÄpcap.pcapÈÔÈ»ÊÇÒ»¸ömodule£¬ÄãÒªÖªµÀËüÓÐʲô·½·¨£¬¾Íhelp(pcap.pcap)»òdir(pcap.pcap)¿´Ò»Ï£¬È»ºóÔÙÕýȷʹÓÃ
pcap.pcap ÊÇÒ»¸ömodule£¬²»Ö§³Ö__call__·½·¨
up
ÓÐÒ»¸ösample µÄ.ÄãÖ±½ÓÓà sample ¾ÍÐÐÁË.
ÎÒÒ²ÓÐÎÊÌâ.
ÎÒʹÓà pcapy µÄʱºò, ×¥²»µ½ËùÓеİü. Óà tcpdump ¾Í¿ÉÒÔ¿´µ½ËùÓеÄÊý¾Ý°ü.
ÄãÃǶ¼´íÁË,ºóÀ´»¹ÊÇÎÒ×Ô¼º¸ã¶¨ÁË....ÔÚ×°ÁËpcapºÍdpktÖØÆôµçÄÔºó,¾ÍÈ«²¿¸ã¶¨ÁË...
ÔÎ.ÄãÓÖûÓн²ÄãûÓÐÖØÆô...
wincap °²×°ºóÊÇÐèÒªÖØÆô²ÅÐеÄ.
Äã½²ÕÛÌÚÁ˺þÃ. Ïë±ØÓ¦¸ÃÊÇÊ®Ìì°ë¸öÔÂ.Ó¦¸ÃÒ²ÊÇÖØÆô¹ýµÄÁË.
Ïà¹ØÎÊ´ð£º
ËÍƼöÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·
×÷Ϊϵͳ¹ÜÀí·½Ã棬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg
ÒýÓÃ
×÷Î ......
´ó¼ÒºÃ£¬ÎÒÊÇÒ»¸öÐÂÊÖ£¬¸Õ¿ªÊ¼Ñ§python£¬µ«ÊǸտªÊ¼µÄhelloworld¶¼Ã»·¨´òÓ¡£¬ÈÃÎÒºÜÎÞÄΡ£
ÎÒµÄpython°²×°Â·¾¶Îªf:\python31¡£ÔÚpathÖÐÒ²ÉèÖöÔÁË£¬ÔÚwindowsÏÂÔËÐÐÊÇÕâÑùÏÔʾµÄ£¬Ï£Íû¸÷λǰ±²Ö¸µãһϡ£Ð»Ð»
Pyth ......
ÎÒÏÖÔÚÓÐÒ»¸öÐèÇóÊÇÕâÑùµÄ
ÎÒÓÐ2¸öÀà
class A
{
public:
int val;
}
class B
{
public:
A a
}
ÏÖÔÚÔڽű¾ÖÐÖ»ÄÜ
b.a.val = 1
ÎÒÔÚpythonÖÐÏëʹÓÃ
b.a = 1
......
ÔÚlistÖÐÌí¼ÓÒ»¸öÀàµÄ¾Ö²¿±äÁ¿ ÕâÑù×öÊÇ·ñºÏ·¨ Çë¿´ÏÂÃæÀý×Ó:
Python code:
class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......