Merge pull request #50 from Hackndo/user-sid

Add User SID for complete access rights checks
This commit is contained in:
Carlos Polop 2020-06-24 15:22:27 +01:00 committed by GitHub
commit cdfd370cc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
{ {
@ -521,8 +522,12 @@ namespace winPEAS
Beaprint.AnsiPrint(" Current user: " + currentUserName, colorsU()); Beaprint.AnsiPrint(" Current user: " + currentUserName, colorsU());
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();