/usr/lib/x86_64-linux-gnu/perl5/5.22/Net/ARP.pm is in libnet-arp-perl 1.0.8-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | #
# Perl ARP Extension
#
# Programmed by Bastian Ballmann
# Last update: 24.06.2013
#
# This program is free software; you can redistribute
# it and/or modify it under the terms of the
# GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# 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.
# See the GNU General Public License for more details.
package Net::ARP;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use ARP ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
);
our $VERSION = '1.0.8';
require XSLoader;
XSLoader::load('Net::ARP', $VERSION);
# Preloaded methods go here.
1;
__END__
=head1 NAME
ARP - Perl extension for creating ARP packets
=head1 SYNOPSIS
use Net::ARP;
Net::ARP::send_packet('lo', # Device
'127.0.0.1', # Source IP
'127.0.0.1', # Destination IP
'aa:bb:cc:aa:bb:cc', # Source MAC
'aa:bb:cc:aa:bb:cc', # Destinaton MAC
'reply'); # ARP operation
$mac = Net::ARP::get_mac("eth0");
print "$mac\n";
$mac = Net::ARP::arp_lookup($dev,"192.168.1.1");
print "192.168.1.1 has got mac $mac\n";
=head2 IMPORTANT
Version 1.0 will break with the API of PRE-1.0 versions,
because the return value of arp_lookup() and get_mac()
will no longer be passed as parameter, but returned!
I hope this decision is ok as long as we get a cleaner and more perlish API.
=head2 DESCRIPTION
This module can be used to create and send ARP packets and to
get the mac address of an ethernet interface or ip address.
=over
=item B<send_packet()>
Net::ARP::send_packet('lo', # Device
'127.0.0.1', # Source IP
'127.0.0.1', # Destination IP
'aa:bb:cc:aa:bb:cc', # Source MAC
'aa:bb:cc:aa:bb:cc', # Destinaton MAC
'reply'); # ARP operation
I think this is self documentating.
ARP operation can be one of the following values:
request, reply, revrequest, revreply, invrequest, invreply.
=item B<get_mac()>
$mac = Net::ARP::get_mac("eth0");
This gets the MAC address of the eth0 interface and stores
it in the variable $mac. The return value is "unknown" if
the mac cannot be looked up.
=item B<arp_lookup()>
$mac = Net::ARP::arp_lookup($dev,"192.168.1.1");
This looks up the MAC address for the ip address 192.168.1.1
and stores it in the variable $mac. The return value is
"unknown" if the mac cannot be looked up.
=back
=head1 SEE ALSO
man -a arp
=head1 AUTHOR
Bastian Ballmann [ balle@codekid.net ]
http://www.codekid.net
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2004-2013 by Bastian Ballmann
License: GPLv2
=cut
|