File: layer3-ipv6.pl

package info (click to toggle)
libnet-write-perl 1.05-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 120 kB
  • ctags: 32
  • sloc: perl: 412; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl
#
# $Id: layer3-ipv6.pl 1636 2009-06-10 18:38:24Z gomor $
#
use strict;
use warnings;

my $target = shift || die("Specify an IPv6 address as a parameter\n");

use Net::Packet::Env qw($Env);
$Env->noFrameAutoDesc(1);
$Env->noFrameAutoDump(1);

use Net::Write::Layer qw(:constants);
use Net::Write::Layer3;

my $l3 = Net::Write::Layer3->new(
   dst    => $target,
   family => NW_AF_INET6,
);

use Net::Packet::IPv6;
my $ip6 = Net::Packet::IPv6->new(dst => $target, hopLimit => 3);
$ip6->pack;

use Net::Packet::TCP;
my $tcp = Net::Packet::TCP->new(dst => 22);
$tcp->pack;

use Net::Packet::Frame;
my $frame = Net::Packet::Frame->new(l3 => $ip6, l4 => $tcp);

print $frame->print."\n";

$l3->open;
$l3->send($frame->raw);
$l3->close;