当前位置: 动力学知识库 > 问答 > 编程问答 >

networking - Drop packet recieved from network using python (scapy?)

问题描述:

I am creating a program in python (either 2 or 3) in which I need to be able to drop a packet. Using scapy I know how to inspect packets, craft one and modify one sniffed from the sniff() function. I believe the sniff function can't actually modify the incomming packets (correct me if I'm wrong). I would like to know how I could drop some packets. Ex: if it has a src.ip==192.168.1.5, then drop it there.

网友答案:

You can not drop packets with scapy or any other sniffing programm. You should try using iptables. There is a wrapper for iptables called python-iptables. It can help you to create, manage and delete different firewall rules from your python programm

分享给朋友:
您可能感兴趣的文章:
随机阅读: