Name : perl-Text-DHCPparse
| |
Version : 0.10
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp156.6.1
| Date : 2024-07-03 19:11:36
|
Group : Development/Libraries/Perl
| Source RPM : perl-Text-DHCPparse-0.10-lp156.6.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
Summary : Perl extension for parsing dhcpd lease files
|
Description :
The basic premise of the Text::DHCPparse module is to parse the lease file from an ISC DHCPd server. This is useful for quick reporting on active leases or for tracking purposes. The resulting hash reference is a fixed length record with the key being the IP address for the lease, and the value being the lease info in the following format:
Characters Field ---------- -------------------- 1 - 17 IP Address 18 - 38 Last Lease Timestamp 39 - 57 Hardware Address 58 - 74 Client Hostname
The following is if you are using the no colon function: Characters Field ---------- -------------------- 1 - 17 IP Address 18 - 38 Last Lease Timestamp 39 - 52 Hardware Address 53 - 69 Client Hostname
(All fields have a minimum 2-space field delimiter for formatting.)
WARNING: Always use a copy of your \'dhcpd.leases\' file - never use an original from a live server!
The following is a simple piece of code to show the functionality of the Text::DHCPparse module:
use Text::DHCPparse;
$return = leaseparse(\'/tmp/dhcpd.leases\');
foreach (keys %$return) { print \"$return->{$_}\ \"; }
The following code can be used to take the output from Text::DHCPparse and separate it into individual fields if you don\'t like the fixed length record:
use Text::DHCPparse;
$return = leaseparse(\'/tmp/dhcpd.leases\');
foreach (keys %$return) { ($ip, $time, $mac, $name) = unpack(\"A17 A21 A19 A30\", $return->{$_}); }
The exported function leaseparsenc works exactly the same, but it removed colons from the MAC address and shortens the record by 5 characters.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-T/15.6/noarch |