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 {
Beaprint.GrayPrint(" - Creating current user groups list...");
WindowsIdentity identity = WindowsIdentity.GetCurrent();
currentUserSIDs[identity.User.ToString()] = Environment.UserName;
IdentityReferenceCollection currentSIDs= identity.Groups;
foreach (IdentityReference group in identity.Groups)
{
@ -521,8 +522,12 @@ namespace winPEAS
Beaprint.AnsiPrint(" Current user: " + currentUserName, colorsU());
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);
}
Beaprint.AnsiPrint(" Current groups: " + String.Join(", ", currentGroupsNames), colorsU());
Beaprint.PrintLineSeparator();