Esempio n. 1
0
function binSIDtoText($binsid)
{
    if (DEBUG_ENABLED) {
        debug_log('binSIDtoText(): Entered with (%s)', 1, $binsid);
    }
    $hex_sid = bin2hex($binsid);
    $rev = hexdec(substr($hex_sid, 0, 2));
    // Get revision-part of SID
    $subcount = hexdec(substr($hex_sid, 2, 2));
    // Get count of sub-auth entries
    $auth = hexdec(substr($hex_sid, 4, 12));
    // SECURITY_NT_AUTHORITY
    $result = "{$rev}-{$auth}";
    for ($x = 0; $x < $subcount; $x++) {
        $subauth[$x] = hexdec(littleEndian(substr($hex_sid, 16 + $x * 8, 8)));
        // get all SECURITY_NT_AUTHORITY
        $result .= "-" . $subauth[$x];
    }
    return $result;
}
Esempio n. 2
0
function binSIDtoText($binsid)
{
    if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
        debug_log('Entered (%%)', 1, 0, __FILE__, __LINE__, __METHOD__, $fargs);
    }
    $hex_sid = bin2hex($binsid);
    $rev = hexdec(substr($hex_sid, 0, 2));
    // Get revision-part of SID
    $subcount = hexdec(substr($hex_sid, 2, 2));
    // Get count of sub-auth entries
    $auth = hexdec(substr($hex_sid, 4, 12));
    // SECURITY_NT_AUTHORITY
    $result = "{$rev}-{$auth}";
    for ($x = 0; $x < $subcount; $x++) {
        $subauth[$x] = hexdec(littleEndian(substr($hex_sid, 16 + $x * 8, 8)));
        // get all SECURITY_NT_AUTHORITY
        $result .= sprintf('-%s', $subauth[$x]);
    }
    return $result;
}