| 1 | # | ||
| 2 | # $Id: Layer4.pm 2005 2015-01-23 06:56:13Z gomor $ | ||
| 3 | # | ||
| 4 | package Net::Write::Layer4; | ||
| 5 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 0 | ▶ | use Net::Write::Layer qw(:constants); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 9 | use base qw(Net::Write::Layer); | ||
| 10 | __PACKAGE__->cgBuildIndices; | ||
| 11 | |||
| 12 | BEGIN { | ||
| 13 | my $osname = { | ||
| 14 | cygwin => \&_newWin32, | ||
| 15 | MSWin32 => \&_newWin32, | ||
| 16 | }; | ||
| 17 | |||
| 18 | *new = $osname->{$^O} || \&_newOther; | ||
| 19 | } | ||
| 20 | |||
| 21 | no strict 'vars'; | ||
| 22 | |||
| 23 | sub _newWin32 { | ||
| 24 | print STDERR "[-] Not possible to use layer 4 under Windows. Use layer 2 ". | ||
| 25 | "instead.\n"; | ||
| 26 | return; | ||
| 27 | } | ||
| 28 | |||
| 29 | sub _newOther { | ||
| 30 | my $self = shift->SUPER::new( | ||
| 31 | protocol => NW_IPPROTO_TCP, | ||
| 32 | family => NW_AF_INET, | ||
| 33 | @_, | ||
| 34 | ) or return; | ||
| 35 | |||
| 36 | if (! $self->[$__dst]) { | ||
| 37 | print STDERR "[-] @{[(caller(0))[3]]}: you must pass `dst' parameter\n"; | ||
| 38 | return; | ||
| 39 | } | ||
| 40 | |||
| 41 | return $self; | ||
| 42 | } | ||
| 43 | |||
| 44 | 1; | ||
| 45 | |||
| 46 | __END__ | ||