NetPacket::ICMP(3)
π NetPacket::ICMP β the manual, but make it cute π
okay so bestie, this is the NetPacket::ICMP(3) page from the User Contributed Perl Documentation, and it's literally all about building and taking apart ICMP (Internet Control Message Protocol) packets. it's giving low-level network gossip and honestly? we're obsessed. π¦
β¨ NAME β¨
NetPacket::ICMP β Assemble and disassemble ICMP (Internet Control Message Protocol) packets.
πΈ VERSION πΈ
version 1.8.0
π SYNOPSIS π
use NetPacket::ICMP;
$icmp_obj = NetPacket::ICMP->decode($raw_pkt);
$icmp_pkt = NetPacket::ICMP->encode();
$icmp_data = NetPacket::ICMP::strip($raw_pkt);
π DESCRIPTION π
NetPacket::ICMP provides a set of routines for assembling and disassembling packets using ICMP (Internet Control Message Protocol). no cap, that's the whole vibe. π«Ά
π§ Methods
NetPacket::ICMP->decode([RAW PACKET])β Decode the raw packet data given and return an object containing instance data. β οΈ heads up bestie: this method will quite happily decode garbage input. it does not care. it will eat trash and thank you for it. It is the responsibility of the programmer to ensure valid packet data is passed to this method. so like, that's on you, not on it. πNetPacket::ICMP->encode()β Return an ICMP packet encoded with the instance data specified. slay, it builds the packet from whatever instance data you gave it. β¨
π Functions
NetPacket::ICMP::strip([RAW PACKET])β Return the encapsulated data (or payload) contained in the ICMP packet. it strips the ICMP wrapper off and hands you the lil payload inside. π
π Instance data
The instance data for the NetPacket::ICMP object consists of the following fields.
typeβ The ICMP message type of this packet.codeβ The ICMP message code of this packet.cksumβ The checksum for this packet.dataβ The encapsulated data (payload) for this packet.
π Exports
default
- none
exportable
ICMP message types:
ICMP_ECHOREPLY ICMP_UNREACH ICMP_SOURCEQUENCH
ICMP_REDIRECT ICMP_ECHO ICMP_ROUTERADVERT
ICMP_ROUTERSOLICIT ICMP_TIMXCEED ICMP_PARAMPROB
ICMP_TSTAMP ICMP_TSTAMPREPLY ICMP_IREQ ICMP_IREQREPLY
ICMP_MASKREQ ICMP_MASKREPLY
tags
The following tags group together related exportable items.
:types
ICMP_ECHOREPLY ICMP_UNREACH ICMP_SOURCEQUENCH
ICMP_REDIRECT ICMP_ECHO ICMP_ROUTERADVERT
ICMP_ROUTERSOLICIT ICMP_TIMXCEED ICMP_PARAMPROB
ICMP_TSTAMP ICMP_TSTAMPREPLY ICMP_IREQ
ICMP_IREQREPLY ICMP_MASKREQ ICMP_MASKREPLY
:stripβ Import the strip functionicmp_strip.:ALLβ All the above exportable items. the whole buffet, bestie. π½οΈ
π₯ EXAMPLE π₯
The following example prints the ICMP type, code, and checksum fields. it's short, it's iconic, it ate:
#!/usr/bin/perl -w
use strict;
use Net::PcapUtils;
use NetPacket::Ethernet qw(:strip);
use NetPacket::IP qw(:strip);
use NetPacket::ICMP;
sub process_pkt {
my ($user, $hdr, $pkt) = @_;
my $ip_obj = NetPacket::IP->decode(eth_strip($pkt));
my $icmp_obj = NetPacket::ICMP->decode(ip_strip($ip_obj));
print("Type: $icmp_obj->{type}\n");
print("Code: $icmp_obj->{code}\n");
print("Checksum: $icmp_obj->{cksum}\n\n");
}
Net::PcapUtils::loop(\&process_pkt, FILTER => 'icmp');
π¦ TODO π¦
Create constants
π COPYRIGHT π
Copyright (c) 2001 Tim Potter and Stephanie Wehner.
Copyright (c) 1995,1996,1997,1998,1999 ANU and CSIRO on behalf of the participants in the CRC for Advanced Computational Systems ('ACSys').
This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
π AUTHOR π
Tim Potter <tpot@samba.org>
Stephanie Wehner <atrak@itsx.com>
and that's the whole page, bestie!! this was perl v5.42.0, dated 2026-02-05, and it's the NetPacket::ICMP(3) manpage β go forth and decode responsibly (or don't, it'll decode garbage anyway π). mwah! π
π¦ where this page comes from
- fedora 43: perl-NetPacket 1.8.0-1.fc43 Β· Artistic-2.0 AND (GPL-1.0-or-later OR Artistic-1.0-Perl)
- fedora 44: perl-NetPacket 1.8.0-1.fc44 Β· Artistic-2.0 AND (GPL-1.0-or-later OR Artistic-1.0-Perl)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms