/usr/share/lightsquid/ip2name/ip2name.abils is in lightsquid 1.8-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #convert user -> ip , get user name from abills database
#support ABILS billing system http://abills.asmodeus.com.ua/
#(c) wazzup, posted on LightSquid Forum 20 Dec 2006 06:23 am
use DBI;
use Socket;
my $dbh;
sub StartIp2Name() {
$dbh = DBI->connect("DBI:mysql:database=abills;host=localhost","abills", "abillspasswd" ) || die $DBI::errstr;
}
sub Ip2Name($$$) {
# $Lhost,$user,$Ltimestamp
my $ip=shift;
my $user_name=shift;
my $time=shift;
my $ret;
my $result1 = $dbh->prepare("select started, user_name, framed_ip_address from dv_calls where( framed_ip_address='".unpack('N',inet_aton($ip))."')and (started<FROM_UNIXTIME('".$time."')) order by started DESC");
$result1->execute();
if (my $ln = $result1->fetchrow_hashref()) {
$ret=$ln->{'user_name'};
}
else
{
my $result = $dbh->prepare("select start,users.id , ip from dv_log ,users where (users.uid=dv_log.uid) and (ip='".unpack('N',inet_aton($ip))."')and (start < FROM_UNIXTIME('".$time."')) order by start DESC");
$result->execute();
if (my $ln = $result->fetchrow_hashref()) {
$ret=$ln->{'id'};
}
else {
$ret=$ip;
}
$result->finish();
}
$result1->finish();
return $ret;
}
sub StopIp2Name() {
$dbh->disconnect();
}
#warning !!!
1;
|