我正在尝试获取文件的有效权限。最好的办法是什么?在
我试图使用win32security
,但是GetEffectiveRightsFromAcl(trustee)
函数需要PyTRUSTEE
参数。我不知道如何正确设置。在
因此,我需要获得与PowerShell中geteffectiveaccess调用相同的权限。在
我们试图使用Authz.h
,但在这种情况下,我们在Windows事件查看器中遇到了审核失败。在
我们还试图使用Aclapi.h
中的GetEffectiveRightsFromAcl
,但这可能成为服务器挂起的原因,以防我们有很多文件。在
python:
dacl = win32security.GetNamedSecurityInfo( FILENAME,
win32security.SE_FILE_OBJECT,
win32security.DACL_SECURITY_INFORMATION).GetSecurityDescriptorDacl()
mask = dacl.GetEffectiveRightsFromAcl( ??? )
认证号:
^{pr2}$Aclapi.h
ACCESS_MASK accessRights;
TRUSTEE trustee;
BuildTrusteeWithName(&trustee, trav->user);
retcode = GetEffectiveRightsFromAcl( acl,&trustee,&accessRights);
我需要得到这样的东西:
文件读取数据
文件写入数据
文件附加数据
文件\u READ_EA
文件\u WRITE\u EA
文件执行
文件\u DELETE_CHILD
文件读取属性
文件写入属性
删除
读控制
写入\u DAC
写入所有者
同步
我用@eryksun帮助得到了一些结果。谢谢。 我还发现了this useful example。在
不要使用cd1中包含的。在
当我试图用特权常量创建一个令牌时,我也得到了相同的
Audit Failure
(在系统帐户的情况下)。所以我没有找到任何结果,如果没有Audit Faulire
在这两种情况下(系统帐户和管理员)(PowerShell除外)。在相关问题 更多 >
编程相关推荐