HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: //var/opt/OV/bin/instrumentation/SIUserLastLogin.pl
###############################
# 
# Version : 11.11.025
#
###############################
use OvCommon;
my $catalog = OvCommon::GetCatalog(qw/SystemPerl/);
$ENV{CODAMAGIC} = qw/0x05201993/;
open (OVCODADUMP, "ovcodautil -ds SISPI -o LOGINS -flat|") or die;

my %userlogins;

foreach $line (<OVCODADUMP>) {
	chomp $line;

	($name,$value) = split /:/, $line;
	if ($name =~ /^_InstanceName/) {
		$user = trim($value);
	}
	next unless$name =~ /^SECONDS_SINCE_LASTLOGIN/;
	$userlogins{$user} = trim($value);

}

print "------------------------------------------------------------------------\n";
print "><User                                               Last Login";
print "------------------------------------------------------------------------\n";

foreach $key (sort hashValueDescendingNum (keys(%userlogins))) {
$sec = $userlogins{$key};

	if ($sec != -1) {
		$idletime = int($sec/(24*60*60)) . "days, " . ($sec/(60*60))%24 . "hours, " . ($sec/60)%60 . "mins, " . $sec%60 . "secs\n";   
		printf "%-40s %s\n",$key, $idletime;
    }
    elsif ($sec == -1) {
    	$idletime = "never\n";
   		printf "%-40s %s\n",$key, $idletime;
    }
}

close (LASTLOGINS);

sub trim($)
{
	my $string = shift;
	$string =~ s/^\s+//;
	$string =~ s/\s+$//;
	return $string;
}

sub hashValueDescendingNum {
   $userlogins{$b} <=> $userlogins{$a};
}