Add User SID for complete access rights checks

This commit is contained in:
pixis 2020-06-22 14:34:36 +02:00
parent c951fddf8e
commit 81e6b3d396

View File

@ -83,6 +83,7 @@ namespace winPEAS
try { try {
Beaprint.GrayPrint(" - Creating current user groups list..."); Beaprint.GrayPrint(" - Creating current user groups list...");
WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsIdentity identity = WindowsIdentity.GetCurrent();
currentUserSIDs[identity.User.ToString()] = Environment.UserName;
IdentityReferenceCollection currentSIDs= identity.Groups; IdentityReferenceCollection currentSIDs= identity.Groups;
foreach (IdentityReference group in identity.Groups) foreach (IdentityReference group in identity.Groups)
{ {
@ -522,7 +523,11 @@ namespace winPEAS
List<string> currentGroupsNames = new List<string>(); List<string> currentGroupsNames = new List<string>();
foreach (KeyValuePair<string, string> g in currentUserSIDs) foreach (KeyValuePair<string, string> g in currentUserSIDs)
{
if (g.Key == WindowsIdentity.GetCurrent().User.ToString())
continue;
currentGroupsNames.Add(String.IsNullOrEmpty(g.Value) ? g.Key : g.Value); currentGroupsNames.Add(String.IsNullOrEmpty(g.Value) ? g.Key : g.Value);
}
Beaprint.AnsiPrint(" Current groups: " + String.Join(", ", currentGroupsNames), colorsU()); Beaprint.AnsiPrint(" Current groups: " + String.Join(", ", currentGroupsNames), colorsU());
Beaprint.PrintLineSeparator(); Beaprint.PrintLineSeparator();