我是python和scapy的初学者,我运行程序,但它有错误,只是语法错误,但我真的不知道如何解决它。这是我的代码:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from scapy.all import *
import sys
def parse(pkt):
if pkt.haslayer(TCP) and pkt.getlayer(TCP).dport == 80 and pkt.haslayer(Raw):
print pkt.getlayer(Raw).load
#start sniffing
pkts = sniff(filter="tcp and port 80",iface=“eth0”, prn=parse)
这是错误:
File "getsniff.py", line 11
pkts = sniff(filter="tcp and port 80",iface=“eth0”, prn=parse)
^
SyntaxError: invalid syntax
答案 0 :(得分:3)
双引号不是通常的双引号。使用"
(字符代码34)或'
(39)代替“
(8220):
pkts = sniff(filter="tcp and port 80", iface="eth0", prn=parse)