• Home
  • Linux
  • Docker
  • Windows
    • PS
    • C#
    • Exchange Server
  • Other
    • Perl
    • IPV6
    • MacOS
  • DB
    • MSSQL
    • MariaDB
    • PG

Calculate UAC

Details
Written by: po3dno
Category: Perl
Created: 20 February 2018
Hits: 1185

sub calcuac {
my $result = "";
my $curuac = $_[0];
my %hash = (
DONT_EXPIRE_PASSWORD => 65536,
NORMAL_ACCOUNT => 512,
TEMP_DUPLICATE_ACCOUNT => 256,
ENCRYPTED_TEXT_PWD_ALLOWED => 128,
PASSWD_CANT_CHANGE => 64,
PASSWD_NOTREQD => 32,
LOCKOUT => 16,
ACCOUNTDISABLE => 2,
);
my $i = 0;
for my $key (sort {$hash{$b} <=> $hash{$a}} keys %hash ) {
if ($curuac >= $hash{$key}){
$result = $result . " \| " if ($i > 0);
$curuac = $curuac - $hash{$key};
$result = $result . $key;
$i++;
}
}
return $result;
}

Login Form

  • Forgot your password?
  • Forgot your username?

Statistics

  • Users 2
  • Articles 175
  • Articles View Hits 154066