Giter VIP home page Giter VIP logo

perl6-net-packet's Introduction

Net::Packet (Perl6)

Perl6 module for decoding network packets. Encoding/Generating packets is on the TODO list.

The modules are written in pure Perl6. Both the Buf and the C_Buf class can be used as frames to decode. (C_Buf from the perl6-net-pcap module).

The following protocols are implemented: Ethernet, IPv4, UDP and ARP. Each protocol has its own module Net::Packet::*.

Documentation

All modules are documented using in-file Pod. The in-file Pods are rendered to Markdown formatted files in the docs/ directory.

Installation

Using panda:

$ panda update
$ panda install Net::Packet

Using ufo:

$ ufo          # Generates Makefile
$ make
$ make test
$ make install

Usage:

use Net::Packet::Ethernet :short; # use :short for short notation:
use Net::Packet::IPv4 :short;     #   Ethernet.decode
use Net::Packet::UDP :short;      # instead of
                                  #   Net::Packet::Ethernet.decode

my $pkt = Buf.new([...]);

my $eth = Ethernet.decode($pkt);
printf "%s -> %s: ", $eth.src.Str, $eth.dst.Str;
# use .Str or .Int to convert .src/.dst to something usable.

my $ip  = IPv4.decode($eth.data, $eth);
printf "%s -> %s: ", $ip.src.Str, $ip.src.Str;

my $udp = UDP.decode($ip.data, $ip);
printf "%d -> %d\n", $udp.src_port, $udp.dst_port;
use Net::Ethernet :short;

my $pkt = Buf.new([...]);

my $eth = Ethernet.decode($pkt);
printf "%s -> %s: ", $eth.src.Str, $eth.dst.Str;

if $eth.pl ~~ IPv4 { # .pl (for PayLoad) decodes the payload
   printf "%s -> %s: ", $eth.pl.src.Str, $eth.pl.dst.Str;
      
   if $eth.pl.pl ~~ UDP {
      printf "%d -> %d: ", $eth.pl.pl.src_port, $eth.pl.pl.dst_port;
   }
}

perl6-net-packet's People

Contributors

jpve avatar ugexe avatar paultcochrane avatar

Stargazers

Alexander Hartmaier avatar XTT avatar Michal Jurosz avatar Alexander Moquin avatar

Watchers

XTT avatar  avatar James Cloos avatar

perl6-net-packet's Issues

Will no longer be updated to the Raku ecosystem

Hello,

Thank you for the time and effort you have put in what is now the Raku Programming Language. The language and its ecosystem are moving forward.

This means that these distributions:

will no longer be checked for updates by the Raku ecosystem.

This means that you will need to move your module to the zef ecosystem on the next update you make to these distributions. Otherwise your update will simply not be seen by the ecosystem.

If you are no longer interested in maintaining these distributions, you can have these distributions moved to Raku Community Modules Adoption Center, where members of the Raku Community will take care of them.

This can be as easy as confirming that in a response to this issue.

Again, thank you for your time and efforts!

On behalf of the Raku Steering Council,

Elizabeth Mattijsen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.