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

(ASCEND) RADIUS script - please test



Please test this RADIUS script - please report any bugs you find.

Thanks

Rob

#!/usr/bin/perl -w

# find.hackers version 1.1sf by Jason "FrogBoy" Blakey 
# Nov 6 / 1997
# jblakey@istar.ca
# ps - sf stands for stupid fix - in the case where there is a recorded
call with
# no username...


# This program, when fed a radius logfile, builds 2 hash tables...
# and scans those hash tables for instances where a single username
# has been used from greater than a specified number of phone numbers.
# It also scan for instances where a single number has connected 
# using a number of different usernames...

# Here we define the minimum number of numbers that a single username 
# should connected from...

$minnumofnums = 1;

# And here we define the minimum number of names that a single phonenum should
# connect from...

$minnumofnames = 1;


# NOTHING AFTER THIS POINT SHOULD HAVE TO BE CHANGED...
if ($#ARGV != 0){
	print "Usage: find.hackers <radius logfile>\n";
	exit();
}

open(FILE,$ARGV[0]);
$founduser = 0;
while ($currentline = <FILE>){
	chop($currentline);
	if ($currentline =~ /User-Name = "(\S+)"/){
		$currentuser = $1;
		$founduser = 1;
	}
	elsif (($currentline =~ /Calling-Station-Id = "(\d+)"/) && $founduser){
		$currentnum = $1;
		$founduser = 0;

		if (!$numbers{$currentnum}){
			$numbers{$currentnum} = $currentuser;
		}
		elsif ( $numbers{$currentnum} !~ /$currentuser/){
			$numbers{$currentnum} = "$numbers{$currentnum}\n$currentuser";
		}

		if (!$users{$currentuser}){
			$users{$currentuser} = "$currentnum";
		}
		elsif ($users{$currentuser} !~ /$currentnum/){
			$users{$currentuser} = "$users{$currentuser}\n$currentnum";
		}
		
	}
}

close(FILE);


print "    ########## Here are the usernames -> numbers ##########\n";
@userkeys = keys(%users);

foreach $i (0 .. $#userkeys){
	undef(@foo);
	@foo = split(/\n/,$users{$userkeys[$i]});
	if ($#foo > $minnumofnums){
		$number = $#foo + 1;
		print "$userkeys[$i] has connected from $number different numbers...\n";
		print "They are:\n";
		print "$users{$userkeys[$i]}\n\n";
	}
}
print "     ##########  And now for the numbers -> usernames ##########\n";

@numberkeys = keys(%numbers);

foreach $i (0 .. $#numberkeys){
	undef(@foo);
	@foo = split(/\n/,$numbers{$numberkeys[$i]});
	if ($#foo > $minnumofnames){
		$number = $#foo + 1;
		print"$numberkeys[$i] has used $number different usernames...\n";
		print"They are:\n";
		print "$numbers{$numberkeys[$i]}\n\n";
	}
}
----
Robert Hof, 
Head-Honcho-Type			If at first you don't succeed, then 
NETinc - The Internet People		skydiving definitely isn't for you....
++ Ascend Users Mailing List ++
To unsubscribe:	send unsubscribe to ascend-users-request@bungi.com
To get FAQ'd:	<http://www.nealis.net/ascend/faq>