Below you can find a web script that shows active VPN sessions on Cisco ASA. It logs with predefined user vpn-view. This user has priviledge 0, but is able to use show vpn- command.
The script runs on PerlEx (ActivePerl) and obviously IIS 6.0. Save it as "vpn-view.aspl"
------------------------------script starts here -------------------------
<%
use CGI;
use Net::Telnet::Cisco;
my $cgi = new CGI;
use CGI;
use Net::Telnet::Cisco;
my $cgi = new CGI;
my $session = Net::Telnet::Cisco->new(Host => '192.168.1.5', Prompt => '/[\$%#>] $/');
$session->login("vpn-view", "Password");
$session->print("login");
$session->print("vpn-view");
$session->print("Password");
$session->cmd('terminal pager 0');
my @output;
@output = $session->cmd('sh vpn- full remote');
#print "Content-type: text/html\n\n";
print "<html><head>\n";
print "<title>VPN - current sessions</title></head>\n";
print "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#FF0000\" vlink=\"#800000\">\n";
$now_string = localtime;
print "Timestamp: ";
print $now_string;
print "<title>VPN - current sessions</title></head>\n";
print "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#FF0000\" vlink=\"#800000\">\n";
$now_string = localtime;
print "Timestamp: ";
print $now_string;
foreach (@output) {
print $_;
print "<br>\n";
}
print $_;
print "<br>\n";
}
print "</body></html>";
$session->close;
$session->close;
%>
------------------------------script stops here -------------------------
No comments:
Post a Comment