1
NetPacket version 0.41.1
3
This is a whole bunch of
4
Perl modules which I have named NetPacket::*. These modules do basic
5
disassembly of network packets of various Internet protocols. NetPacket
6
0.01 contained hooks for assembly of packets which have been implemented in
7
version 0.04 by Stephanie Wehner <atrak@itsx.com>.
9
I've used these scripts for a variety of little jobs such as snooping
10
various TCP services, gathering network traffic statistics by
11
source/destination/protocol, and for unpacking the contents of IP
12
tunnels. They're actually pretty useful. I recommend fetching and
13
installing the Net::Pcap module to actually gather packet data, and
14
for writing small scripts based on packet capture, the Net::PcapUtils
15
module is also useful.
17
At present, decoding for the following protocols has been
20
- Ethernet (802.3 and 802.2)
28
It's pretty easy to add new protocols. Just copy one of the existing
29
modules and figure out an unpack string which will unpack the
30
information in the packet and store the data into fields in the
31
namespace of the NetPacket::whatever object. More information can be
32
found in the NetPacket(3) manpage, which is the base class module.
34
I'd be interested in receiving bug reports, comments or any
35
improvements (especially additional protocols) to the NetPacket
2
NetPacket - assemble/disassemble network packets at the protocol level
8
# NetPacket is a base class only
11
"NetPacket" provides a base class for a cluster of modules related to
12
decoding and encoding of network protocols. Each "NetPacket" descendent
13
module knows how to encode and decode packets for the network protocol
14
it implements. Consult the documentation for the module in question for
15
protocol-specific implementation.
17
Note that there is no inheritance in the "NetPacket::" cluster of
18
modules other than each protocol module being a "NetPacket". This was
19
seen to be too restrictive as imposing inheritance relationships (for
20
example between the IP, UDP and TCP protocols) would make things like
21
tunneling or other unusual situations difficult.
23
WRITING YOUR OWN "NetPacket::" MODULE
24
You are encouraged to write additional "NetPacket::" modules as well as
25
improve existing ones. Contact the maintainer of the module in question
26
with your suggestions or changes.
28
The following sections are a list of suggestions and conventions for
29
writing a "NetPacket::" module.
32
When creating a module in the "NetPacket::" namespace, it is suggested
33
that you stick to a couple of conventions when naming packet contents.
34
This will hopefully lead to a consistent namespace making the
35
"NetPacket::" easier to use.
37
Content names are all lowercase, with underscores separating multiple
38
words. The following abbreviations are recommended:
41
--------------------------------
50
encode(), decode(), strip()
53
Every NetPacket:: object should have the following fields.
56
A link to the parent "NetPacket::" object in which this
57
"NetPacket::" object is encaulated. This field is undefined if there
61
A copy of the raw data of the packet.
64
This field should contain the data encapsulated in the packet (i.e
65
any headers or trailers stripped off) or undef if the packet
66
contains no data. Note that in this sense, "data" is taken to mean
67
information not relevant to the particular protocol being decoded.
68
For example, an ARP packet contains many header fields but no data.
69
A UDP datagram, however contains header fields and a payload.
72
Joel Knight has a patch for NetPacket for IPv6 support available at
73
http://www.packetmischief.ca/code/netpacket/.
76
Copyright (c) 2001 Tim Potter and Stephanie Wehner.
78
Copyright (c) 1995,1996,1997,1998,1999 ANU and CSIRO on behalf of the
79
participants in the CRC for Advanced Computational Systems ('ACSys').
81
This module is free software. You can redistribute it and/or modify it
82
under the terms of the Artistic License 2.0.
84
This program is distributed in the hope that it will be useful, but
85
without any warranty; without even the implied warranty of
86
merchantability or fitness for a particular purpose.
89
Tim Potter <tpot@samba.org>
91
Stephanie Wehner <atrak@itsx.com>
93
Yanick Champoux <yanick@cpan.org>