I have a file which contains raw IP packets in binary form. The data in the file contains a full IP header, TCP\UDP header, and data. I would like to use any language (preferably python) to read this file and dump the data onto the line.
In Linux I know you can write to some devices directly (echo “DATA” > /dev/device_handle). Would using python to do an open on /dev/eth1 achieve the same effect (i.e. could I do echo “DATA” > /dev/eth1)
Something like:
Should work, haven’t tested it however.
ethXneeds to be changed to your interface (e.g.eth1,eth2,wlan1, etc.)blocksize. 100 bytes at a time should be fine, you may consider going up but I’d stay below the 1500 byte Ethernet PDU.whileloop with some processing, but thesendis still the same.whileloop won’t be sufficient.