pydivert icon indicating copy to clipboard operation
pydivert copied to clipboard

difficulty with create and send a fake packet

Open ly3too opened this issue 6 years ago • 2 comments

Hi, I tried to create a fake RST packet and send it. But it seems very unconvenient. Do I have to create a Packet from raw bytes and manipulate the raw data before create the Packet? is it possible to directy create a Packet and change the properties and then send it?

ly3too avatar Oct 12 '18 02:10 ly3too

Use SCAPY. Very helpful tool that makes it very easy to make and send fake packets.

Protowalker avatar Dec 10 '18 16:12 Protowalker

This is a very late response but maybe It would be useful for somebody. I think that the biggest pro for using pydivert over scapy is because it gives you the control over sending or blocking captured packets, in contrast to scapy that sends the captured packet automatically. In case your only goal is to create packets and send them, scapy is more straightforward with easier ways for creating and encapsulating packets. If you still want to use Pydivert, the Packet object must be created through a memoryview object of a valid raw bytes packet (+ a direction and a tuple representing a network interface). the raw packet will be used to calculate the other attributes of the packet object, that cannot be manually populated as it seems if the provided raw packet is not valid. So, you can use a "template" packet raw bytes to first create the packet object, then change the attributes of the packet manually afterwards.

AyoubSelmi avatar Mar 29 '24 08:03 AyoubSelmi