我知道我可以使用以下方法模拟 Windows 帐户:http://msdn.microsoft.com/en-us/library/chf6fbt4.aspx http://msdn.microsoft.com/en-us/library/chf6fbt4.aspx
但我该如何模仿WellKnownSidType
帐户?
SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.LocalSystemSid, null);
NTAccount account = sid.Translate(typeof(NTAccount)) as NTAccount;
if (account != null)
{
//Impersonate here???
}
首先,除非您在“本地服务”帐户下运行,否则您将无法模拟“网络服务”或“本地服务”等内置帐户,据我所知,这只能由操作系统来完成。
下面的帖子为上述问题提供了一个可能的解决方案(我没有尝试过,只是在我自己开始写这些之前用谷歌搜索过),但它看起来很合理。
http://geek.hubkey.com/2008/02/impersonating-built-in-service-account.html http://geek.hubkey.com/2008/02/impersonating-built-in-service-account.html
一旦在“本地服务”帐户下运行,您只需使用 LogonUser(也在上面的链接中显示)使用众所周知的 SID 的帐户名进行登录,然后模拟令牌。
我看到上面的链接将“CMD.EXE”作为一项服务运行,可以与桌面交互,请注意“与桌面交互”功能已被弃用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)