Ascend Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(ASCEND) Contrib: kill users script
just a short script to kill a user session from the max. Will
check the series of MAXs for the user, if found will kill it.
Requires snmpset from the cmu package. Written in Perl but
without modules etc so that perl4 users aren't left out.
This script is also on my web page. http://www.discpro.org/~leland/
----
#!/usr/bin/perl
# script to terminate a dialin session on a MAX.
# Uses finger to get users and sessionIDs and
# snmpset (from the cmu snmp suite) to send the kill.
#####################################################
# Leland E. Vandervort
# lelandv@innotts.co.uk / leland@innotts.com / leland@discpro.org
# May be freely used.
#####################################################
$killuser = $ARGV[0];
$SessionValid = ".1.3.6.1.4.1.529.12.3.1.3"; # append sessionID to kill
$snmpSetCommunity = "changeme"; # this is your snmp WRITE
community
$snmpSetValidFlag = "i 1";
if($killuser eq "") {
die "Usage: killuser <username>\n";
}
# check to see if the supplied user is online and if so .. then BOOM.
# get the user list from all the ascends.. and scan for the user, then get
the session ID
foreach $max ( 'max1',
'max2',
'max3'
) {
open(CHECKUSER, "finger \@$max 2>&1 |") || die "Can't get user
stats\n";
while(<CHECKUSER>) {
chop;
($dummy,$SessionID,$dummy2,$dummy3,$dummy4,$dummy5,$dummy6,$dummy7,$userid)
=split(' ',$_);
if(($SessionID !~ "essio") && ($SessionID !~ "ID") && ($userid ne"")) {
if($userid =~ $killuser) {
`snmpset $max $snmpSetCommunity
$SessionValid.$SessionID $snmpSetValidFlag`;
die "User $userid - Session ID $SessionID
has been Shot! (found on $max)\n";
}
}
}
close CHECKUSER;
}
print "$killuser is not online\n";
--------
Leland E. Vandervort
lelandv@innotts.co.uk
leland@innotts.com
++ Ascend Users Mailing List ++
To unsubscribe: send unsubscribe to ascend-users-request@bungi.com
To get FAQ'd: <http://www.nealis.net/ascend/faq>
Follow-Ups: