Platinum Partner

Perl - Cisco Wireless Managment

// Perl script to update MAC access table on Cisco IOS-based AiroNets


#!c:/perl/bin/perl.exe

# Update Aironet IOS mac addresses

use Net::Telnet::Cisco;
use vars qw($r @data);

print "Content-type:text/html\n\n";

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $FORM{$name} = $value;
}


$macaddr = $FORM{'command'};
#$macaddr = 'AABBCCDDEEFF';

print "using command username $macaddr password 0$macaddr

"; print "Updating AP 127.0.0.1 (conference center)
"; $r = Net::Telnet::Cisco->new(Host=>"127.0.0.1"); $r->login("login","password"); die($r->errmsg) unless($r->enable("password")); $r->cmd('terminal length 0'); $r->cmd('config t'); $r->cmd("username $macaddr password $macaddr"); $r->cmd("username $macaddr autocommand exit"); $r->cmd("exit"); $r->cmd("write memory quiet"); $r->cmd('terminal length 24'); $r->close(); print "Done!";
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}