PEASS-ng/winPEAS/winPEASexe/winPEAS/Native/Ntdsapi.cs
makikvues fb17429f67 - refactoring / cleanup - moved all native external methods to /Native folder/classes
- added new event checks - Explicit Logon Events, Logon Events, PowerShell Events, Process Creation Events
- added PrintSecurityPackagesCredentials check
- added Windows Defender enumeration
2021-02-03 21:54:20 +01:00

32 lines
1.1 KiB
C#

using System;
using System.Runtime.InteropServices;
using winPEAS.Native.Enums;
namespace winPEAS.Native
{
internal class Ntdsapi
{
[DllImport("ntdsapi.dll", CharSet = CharSet.Auto, PreserveSig = false)]
internal static extern void DsBind(
string DomainControllerName, // in, optional
string DnsDomainName, // in, optional
out IntPtr phDS);
[DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]
internal static extern uint DsCrackNames(
IntPtr hDS,
DS_NAME_FLAGS flags,
DS_NAME_FORMAT formatOffered,
DS_NAME_FORMAT formatDesired,
uint cNames,
[MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPTStr, SizeParamIndex = 4)] string[] rpNames,
out IntPtr ppResult);
[DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]
internal static extern void DsFreeNameResult(IntPtr pResult /* DS_NAME_RESULT* */);
[DllImport("ntdsapi.dll", CharSet = CharSet.Auto)]
internal static extern uint DsUnBind(ref IntPtr phDS);
}
}