Skip to content

Commit

Permalink
PingCastle 3.2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vletoux committed Feb 13, 2024
1 parent 27d230f commit 933316d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
23 changes: 14 additions & 9 deletions Healthcheck/Rules/HeatlcheckRuleStaleADRegistrationEnabled.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ public class HeatlcheckRuleStaleADRegistrationEnabled : RuleBase<HealthcheckData
{
return 0;
}
var gpo = new Dictionary<IGPOReference, string>();
var gpo = new Dictionary<IGPOReference, List<string>>();
foreach (GPPRightAssignment right in healthcheckData.GPPRightAssignment)
{
if (right.Privilege == "SeMachineAccountPrivilege")
{
gpo.Add(right, right.User);
if (!gpo.ContainsKey(right))
gpo[right] = new List<string>();
gpo[right].Add(right.User);
}
}
var o = ApplyGPOPrority2(healthcheckData, gpo);
Expand All @@ -37,14 +39,17 @@ public class HeatlcheckRuleStaleADRegistrationEnabled : RuleBase<HealthcheckData
foreach (var v in o)
{
found = true;
if (v.Value == GraphObjectReference.Everyone
|| v.Value == GraphObjectReference.AuthenticatedUsers
|| v.Value == GraphObjectReference.Users
|| v.Value == GraphObjectReference.Anonymous
)
foreach (var user in v.Value)
{
Trace.WriteLine("Found on " + v.Key.GPOName + " with " + v.Value);
return healthcheckData.MachineAccountQuota;
if (user == GraphObjectReference.Everyone
|| user == GraphObjectReference.AuthenticatedUsers
|| user == GraphObjectReference.Users
|| user == GraphObjectReference.Anonymous
)
{
Trace.WriteLine("Found on " + v.Key.GPOName + " with " + v.Value);
return healthcheckData.MachineAccountQuota;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
// Numéro de build
// Révision
//
[assembly: AssemblyVersion("3.2.0.0")]
[assembly: AssemblyFileVersion("3.2.0.0")]
[assembly: AssemblyVersion("3.2.0.1")]
[assembly: AssemblyFileVersion("3.2.0.1")]
28 changes: 12 additions & 16 deletions RPC/rpcfirewallchecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,37 @@ namespace PingCastle.RPC
{
public class RpcFirewallChecker : rpcapi
{
private static byte[] MIDL_ProcFormatStringx86;

private static byte[] MIDL_ProcFormatStringx64;

private static byte[] MIDL_TypeFormatStringx64;

private static byte[] MIDL_TypeFormatStringx86;


int maxOpNum;

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
private RpcFirewallChecker(Guid interfaceId, string pipe, ushort majorVersion, ushort minorVersion, int maxOpNum)
{
byte[] MIDL_ProcFormatString;
byte[] MIDL_TypeFormatString;

this.maxOpNum = maxOpNum;
if (IntPtr.Size == 8)
{
MIDL_ProcFormatStringx64 = new byte[30 * maxOpNum + 1];
MIDL_ProcFormatString = new byte[30 * maxOpNum + 1];
for (byte i = 0; i < maxOpNum; i++)
{
var v = new byte[] { 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, i, 0x00, 0x08, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
Array.Copy(v, 0, MIDL_ProcFormatStringx64, 30 * i, v.Length);
Array.Copy(v, 0, MIDL_ProcFormatString, 30 * i, v.Length);
}
MIDL_TypeFormatStringx64 = new byte[3];
InitializeStub(interfaceId, MIDL_ProcFormatStringx64, MIDL_TypeFormatStringx64, "\\pipe\\" + pipe, majorVersion, minorVersion);
MIDL_TypeFormatString = new byte[3];
InitializeStub(interfaceId, MIDL_ProcFormatString, MIDL_TypeFormatString, "\\pipe\\" + pipe, majorVersion, minorVersion);
}
else
{
MIDL_ProcFormatStringx86 = new byte[28 * maxOpNum + 1];
MIDL_ProcFormatString = new byte[28 * maxOpNum + 1];
for (byte i = 0; i < maxOpNum; i++)
{
var v = new byte[] { 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, i, 0x00, 0x04, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
Array.Copy(v, 0, MIDL_ProcFormatStringx86, 28 * i, v.Length);
Array.Copy(v, 0, MIDL_ProcFormatString, 28 * i, v.Length);
}
MIDL_TypeFormatStringx86 = new byte[3];
InitializeStub(interfaceId, MIDL_ProcFormatStringx86, MIDL_TypeFormatStringx86, "\\pipe\\" + pipe, majorVersion, minorVersion);
MIDL_TypeFormatString = new byte[3];
InitializeStub(interfaceId, MIDL_ProcFormatString, MIDL_TypeFormatString, "\\pipe\\" + pipe, majorVersion, minorVersion);
}
}

Expand Down

0 comments on commit 933316d

Please sign in to comment.