File: layer3-ipv6.pl

package info (click to toggle)
libnet-write-perl 1.10-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 156 kB
  • sloc: perl: 556; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 932 bytes parent folder | download | duplicates (3)
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
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl
#
# $Id: layer3-ipv6.pl 2007 2015-01-27 06:26:42Z gomor $
#
use strict;
use warnings;

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

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

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

use Net::Frame::Device;
use Net::Frame::Simple;
use Net::Frame::Layer::IPv6;
use Net::Frame::Layer::TCP;

my $device = Net::Frame::Device->new(
   target6 => $target,
   dev => $dev,
);

my $ip6 = Net::Frame::Layer::IPv6->new(
   dst => $target,
);
my $tcp = Net::Frame::Layer::TCP->new(
   dst => 22,
   options => "\x02\x04\x54\x0b",
);

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

print $oSimple->print."\n";
print unpack('H*', $oSimple->raw)."\n";

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