@@ -1,4 +1,5 @@
+# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.016.
use strict;
use warnings;
@@ -19,13 +20,16 @@ my %module_build_args = (
"Yanick Champoux <yanick\@cpan.org>"
],
"dist_name" => "NetPacket",
- "dist_version" => "1.4.1",
+ "dist_version" => "1.5.0",
"license" => "artistic_2",
"module_name" => "NetPacket",
"recommends" => {},
"recursive_test_files" => 1,
"requires" => {
+ "Carp" => 0,
"constant" => 0,
+ "parent" => 0,
+ "perl" => "v5.10.0",
"strict" => 0,
"vars" => 0,
"warnings" => 0
@@ -40,17 +44,18 @@ my %module_build_args = (
);
+my %fallback_build_requires = (
+ "File::Spec" => 0,
+ "IO::Handle" => 0,
+ "IPC::Open3" => 0,
+ "Module::Build" => "0.3601",
+ "Test::More" => "0.88"
+);
+
+
unless ( eval { Module::Build->VERSION(0.4004) } ) {
- my $tr = delete $module_build_args{test_requires};
- my $br = $module_build_args{build_requires};
- for my $mod ( keys %$tr ) {
- if ( exists $br->{$mod} ) {
- $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod};
- }
- else {
- $br->{$mod} = $tr->{$mod};
- }
- }
+ delete $module_build_args{test_requires};
+ $module_build_args{build_requires} = \%fallback_build_requires;
}
my $build = Module::Build->new(%module_build_args);
@@ -6,9 +6,16 @@ make this distribution what it is, either via code contributions,
patches, bug reports, help with troubleshooting, etc. A huge
thank to all of them.
- * Ben Magistro <koncept1@gmail.com>
- * Lubomir Rintel <lkundrak@v3.sk>
- * Robin Lee <cheeselee@fedoraproject.org>
- * Stan Schwertly <stan@linode.com>
- * Stephanie Wehner <atrak@cpan.org>
- * Tim Potter <timpotter@cpan.org>
+ * Andreas Schwab <schwab@suse.de>
+ * Ben Magistro <koncept1@gmail.com>
+ * Daniel Collins <solemnwarning@solemnwarning.net>
+ * Dinar Valeev <dvaleev@suse.de>
+ * Lubomir Rintel <lkundrak@v3.sk>
+ * Neil Bowers <neil@bowers.com>
+ * Robin Lee <cheeselee@fedoraproject.org>
+ * Stan Schwertly <stan@linode.com>
+ * Stephanie Wehner <atrak@cpan.org>
+ * Tim Potter <timpotter@cpan.org>
+ * fschlich <fsfs@debian.org>
+
+
@@ -1,5 +1,40 @@
revision history for NetPacket
+1.5.0 2014-06-15
+ [ENHANCEMENTS]
+ - Addition of NetPacket::IPX. (Daniel Collins)
+ - NetPacket::Ethernet implements 'encode'. (RT#93928, Guido Hungerbuehler)
+
+ [STATISTICS]
+ - code churn: 7 files changed, 337 insertions(+), 13 deletions(-)
+
+1.4.4 2013-11-30
+ [BUG FIXES]
+ - NetPacket::USBMon: also handle big endian perl without quad type.
+ (GH#5, Andreas Schwab)
+ - Typo fix in comments. (GH#6, fschlich)
+
+ [STATISTICS]
+ - code churn: 3 files changed, 13 insertions(+), 4 deletions(-)
+
+1.4.3 2013-10-03
+ [BUG FIXES]
+ - Unpack data in LittleEndian format. (GH#4, k0da)
+
+ [STATISTICS]
+ - code churn: 3 files changed, 62 insertions(+), 27 deletions(-)
+
+1.4.2 2013-09-25
+ [BUG FIXES]
+ - Dist::Zilla::Plugin::Test::Compile was causing test to potentially hang
+ on Windows. (reported by Karen Etheridge)
+
+ [MISC]
+ - Tidy up the changelog. (GH#3, Neil Bowers)
+
+ [STATISTICS]
+ - code churn: 2 files changed, 46 insertions(+), 20 deletions(-)
+
1.4.1 2013-09-05
[BUG FIXES]
- Test was using Errno constant and failing on some platforms.
@@ -63,18 +98,6 @@ revision history for NetPacket
as the license of the patch clashes with the license of the
distribution. (RT#62197)
-0.41_0
- - Fixed bug 18941 - NetPacket::IP includes trailing trash bytes in
- $ip->{data}
- - Fixed bug 7010 - IP flags field lost in IP::encode()
- - Added Build.PL
- - Moved history off the README file into this one (Changes)
- - Moved module structure to /lib
- - Version now gathered from NetPacket.pm
- - META.yml added to MANIFEST
- - Added myself (Yanick) as author
- - Switched to major.minor.revision version notation
-
0.43.2 2010-10-11
- Change the COPYRIGHT sections of the pods to match the Artistic 2.0
license. (RT#60954)
@@ -92,13 +115,30 @@ revision history for NetPacket
- Updated license to Artistic 2.0
- Fixed bad call to 'data()' in ICMP. Thanks to Ventz Petkov. (RT#52627)
-0.41.1
+0.41.1 2009-01-06
- Fixed bug 37931: export of ICMP_MASKREQ
- Fixed UDP and TCP checksums for odd-sized packets
- Fixed import from NetPacket::UDP
- Fixed bug 37931: export of ICMP_MASKREQ
- Added git repo and bug tracking info to META.yml
-0.04
+0.41.0_0 2008-12-20
+ - Fixed bug 18941 - NetPacket::IP includes trailing trash bytes in
+ $ip->{data}
+ - Fixed bug 7010 - IP flags field lost in IP::encode()
+ - Added Build.PL
+ - Moved history off the README file into this one (Changes)
+ - Moved module structure to /lib
+ - Version now gathered from NetPacket.pm
+ - META.yml added to MANIFEST
+ - Added myself (Yanick) as author
+ - Switched to major.minor.revision version notation
+
+0.04 2003-05-21
- Checksum offset fix, thanks to J. Hoagland for pointing this out.
+0.03 2001-07-30
+
+0.01 1999-04-24
+ - First release by TIMPOTTER
+
@@ -1,4 +1,4 @@
-This software is Copyright (c) 2013 by Tim Potter and Stephanie Wehner.
+This software is Copyright (c) 2014 by Tim Potter and Stephanie Wehner.
This is free software, licensed under:
@@ -15,6 +15,7 @@ lib/NetPacket/Ethernet.pm
lib/NetPacket/ICMP.pm
lib/NetPacket/IGMP.pm
lib/NetPacket/IP.pm
+lib/NetPacket/IPX.pm
lib/NetPacket/TCP.pm
lib/NetPacket/UDP.pm
lib/NetPacket/USBMon.pm
@@ -27,6 +28,7 @@ t/general.t
t/icmp.t
t/ip_encode.t
t/ip_trailing.t
+t/ipx.t
t/tcp.t
t/udp-checksum.t
t/udp.t
@@ -6,7 +6,7 @@
"Yanick Champoux <yanick@cpan.org>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 4.300037, CPAN::Meta::Converter version 2.120921",
+ "generated_by" : "Dist::Zilla version 5.016, CPAN::Meta::Converter version 2.140640",
"license" : [
"artistic_2"
],
@@ -33,7 +33,10 @@
},
"runtime" : {
"requires" : {
+ "Carp" : "0",
"constant" : "0",
+ "parent" : "0",
+ "perl" : "v5.10.0",
"strict" : "0",
"vars" : "0",
"warnings" : "0"
@@ -51,46 +54,49 @@
"provides" : {
"NetPacket" : {
"file" : "lib/NetPacket.pm",
- "version" : "v1.4.1"
+ "version" : "v1.5.0"
},
"NetPacket::ARP" : {
"file" : "lib/NetPacket/ARP.pm",
- "version" : "v1.4.1"
+ "version" : "v1.5.0"
},
"NetPacket::Ethernet" : {
"file" : "lib/NetPacket/Ethernet.pm",
- "version" : "v1.4.1"
+ "version" : "v1.5.0"
},
"NetPacket::ICMP" : {
"file" : "lib/NetPacket/ICMP.pm",
- "version" : "v1.4.1"
+ "version" : "v1.5.0"
},
"NetPacket::IGMP" : {
"file" : "lib/NetPacket/IGMP.pm",
- "version" : "v1.4.1"
+ "version" : "v1.5.0"
},
"NetPacket::IP" : {
"file" : "lib/NetPacket/IP.pm",
- "version" : "v1.4.1"
+ "version" : "v1.5.0"
+ },
+ "NetPacket::IPX" : {
+ "file" : "lib/NetPacket/IPX.pm",
+ "version" : "v1.5.0"
},
"NetPacket::TCP" : {
"file" : "lib/NetPacket/TCP.pm",
- "version" : "v1.4.1"
+ "version" : "v1.5.0"
},
"NetPacket::UDP" : {
"file" : "lib/NetPacket/UDP.pm",
- "version" : "v1.4.1"
+ "version" : "v1.5.0"
},
"NetPacket::USBMon" : {
"file" : "lib/NetPacket/USBMon.pm",
- "version" : "v1.4.1"
+ "version" : "v1.5.0"
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
- "mailto" : "bug-netpacket at rt.cpan.org",
- "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=NetPacket"
+ "web" : "https://github.com/yanick/netpacket/issues"
},
"homepage" : "http://search.cpan.org/dist/NetPacket/",
"repository" : {
@@ -99,15 +105,20 @@
"web" : "https://github.com/yanick/netpacket"
}
},
- "version" : "1.4.1",
+ "version" : "1.5.0",
"x_authority" : "cpan:YANICK",
"x_contributors" : [
+ "Andreas Schwab <schwab@suse.de>",
"Ben Magistro <koncept1@gmail.com>",
+ "Daniel Collins <solemnwarning@solemnwarning.net>",
+ "Dinar Valeev <dvaleev@suse.de>",
"Lubomir Rintel <lkundrak@v3.sk>",
+ "Neil Bowers <neil@bowers.com>",
"Robin Lee <cheeselee@fedoraproject.org>",
"Stan Schwertly <stan@linode.com>",
"Stephanie Wehner <atrak@cpan.org>",
- "Tim Potter <timpotter@cpan.org>"
+ "Tim Potter <timpotter@cpan.org>",
+ "fschlich <fsfs@debian.org>"
]
}
@@ -5,63 +5,74 @@ author:
- 'Stephanie Wehner <atrak@itsx.com>'
- 'Yanick Champoux <yanick@cpan.org>'
build_requires:
- File::Spec: 0
- IO::Handle: 0
- IPC::Open3: 0
- Module::Build: 0.3601
- Test::More: 0.88
+ File::Spec: '0'
+ IO::Handle: '0'
+ IPC::Open3: '0'
+ Module::Build: '0.3601'
+ Test::More: '0.88'
configure_requires:
- Module::Build: 0.3601
+ Module::Build: '0.3601'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.300037, CPAN::Meta::Converter version 2.120921'
+generated_by: 'Dist::Zilla version 5.016, CPAN::Meta::Converter version 2.140640'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: NetPacket
provides:
NetPacket:
file: lib/NetPacket.pm
- version: v1.4.1
+ version: v1.5.0
NetPacket::ARP:
file: lib/NetPacket/ARP.pm
- version: v1.4.1
+ version: v1.5.0
NetPacket::Ethernet:
file: lib/NetPacket/Ethernet.pm
- version: v1.4.1
+ version: v1.5.0
NetPacket::ICMP:
file: lib/NetPacket/ICMP.pm
- version: v1.4.1
+ version: v1.5.0
NetPacket::IGMP:
file: lib/NetPacket/IGMP.pm
- version: v1.4.1
+ version: v1.5.0
NetPacket::IP:
file: lib/NetPacket/IP.pm
- version: v1.4.1
+ version: v1.5.0
+ NetPacket::IPX:
+ file: lib/NetPacket/IPX.pm
+ version: v1.5.0
NetPacket::TCP:
file: lib/NetPacket/TCP.pm
- version: v1.4.1
+ version: v1.5.0
NetPacket::UDP:
file: lib/NetPacket/UDP.pm
- version: v1.4.1
+ version: v1.5.0
NetPacket::USBMon:
file: lib/NetPacket/USBMon.pm
- version: v1.4.1
+ version: v1.5.0
requires:
- constant: 0
- strict: 0
- vars: 0
- warnings: 0
+ Carp: '0'
+ constant: '0'
+ parent: '0'
+ perl: v5.10.0
+ strict: '0'
+ vars: '0'
+ warnings: '0'
resources:
- bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=NetPacket
+ bugtracker: https://github.com/yanick/netpacket/issues
homepage: http://search.cpan.org/dist/NetPacket/
repository: https://github.com/yanick/netpacket.git
-version: 1.4.1
+version: 1.5.0
x_authority: cpan:YANICK
x_contributors:
+ - 'Andreas Schwab <schwab@suse.de>'
- 'Ben Magistro <koncept1@gmail.com>'
+ - 'Daniel Collins <solemnwarning@solemnwarning.net>'
+ - 'Dinar Valeev <dvaleev@suse.de>'
- 'Lubomir Rintel <lkundrak@v3.sk>'
+ - 'Neil Bowers <neil@bowers.com>'
- 'Robin Lee <cheeselee@fedoraproject.org>'
- 'Stan Schwertly <stan@linode.com>'
- 'Stephanie Wehner <atrak@cpan.org>'
- 'Tim Potter <timpotter@cpan.org>'
+ - 'fschlich <fsfs@debian.org>'
@@ -2,7 +2,7 @@ NAME
NetPacket - assemble/disassemble network packets at the protocol level
VERSION
- version 1.4.1
+ version 1.5.0
SYNOPSIS
# NetPacket is a base class only
@@ -4,7 +4,7 @@ NetPacket - assemble/disassemble network packets at the protocol level
# VERSION
-version 1.4.1
+version 1.5.0
# SYNOPSIS
@@ -43,14 +43,14 @@ This will hopefully lead to a consistent namespace making the
Content names are all lowercase, with underscores separating multiple
words. The following abbreviations are recommended:
- Word Abbreviation
- --------------------------------
- source src
- destination dest
- checksum cksum
- identifier id
- version ver
- protocol proto
+ Word Abbreviation
+ --------------------------------
+ source src
+ destination dest
+ checksum cksum
+ identifier id
+ version ver
+ protocol proto
## Required Methods
@@ -62,22 +62,22 @@ Every NetPacket:: object should have the following fields.
- \_parent
-A link to the parent `NetPacket::` object in which this
-`NetPacket::` object is encaulated. This field is undefined if there
-is no parent object.
+ A link to the parent `NetPacket::` object in which this
+ `NetPacket::` object is encaulated. This field is undefined if there
+ is no parent object.
- \_frame
-A copy of the raw data of the packet.
+ A copy of the raw data of the packet.
- data
-This field should contain the data encapsulated in the packet (i.e any
-headers or trailers stripped off) or undef if the packet contains no
-data. Note that in this sense, "data" is taken to mean information
-not relevant to the particular protocol being decoded. For example,
-an ARP packet contains many header fields but no data. A UDP datagram,
-however contains header fields and a payload.
+ This field should contain the data encapsulated in the packet (i.e any
+ headers or trailers stripped off) or undef if the packet contains no
+ data. Note that in this sense, "data" is taken to mean information
+ not relevant to the particular protocol being decoded. For example,
+ an ARP packet contains many header fields but no data. A UDP datagram,
+ however contains header fields and a payload.
# SEE ALSO
@@ -1,5 +1,5 @@
This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.68.
+signed via the Module::Signature module, version 0.73.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
@@ -14,27 +14,28 @@ not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 ca0e57f2cf703ff0e0459ced37bbac90f0e86a17 Build.PL
-SHA1 8678bf3cb46c9f3cb1165844f6e39021ce2081d2 CONTRIBUTORS
-SHA1 1213e8292ff3b944f8cb9e15044e0d2512cd9ab0 Changes
+SHA1 1b3b8ce9149e7ee596b7286f6a785c9fd179629b Build.PL
+SHA1 6d4b389c66e3c69871556292f6a188b4efa9b008 CONTRIBUTORS
+SHA1 b3533893dd115bc20f5936d169aa2bd75c8c9661 Changes
SHA1 29b0b7b9d088441a05d8786d0dc4bb3bd558d205 INSTALL
-SHA1 c2cbad0911cac62d6016e01230686f431b8e8e79 LICENSE
-SHA1 af5b779acd642a12e7e5d7eb2a76278239fdada8 MANIFEST
-SHA1 c422f3971b944b3270ff6b86800276f9388f77b9 META.json
-SHA1 ce6d4da9fa8eeaa2e9f873dff3202ccb2cf0fe3d META.yml
-SHA1 fdd6abfaa7078155cc5913256bf72c336301b3f6 README
-SHA1 fefcdb5ccb3b5d82e02f8b6d612f2c78607f714e README.mkdn
-SHA1 22482c6297a8c473fd29b55f16ce70a7fefae4d7 lib/NetPacket.pm
-SHA1 957716750df00a60d82293832aa04da00e9cd5e0 lib/NetPacket/ARP.pm
-SHA1 01eabeedc165ff91ad963bcae2bf48ac9d3bdbe9 lib/NetPacket/Ethernet.pm
-SHA1 e41d7f6d10e9adb70b9b9611b3ed803641ac2a24 lib/NetPacket/ICMP.pm
-SHA1 26d06357e5783010f597c1778331fb91fcd339bc lib/NetPacket/IGMP.pm
-SHA1 9d070cb139cd35ab161b19ca213d752c1debdccc lib/NetPacket/IP.pm
-SHA1 722ac37568a58da5fc4cc66723c013e7e63e77e0 lib/NetPacket/TCP.pm
-SHA1 c15cc77827c01211fa4fb33a66c6698de328bfd5 lib/NetPacket/UDP.pm
-SHA1 c867b2f0ba338d01ca55e452394e32d26f1eb524 lib/NetPacket/USBMon.pm
-SHA1 73a132106eac2c407a4dbcd26f518a8c9c094c28 t/00-compile.t
-SHA1 e546e4fa1eaf515173636be6723fc09726dddf79 t/000-report-versions-tiny.t
+SHA1 15cc4ac0af97b81cb0c007f2787d5c0ccc2369c3 LICENSE
+SHA1 84d08ee7c94fa8611dab00cc828d5db3b379bd31 MANIFEST
+SHA1 da35b758480b3cde1f2e8694a399711f6d189f96 META.json
+SHA1 04b9f41ee54ec306c96800eb37e31aca5cd07afa META.yml
+SHA1 09ee78f8f289f8536e0ad7b2027537927dfd0177 README
+SHA1 c0b8ab56fd1ed17ef2005dba9cbbf3e7220fdf77 README.mkdn
+SHA1 5b9a45d18fbc10d7f9745d451073f491ec9bb3c1 lib/NetPacket.pm
+SHA1 a950a7b8944bfce2a4d5481407fbf363d460b6fa lib/NetPacket/ARP.pm
+SHA1 8f3b1c9ce837eb70be34fa4ba79fb7f7e05d61bf lib/NetPacket/Ethernet.pm
+SHA1 e4cea7835886b2b57ed9d36cf4732acc5e25c9fe lib/NetPacket/ICMP.pm
+SHA1 0371c6b658e78df082692683f9bebcc46b574067 lib/NetPacket/IGMP.pm
+SHA1 97f4340999bef06e6fc48344a75d9b356c562f16 lib/NetPacket/IP.pm
+SHA1 59234cb8c88dd0bf0a746a6a664ab9c0b5ee64dd lib/NetPacket/IPX.pm
+SHA1 9c712ca656e2c1452c95fc32df1e03565f5a5db7 lib/NetPacket/TCP.pm
+SHA1 b118dab577f1072e3f0a0f77c4e1c12301300b2a lib/NetPacket/UDP.pm
+SHA1 faa649a6bedfa1fa67698b6da93a5d94a2187994 lib/NetPacket/USBMon.pm
+SHA1 9ad67fbe6012ef917d6ee6c81a3a9c9c347fed47 t/00-compile.t
+SHA1 fa8876fd8b406bf5d190c1d211be9b726b7bffaf t/000-report-versions-tiny.t
SHA1 2f95a288a42eed0173859c5bb9d37caee7e4b26b t/bug-37931.t
SHA1 721a206d861139f8f73081b8d337bfcdce4247e5 t/checksum.t
SHA1 45f23540d419a608363a53ed11b81c589866406e t/ethernet.t
@@ -42,14 +43,15 @@ SHA1 382d9d077e64a0ea5ee3263579cbc03df0e5a003 t/general.t
SHA1 58f7294a0c74eedb982f75b1c8e8bc9fa5395288 t/icmp.t
SHA1 a22909fb4a8ce8621107618ef50c6f92a7a6d36a t/ip_encode.t
SHA1 1d4a9e2b54461f15aab9557a081db42eaef2c4b0 t/ip_trailing.t
+SHA1 7f4638ca19b3a50f751e10a533579d6f81e6a52f t/ipx.t
SHA1 bb7498ea4eba6a9df548038c1ad77960ee1633fb t/tcp.t
SHA1 540bff42594ee78beb63a7316a4478bc58d7e37b t/udp-checksum.t
SHA1 35bfbabbd32ddf83a0ac49db63f69de9ff6eadb2 t/udp.t
SHA1 86e62e4a5bceec942b536d2b29f7910f883c6387 t/usbmon.t
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.11 (GNU/Linux)
+Version: GnuPG v1
-iEYEARECAAYFAlIpHFUACgkQ34Hwf+GwC4wFqACfbKRziJ31sbmFab9Xh7v7IzxU
-yGwAnA0UTlVDlf+jvbv5ixP25DcLn4Rl
-=i9AK
+iEYEARECAAYFAlOdwfcACgkQ34Hwf+GwC4zPGwCg1SRfngjsk/FOI3euDIY2ssT8
+LP0AnisbzRal7tF6H5zyc0VcYgfUenm8
+=lsW4
-----END PGP SIGNATURE-----
@@ -2,11 +2,8 @@ package NetPacket::ARP;
BEGIN {
$NetPacket::ARP::AUTHORITY = 'cpan:YANICK';
}
-{
- $NetPacket::ARP::VERSION = '1.4.1';
-}
# ABSTRACT: Assemble and disassemble ARP (Address Resolution Protocol) packets.
-
+$NetPacket::ARP::VERSION = '1.5.0';
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@@ -112,7 +109,7 @@ NetPacket::ARP - Assemble and disassemble ARP (Address Resolution Protocol) pack
=head1 VERSION
-version 1.4.1
+version 1.5.0
=head1 SYNOPSIS
@@ -2,11 +2,8 @@ package NetPacket::Ethernet;
BEGIN {
$NetPacket::Ethernet::AUTHORITY = 'cpan:YANICK';
}
-{
- $NetPacket::Ethernet::VERSION = '1.4.1';
-}
# ABSTRACT: Assemble and disassemble ethernet packets.
-
+$NetPacket::Ethernet::VERSION = '1.5.0';
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@@ -130,7 +127,13 @@ sub strip {
#
sub encode {
- die("Not implemented");
+ my ($self) = shift;
+
+ (my $dest = $self->{src_mac}) =~ s/://g;
+ (my $src = $self->{dest_mac}) =~ s/://g;
+
+ my $frame = pack('H12H12n a*', $dest, $src, 0x0800, $self->{data});
+ return $frame;
}
#
@@ -149,7 +152,7 @@ NetPacket::Ethernet - Assemble and disassemble ethernet packets.
=head1 VERSION
-version 1.4.1
+version 1.5.0
=head1 SYNOPSIS
@@ -2,11 +2,8 @@ package NetPacket::ICMP;
BEGIN {
$NetPacket::ICMP::AUTHORITY = 'cpan:YANICK';
}
-{
- $NetPacket::ICMP::VERSION = '1.4.1';
-}
# ABSTRACT: Assemble and disassemble ICMP (Internet Control Message Protocol) packets.
-
+$NetPacket::ICMP::VERSION = '1.5.0';
use strict;
use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@@ -156,7 +153,7 @@ NetPacket::ICMP - Assemble and disassemble ICMP (Internet Control Message Protoc
=head1 VERSION
-version 1.4.1
+version 1.5.0
=head1 SYNOPSIS
@@ -6,11 +6,8 @@ package NetPacket::IGMP;
BEGIN {
$NetPacket::IGMP::AUTHORITY = 'cpan:YANICK';
}
-{
- $NetPacket::IGMP::VERSION = '1.4.1';
-}
# ABSTRACT: Assemble and disassemble IGMP (Internet Group Mangement Protocol) packets.
-
+$NetPacket::IGMP::VERSION = '1.5.0';
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@@ -154,7 +151,7 @@ NetPacket::IGMP - Assemble and disassemble IGMP (Internet Group Mangement Protoc
=head1 VERSION
-version 1.4.1
+version 1.5.0
=head1 SYNOPSIS
@@ -7,11 +7,8 @@ package NetPacket::IP;
BEGIN {
$NetPacket::IP::AUTHORITY = 'cpan:YANICK';
}
-{
- $NetPacket::IP::VERSION = '1.4.1';
-}
# ABSTRACT: Assemble and disassemble IP (Internet Protocol) packets.
-
+$NetPacket::IP::VERSION = '1.5.0';
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use NetPacket;
@@ -188,21 +185,28 @@ sub encode {
$src_ip = gethostbyname($self->{src_ip});
$dest_ip = gethostbyname($self->{dest_ip});
- # construct header to calculate the checksum
- $hdr = pack('CCnnnCCna4a4a*', $tmp, $self->{tos},$self->{len},
- $self->{id}, $offset, $self->{ttl}, $self->{proto},
- $zero, $src_ip, $dest_ip, $self->{options});
+ my $fmt = 'CCnnnCCna4a4a*';
+ my @pkt = ($tmp, $self->{tos},$self->{len},
+ $self->{id}, $offset, $self->{ttl}, $self->{proto},
+ $zero, $src_ip, $dest_ip);
+ # change format and package in case of IP options
+ if(defined $self->{options}){
+ $fmt = 'CCnnnCCna4a4a*a*';
+ push(@pkt, $self->{options});
+ }
+ # construct header to calculate the checksum
+ $hdr = pack($fmt, @pkt);
$self->{cksum} = NetPacket::htons(NetPacket::in_cksum($hdr));
+ $pkt[7] = $self->{cksum};
# make the entire packet
- $packet = pack('CCnnnCCna4a4a*a*', $tmp, $self->{tos},$self->{len},
- $self->{id}, $offset, $self->{ttl}, $self->{proto},
- $self->{cksum}, $src_ip, $dest_ip, $self->{options},
- $self->{data});
+ if(defined $self->{data}){
+ push(@pkt, $self->{data});
+ }
+ $packet = pack($fmt, @pkt);
return($packet);
-
}
#
@@ -221,7 +225,7 @@ NetPacket::IP - Assemble and disassemble IP (Internet Protocol) packets.
=head1 VERSION
-version 1.4.1
+version 1.5.0
=head1 SYNOPSIS
@@ -0,0 +1,243 @@
+use strict;
+use warnings;
+
+package NetPacket::IPX;
+BEGIN {
+ $NetPacket::IPX::AUTHORITY = 'cpan:YANICK';
+}
+# ABSTRACT: Assemble and disassemble IPX packets
+$NetPacket::IPX::VERSION = '1.5.0';
+use parent qw(NetPacket);
+
+use Carp;
+
+sub new
+{
+ my ($class, %packet) = @_;
+
+ foreach my $key(qw(tc type dest_network dest_node dest_socket
+ src_network src_node src_socket data))
+ {
+ croak("Missing $key argument") unless(defined($packet{$key}));
+ }
+
+ croak("Invalid tc argument") unless($packet{tc} =~ m/^\d+$/ && $packet{tc} <= 255);
+ croak("Invalid type argument") unless($packet{type} =~ m/^\d+$/ && $packet{type} <= 255);
+
+ _check_address("destination", $packet{dest_network}, $packet{dest_node}, $packet{dest_socket});
+ _check_address("source", $packet{src_network}, $packet{src_node}, $packet{src_socket});
+
+ return bless(\%packet, $class);
+}
+
+sub _check_address
+{
+ my ($direction, $network, $node, $socket) = @_;
+
+ my $OCTET = qr/[0-9A-F][0-9A-F]?/i;
+
+ croak("Invalid $direction network") unless($network =~ m/^$OCTET(:$OCTET){3}$/);
+ croak("Invalid $direction node") unless($node =~ m/^$OCTET(:$OCTET){5}$/);
+ croak("Invalid $direction socket") unless($socket =~ m/^\d+$/ && $socket <= 65535);
+}
+
+#
+# Decode the packet
+#
+
+sub decode
+{
+ my ($class, $pkt, $parent) = @_;
+
+ my $self = bless({
+ _parent => $parent,
+ _frame => $pkt,
+ }, $class);
+
+ if(defined($pkt))
+ {
+ # Use array slices to capture the appropriate number of bytes
+ # from each address field.
+
+ my (
+ $checksum, $length, $tc, $type,
+ @dst_network, @dst_node, $dst_socket,
+ @src_network, @src_node, $src_socket,
+ );
+
+ (
+ $checksum, $length, $tc, $type,
+ @dst_network[0..3], @dst_node[0..5], $dst_socket,
+ @src_network[0..3], @src_node[0..5], $src_socket,
+ ) = unpack("nnCC C4C6n C4C6n", $pkt);
+
+ $self->{tc} = $tc;
+ $self->{type} = $type;
+
+ $self->{dest_network} = _addr_to_string(@dst_network);
+ $self->{dest_node} = _addr_to_string(@dst_node);
+ $self->{dest_socket} = $dst_socket;
+
+ $self->{src_network} = _addr_to_string(@src_network);
+ $self->{src_node} = _addr_to_string(@src_node);
+ $self->{src_socket} = $src_socket;
+
+ $self->{data} = substr($pkt, 30);
+ }
+
+ return $self;
+}
+
+#
+# Strip header from packet and return the data contained in it
+#
+
+sub strip {
+ my ($pkt) = @_;
+ return NetPacket::IPX->decode($pkt)->{data};
+}
+
+#
+# Encode a packet
+#
+
+sub encode
+{
+ my ($self) = @_;
+
+ return pack("nnCC", 0xFFFF, 30 + length($self->{data}), $self->{tc}, $self->{type})
+ ._addr_from_string($self->{dest_network})
+ ._addr_from_string($self->{dest_node})
+ .pack("n", $self->{dest_socket})
+ ._addr_from_string($self->{src_network})
+ ._addr_from_string($self->{src_node})
+ .pack("n", $self->{src_socket})
+ .$self->{data};
+}
+
+sub _addr_to_string
+{
+ my (@bytes) = @_;
+ return join(":", map { sprintf("%02X", $_) } @bytes);
+}
+
+sub _addr_from_string
+{
+ my ($string) = @_;
+ return join("", map { pack("C", hex($_)) } split(m/:/, $string));
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+NetPacket::IPX - Assemble and disassemble IPX packets
+
+=head1 VERSION
+
+version 1.5.0
+
+=head1 SYNOPSIS
+
+ use NetPacket::IPX;
+
+ my $ipx = NetPacket::IPX->decode($raw_pkt);
+
+ my $raw_pkt = $ipx->encode();
+
+ my $ipx = NetPacket::IPX->new(
+ tc => 0,
+ type => 1,
+
+ dest_network => "00:00:00:01",
+ dest_node => "FF:FF:FF:FF:FF:FF",
+ dest_socket => 1234,
+
+ src_network => "00:00:00:01",
+ src_node => "12:34:56:78:90:AB",
+ src_socket => 5678,
+
+ data => "...",
+ );
+
+=head1 DESCRIPTION
+
+C<NetPacket::IPX> is a C<NetPacket> class for encoding and decoding IPX packets.
+
+=head1 METHODS
+
+=head2 decode($raw_pkt)
+
+Decode a packet and return a C<NetPacket::IPX> instance.
+
+=head2 encode()
+
+Return the encoded form of a C<NetPacket::IPX> instance.
+
+=head2 new(%options)
+
+Construct a C<NetPacket::IPX> instance with arbitrary contents. All arguments
+listed in the SYNOPSIS are mandatory.
+
+Throws an exception on missing/invalid arguments.
+
+=head1 INSTANCE DATA
+
+The following fields are available in a C<NetPacket::IPX> instance:
+
+=over
+
+=item tc
+
+Traffic Control field, the number of routers an IPX packet has passed through.
+
+=item type
+
+Type field.
+
+=item dest_network
+
+Destination network number, in the format C<XX:XX:XX:XX>.
+
+=item dest_node
+
+Destination node number, in the format C<XX:XX:XX:XX:XX:XX>.
+
+=item dest_socket
+
+Destination socket number.
+
+=item src_network
+
+Source network number, in the format C<XX:XX:XX:XX>.
+
+=item dest_node
+
+Source node number, in the format C<XX:XX:XX:XX:XX:XX>.
+
+=item dest_socket
+
+Source socket number.
+
+=item data
+
+Packet payload.
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright (C) 2014 Daniel Collins
+
+This module is free software. You can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 AUTHOR
+
+Daniel Collins E<lt>solemnwarning@solemnwarning.netE<gt>
+
+=cut
@@ -8,11 +8,8 @@ package NetPacket::TCP;
BEGIN {
$NetPacket::TCP::AUTHORITY = 'cpan:YANICK';
}
-{
- $NetPacket::TCP::VERSION = '1.4.1';
-}
# ABSTRACT: Assemble and disassemble TCP (Transmission Control Protocol) packets.
-
+$NetPacket::TCP::VERSION = '1.5.0';
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use NetPacket;
@@ -302,7 +299,7 @@ NetPacket::TCP - Assemble and disassemble TCP (Transmission Control Protocol) pa
=head1 VERSION
-version 1.4.1
+version 1.5.0
=head1 SYNOPSIS
@@ -6,11 +6,8 @@ package NetPacket::UDP;
BEGIN {
$NetPacket::UDP::AUTHORITY = 'cpan:YANICK';
}
-{
- $NetPacket::UDP::VERSION = '1.4.1';
-}
# ABSTRACT: Assemble and disassemble UDP (User Datagram Protocol) packets.
-
+$NetPacket::UDP::VERSION = '1.5.0';
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use NetPacket;
@@ -140,7 +137,7 @@ NetPacket::UDP - Assemble and disassemble UDP (User Datagram Protocol) packets.
=head1 VERSION
-version 1.4.1
+version 1.5.0
=head1 SYNOPSIS
@@ -321,7 +318,7 @@ netcat, but otherwise makes little sense. :) Adapt to your needs:
# replace foo in the payload with bar
$udp_obj->{data} =~ s/foo/bar/g;
- # reencode the packet
+ # re-encode the packet
$ip_obj->{data} = $udp_obj->encode($udp_obj, $ip_obj);
$data = $ip_obj->encode;
@@ -2,9 +2,9 @@ package NetPacket::USBMon;
BEGIN {
$NetPacket::USBMon::AUTHORITY = 'cpan:YANICK';
}
-{
- $NetPacket::USBMon::VERSION = '1.4.1';
-}
+#ABSTRACT: Assemble and disassemble USB packets captured via Linux USBMon interface.
+$NetPacket::USBMon::VERSION = '1.5.0';
+use 5.10.0;
use strict;
use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
@@ -65,18 +65,18 @@ sub decode
my($id, $type, $xfer_type, $epnum, $devnum, $busnum, $flag_setup,
$flag_data, $ts_sec, $ts_usec, $status, $length, $len_cap,
$s, $interval, $start_frame, $xfer_flags, $ndesc, $rest) =
- unpack('a8CCCCSCCa8liIIa8llLLa*', $packet);
+ unpack('a8CCCCS<CCa8l<i<I<I<a8l<l<L<L<a*', $packet);
- # Try to grok quads. We may loose some address information with 32-bit
+ # Try to grok quads. We may lose some address information with 32-bit
# Perl parsing 64-bit captures, or timestamp after 2038. Still the best
# we can do.
eval {
- $id = unpack ('Q', $id);
- $ts_sec = unpack ('Q', $ts_sec);
+ $id = unpack ('Q<', $id);
+ $ts_sec = unpack ('Q<', $ts_sec);
};
if ($@) {
- ($id) = unpack ('LL', $id);
- ($ts_sec) = unpack ('LL', $ts_sec);
+ ($id) = unpack ('L<L<', $id);
+ ($ts_sec) = unpack ('L<L<', $ts_sec);
}
my $self = {
@@ -115,7 +115,7 @@ sub decode
if ($setup->{bmRequestType} & USB_TYPE_VENDOR) {
($setup->{wValue}, $setup->{wIndex},
- $setup->{wLength}) = unpack('S3', $rest);
+ $setup->{wLength}) = unpack('S<3', $rest);
} else {
# Unknown setup request;
$setup->{data} = $rest;
@@ -127,7 +127,7 @@ sub decode
# Isochronous descriptors
if ($self->{xfer_type} == USB_XFER_TYPE_ISO) {
my $iso = {};
- ($iso->{error_count}, $iso->{numdesc}) = unpack('ii', $s);
+ ($iso->{error_count}, $iso->{numdesc}) = unpack('i<i<', $s);
$self->{iso} = $iso;
}
@@ -147,11 +147,11 @@ __END__
=head1 NAME
-NetPacket::USBMon
+NetPacket::USBMon - Assemble and disassemble USB packets captured via Linux USBMon interface.
=head1 VERSION
-version 1.4.1
+version 1.5.0
=head1 SYNOPSIS
@@ -8,11 +8,8 @@ package NetPacket;
BEGIN {
$NetPacket::AUTHORITY = 'cpan:YANICK';
}
-{
- $NetPacket::VERSION = '1.4.1';
-}
# ABSTRACT: assemble/disassemble network packets at the protocol level
-
+$NetPacket::VERSION = '1.5.0';
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@@ -117,7 +114,7 @@ NetPacket - assemble/disassemble network packets at the protocol level
=head1 VERSION
-version 1.4.1
+version 1.5.0
=head1 SYNOPSIS
@@ -1,9 +1,10 @@
+use 5.006;
use strict;
use warnings;
-# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.020
+# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.039
-use Test::More 0.88;
+use Test::More tests => 10 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
@@ -14,33 +15,37 @@ my @module_files = (
'NetPacket/ICMP.pm',
'NetPacket/IGMP.pm',
'NetPacket/IP.pm',
+ 'NetPacket/IPX.pm',
'NetPacket/TCP.pm',
'NetPacket/UDP.pm',
'NetPacket/USBMon.pm'
);
-my @scripts = (
-);
# no fake home requested
+my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
+
+use File::Spec;
use IPC::Open3;
use IO::Handle;
-use File::Spec;
+
+open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my @warnings;
for my $lib (@module_files)
{
- open my $stdout, '>', File::Spec->devnull or die $!;
- open my $stdin, '<', File::Spec->devnull or die $!;
+ # see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
- my $pid = open3($stdin, $stdout, $stderr, qq{$^X -Mblib -e"require q[$lib]"});
+ my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
+ binmode $stderr, ':crlf' if $^O eq 'MSWin32';
+ my @_warnings = <$stderr>;
waitpid($pid, 0);
- is($? >> 8, 0, "$lib loaded ok");
+ is($?, 0, "$lib loaded ok");
- if (my @_warnings = <$stderr>)
+ if (@_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
@@ -52,5 +57,3 @@ for my $lib (@module_files)
is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING};
-
-done_testing;
@@ -9,11 +9,11 @@ our $success = 0;
END { $success && done_testing; }
# List our own version used to generate this
-my $v = "\nGenerated by Dist::Zilla::Plugin::ReportVersions::Tiny v1.08\n";
+my $v = "\nGenerated by Dist::Zilla::Plugin::ReportVersions::Tiny v1.10\n";
eval { # no excuses!
# report our Perl details
- my $want = "any version";
+ my $want = 'v5.10.0';
$v .= "perl: $] (wanted $want) on $^O from $^X\n\n";
};
defined($@) and diag("$@");
@@ -48,15 +48,16 @@ sub pmver {
return sprintf('%-45s => %-10s%-15s%s', $module, $pmver, $wanted, "\n");
}
+eval { $v .= pmver('Carp','any version') };
eval { $v .= pmver('File::Spec','any version') };
eval { $v .= pmver('IO::Handle','any version') };
eval { $v .= pmver('IPC::Open3','any version') };
eval { $v .= pmver('Module::Build','0.3601') };
eval { $v .= pmver('Test::More','0.88') };
eval { $v .= pmver('constant','any version') };
+eval { $v .= pmver('parent','any version') };
eval { $v .= pmver('strict','any version') };
eval { $v .= pmver('vars','any version') };
-eval { $v .= pmver('version','0.9901') };
eval { $v .= pmver('warnings','any version') };
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+plan tests => 14;
+
+use_ok 'NetPacket::IPX';
+
+my $packet = ""
+ ."\xFF\xFF" # "checksum"
+ ."\x00\x2A" # header + data length
+ ."\x64" # Traffic Control
+ ."\x05" # Packet type
+
+ ."\x46\x35\x57\xFF" # Destination network
+ ."\x01\x23\x45\x67\x89\xAB" # Destination node
+ ."\xEE\xAA" # Destination socket
+
+ ."\xDE\xFF\x00\x01" # Source network
+ ."\xCD\xEF\x01\x23\x45\x67" # Source node
+ ."\xAA\xAA" # Source socket
+
+ ."\x00some \n\xFFdata";
+
+{
+ my $ipx = NetPacket::IPX->decode($packet);
+
+ isa_ok($ipx, "NetPacket::IPX");
+
+ is($ipx->{tc}, 0x64, "NetPacket::IPX->decode() decodes the tc field");
+ is($ipx->{type}, 0x05, "NetPacket::IPX->decode() decodes the type field");
+
+ is($ipx->{dest_network}, "46:35:57:FF", "NetPacket::IPX->decode() decodes the destination network field");
+ is($ipx->{dest_node}, "01:23:45:67:89:AB", "NetPacket::IPX->decode() decodes the destination node field");
+ is($ipx->{dest_socket}, 0xEEAA, "NetPacket::IPX->decode() decodes the destination socket field");
+
+ is($ipx->{src_network}, "DE:FF:00:01", "NetPacket::IPX->decode() decodes the source network field");
+ is($ipx->{src_node}, "CD:EF:01:23:45:67", "NetPacket::IPX->decode() decodes the source node field");
+ is($ipx->{src_socket}, 0xAAAA, "NetPacket::IPX->decode() decodes the source socket field");
+
+ is($ipx->{data}, "\x00some \n\xFFdata", "NetPacket::IPX->decode() extracts the packet payload");
+}
+
+{
+ my $ipx = NetPacket::IPX->new(
+ tc => 0x64,
+ type => 0x05,
+
+ dest_network => "46:35:57:fF",
+ dest_node => "1:23:45:67:89:Ab",
+ dest_socket => 0xEEAA,
+
+ src_network => "dE:fF:0:1",
+ src_node => "Cd:ef:1:23:45:67",
+ src_socket => 0xAAAA,
+
+ data => "\x00some \n\xFFdata",
+ );
+
+ isa_ok($ipx, "NetPacket::IPX");
+
+ is($ipx->encode(), $packet, "NetPacket::IPX->encode() encodes the packet correctly");
+}
+
+is(NetPacket::IPX::strip($packet), "\x00some \n\xFFdata", "NetPacket::IPX::strip() extracts the packet payload");