from scapy.all import *
def spoof(pkt):
if pkt.getlayer(ICMP).type==8:
a=IP()
a.dst=pkt.getlayer(IP).src
a.src=pkt.getlayer(IP).dst
b=ICMP()
b.type=0
b.id=pkt.getlayer(ICMP).id
b.code=pkt.getlayer(ICMP).code
b.seq=pkt.getlayer(ICMP).seq
str=pkt.getlayer(Raw).load
p=a/b/Raw(str)
send(p)
print('THIS IS OUR POCKET ################################')
p.show()
print('Start to sniff and spoof!')
pkt = sniff(filter='src net 10.0.2 and icmp ',prn=spoof)
转载请注明原文地址:https://blackberry.8miu.com/read-17893.html