The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Net::Frame - the base framework for frame crafting


   # Basic example, send a TCP SYN to a target, using all modules
   # the framework comprises. It also waits for the response, and 
   # prints it.

   my $target = '';
   my $port   = 22;

   use Net::Frame::Device;
   use Net::Write::Layer3;
   use Net::Frame::Simple;
   use Net::Frame::Dump::Online;

   use Net::Frame::Layer::IPv4;
   use Net::Frame::Layer::TCP;

   my $oDevice = Net::Frame::Device->new(target => $target);

   my $ip4 = Net::Frame::Layer::IPv4->new(
      src => $oDevice->ip,
      dst => $target,
   my $tcp = Net::Frame::Layer::TCP->new(
      dst     => $port,
      options => "\x02\x04\x54\x0b",
      payload => 'test',
   my $oWrite = Net::Write::Layer3->new(dst => $target);

   my $oDump = Net::Frame::Dump::Online->new(dev => $oDevice->dev);

   my $oSimple = Net::Frame::Simple->new(
      layers => [ $ip4, $tcp ],

   until ($oDump->timeout) {
      if (my $recv = $oSimple->recv($oDump)) {
         print "RECV:\n".$recv->print."\n";



Net::Frame is a fork of Net::Packet. The goal here was to greatly simplify the use of the frame crafting framework. Net::Packet does many things undercover, and it was difficult to document all the thingies.

Also, Net::Packet may suffer from unease of use, because frames were assembled using layers stored in L2, L3, L4 and L7 attributes. Net::Frame removes all this, and is split into different modules, for those who only want to use part of the framework, and not whole framework.

Finally, anyone can create a layer, and put it on his CPAN space, because of the modularity Net::Frame offers. For an example, see Net::Frame::Layer::ICMPv4 on my CPAN space.

Net::Frame does ship with basic layers, to start playing.


Net::Frame::Simple, Net::Frame::Device, Net::Frame::Layer, Net::Frame::Dump, Net::Frame::Layer::IPv4, Net::Frame::Layer::TCP, Net::Write


Patrice <GomoR> Auffret


Copyright (c) 2006-2019, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.