简体   繁体   中英

Windows: how to intercept operations with users/groups?

Does Windows have a mechanism for intercepting operations with users/groups such as create/delete, membership change ?

Google and stackoverflow give no answers yet. Reversing into netapi32!NetUserAdd etc gives nothing too.

Windows does not provide an interception mechanism that provides that feature, but you could hook the appropriate Win32 APIs using Detours or any other framework (or your own implementation). Once intercepted, you can filter and or forward the functions according to your needs.

Just some VBScript code for intercepting user creation. It's on you to rewrite it on C++/C#/whatever.

sub set_intercept()
    set wmi = GetObject("winmgmts:\\.\root\cimv2")
    set sink = WScript.CreateObject("WbemScripting.SWbemSink", "SINK_")
    wmi.ExecNotificationQueryAsync sink, "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_Account'"
end sub 

sub SINK_OnObjectReady(obj, context)
    WScript.Echo "User was created"
end sub

set_intercept()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM