0
我试图建立一个数据包嗅探器,但每次尝试运行此python我得到一个TypeError一个整数是必需的,当我试图读取数据包的前20个字节。TypeError:缓冲区需要整数
这是给我一个错误代码的一部分:
try:
while True:
#read in a packet
raw_buffer = sniffer.recvfrom(65565)[0]
#create an IP Header from the first 20 bytes of the buffer
ip_header = IP(raw_buffer[0:20])
#print out the protocol that was detected and the hosts
print "Protocol: %s %s -> %s" % (ip_header.protocol, ip_header.src_address, ip_header.dst_address)