Updates to sshcollector ASA module (B. Ellenbeck)

This commit is contained in:
Oliver Gorwits
2015-02-18 11:18:45 +00:00
parent a5c7d8ed3a
commit 71b3a4a07c
2 changed files with 21 additions and 11 deletions

View File

@@ -1,3 +1,10 @@
2.031007 - 2015-02-18
[BUG FIXES]
* Updates to sshcollector ASA module (B. Ellenbeck)
* Document the config item for displaying all VLANs on device ports
2.031006 - 2015-02-15 2.031006 - 2015-02-15
[ENHANCEMENTS] [ENHANCEMENTS]

View File

@@ -9,6 +9,11 @@ App::Netdisco::SSHCollector::Platform::ASA
Collect ARP entries from Cisco ASA devices. Collect ARP entries from Cisco ASA devices.
You will need the following configuration for the user to automatically enter
C<enable> status after login:
aaa authorization exec LOCAL auto-enable
=cut =cut
use strict; use strict;
@@ -44,25 +49,23 @@ sub arpnip {
($pos, $error, $match, $before, $after) = $expect->expect(10, -re, $prompt); ($pos, $error, $match, $before, $after) = $expect->expect(10, -re, $prompt);
$expect->send("terminal length 2147483647\n"); $expect->send("terminal pager 2147483647\n");
($pos, $error, $match, $before, $after) = $expect->expect(5, -re, $prompt); ($pos, $error, $match, $before, $after) = $expect->expect(5, -re, $prompt);
$expect->send("show arp\n"); $expect->send("show arp\n");
($pos, $error, $match, $before, $after) = $expect->expect(60, -re, $prompt); ($pos, $error, $match, $before, $after) = $expect->expect(60, -re, $prompt);
my @arpentries = (); my @arpentries = ();
my @lines = split m/\n/, $before; my @lines = split(m/\n/, $before);
# ifname 192.0.2.1 0011.2233.4455 123
my $linereg = qr/[A-z0-9\-\.]+\s([A-z0-9\-\.]+)\s
([0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4})/x;
# ifname 192.168.148.99 0022.1925.9305 347
foreach my $line (@lines) { foreach my $line (@lines) {
my @parts = split m/\n/, $line; if ($line =~ $linereg) {
my ($ip, $mac) = ($1, $2); my ($ip, $mac) = ($1, $2);
push @arpentries, { mac => $mac, ip => $ip };
if ($ip and $mac and
$ip =~ m/(\d{1,3}\.){3}\d{1,3}/ and
$mac =~ m/[0-9a-f.]+/i) {
push @arpentries, { ip => $ip, mac => $mac };
} }
} }