Net::Packet::Utils - useful subroutines used in Net::Packet
# Load all subroutines use Net::Packet::Utils qw(:all); # Load only specific subroutines use Net::Packet::Utils qw(explodeIps explodePorts); my @ips = explodeIps('192.168.0.1-254,192.168.1.1'); my @ports = explodePorts('1-1024,6000'); print "@ips\n"; print "@ports\n";
This module is not object oriented, it just implements some utilities used accros Net::Packet framework. They may be useful in other modules too, so here lies their descriptions.
Tries to resolve hostname passed as an argument. Returns its IP address.
Tries to resolve hostname passed as an argument. Returns an array of IP addresses.
Tries to resolve hostname passed as an argument. Returns its IPv6 address.
Returns numeric value of IP address passed as an argument.
Returns IP address of numeric value passed as an argument.
Returns numeric value of IPv6 address passed as an argument.
Returns IPv6 address of numeric value passed as an argument.
Returns a port number for direct use as source in a TCP or UDP header (that is a port between 1025 and 65535).
Returns a random integer of 32 bits in length.
Returns a random integer of 16 bits in length.
Converts a MAC address from network format to human format.
Almost used internally, to convert network bits to integers. First argument is what to convert, second is an unpack format, third the offset of first argument where bits to get begins, the fourth are padding bits to achieve the length we need, and the last is the number of bits to get from offset argument.
Almost used internally, to convert integers to network bits. First argument is what to convert, second is a pack format, third the offset where to store the first argument, and the last the number of bits the integer will be once packed.
Compute the INET checksum used in various layers.
See SYNOPSIS.
Patrice <GomoR> Auffret
Copyright (c) 2004-2006, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.
NetPacket, Net::RawIP, Net::RawSock
To install Net::Packet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Packet
CPAN shell
perl -MCPAN -e shell install Net::Packet
For more information on module installation, please visit the detailed CPAN module installation guide.