I put together a perl script that reads packages in user space via Linux :: TunTap, and it all works fine:
#!/usr/bin/perl use warnings; use strict; use Linux::TunTap; $tun = new Linux::TunTap(NAME => 'localtun') or die "Couldn't connect to IF\n"; while (my $packet = $tun->get_raw()) { print Dumper($packet); }
Now the question arises: how to turn a string representing a raw IP packet, as read from a tuntap device, into the correct data structure for processing? In particular, I get the source, target and serial number.
Obviously, the source IP packet is not very readable by the person in its source format. Here is the output after sending the ping via the tuntap interface:
{{{ }/ 8V | !"#$%&'()*+,-./0123456ET @@4
How can I go from here to be able to process this data programmatically?
source share