nil0x42/phpsploit

View on GitHub
src/api/php-functions/getGroup.php

Summary

Maintainability
A
0 mins
Test Coverage
<?

// getGroup($abspath) (type => string):
//      Return group owner of the given file path.
//
//      If the group owner of the file could not be determined,
//      the string "?" is returned as a fallback value.
//
//      $abspath (string):
//          This variable should be an existing absolute file path

function getGroup($abspath)
{
    if (function_exists('posix_getgrgid'))
    {
        $gid = @filegroup($abspath);
        $grp = @posix_getgrgid($gid);
        if (@is_string($grp['name']) && !@empty($grp['name']))
            return ($grp['name']);
    }
    return ("?");
}

?>