Ascend Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (ASCEND) Contrib: kill users script



There is a small problem with your script!!!!
If users:
joe on max2
joe1 on max1
joe2 on max1
joe3 on max1

are all logged in, and you issue a "kill joe" command,  each and every user
with "joe" somewhere in his username will get "killed". I just tested this with
my own username and I accidently killed someone else!!!

Better patch it and hurry or else this list will eat you alive just like they do when
Ascend throughly tests their patches before offereing them "officially".

Leland Vandervort wrote:

> 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>



-- Tim Connolly tec@mountain.net     MountainNet, Inc.
-- (304) 594-9075 ext. 37            2816 Cranberry Square
-- fax (304) 594-9088                Morgantown, WV 26505


++ Ascend Users Mailing List ++
To unsubscribe:	send unsubscribe to ascend-users-request@bungi.com
To get FAQ'd:	<http://www.nealis.net/ascend/faq>


References: