2024-10-02 10:33:34 发布
网友
我正在尝试使用win32security模块。更确切地说,我需要使用GetEffectiveRightsFromAcl()(PyACL Object)。如何获得调用此函数所需的PyTRUSTEE trustee?在
win32security
GetEffectiveRightsFromAcl()
PyTRUSTEE trustee
我用@eryksun help得到了一些结果:
def print_permissions(mask, username): print("Effective permissions for: ", username, "\n", bool(mask & 0x00000001), "\tReadData\n", bool(mask & 0x00000002), "\tWriteData\n", bool(mask & 0x00000004), "\tAppendData\n", bool(mask & 0x00000008), "\tReadEa\n", bool(mask & 0x00000010), "\tWriteEa\n", bool(mask & 0x00000020), "\tExecute\n", bool(mask & 0x00000040), "\tDeleteChildn\n", bool(mask & 0x00000080), "\tReadAttributes\n", bool(mask & 0x00000100), "\tWriteAttributes\n", bool(mask & 0x00010000), "\tDelete\n", bool(mask & 0x00020000), "\tReadControl\n", bool(mask & 0x00040000), "\tWriteDac\n", bool(mask & 0x00080000), "\tWriteOwner\n", bool(mask & 0x00100000), "\tSynchronize\n") dacl = win32security.GetNamedSecurityInfo( FILENAME, win32security.SE_FILE_OBJECT, win32security.DACL_SECURITY_INFORMATION).GetSecurityDescriptorDacl() mask = dacl.GetEffectiveRightsFromAcl( {'TrusteeForm': win32security.TRUSTEE_IS_NAME, 'TrusteeType': win32security.TRUSTEE_IS_USER, 'Identifier': username}) print_permissions(mask, username)
我用@eryksun help得到了一些结果:
相关问题 更多 >
编程相关推荐