Exemple #1
0
        void PrintActiveWindow()
        {
            try
            {
                Beaprint.MainPrint("Current Active Window Application");
                string        title       = ApplicationInfoHelper.GetActiveWindowTitle();
                List <string> permsFile   = PermissionsHelper.GetPermissionsFile(title, winPEAS.Checks.Checks.CurrentUserSiDs);
                List <string> permsFolder = PermissionsHelper.GetPermissionsFolder(title, winPEAS.Checks.Checks.CurrentUserSiDs);
                if (permsFile.Count > 0)
                {
                    Beaprint.BadPrint("    " + title);
                    Beaprint.BadPrint("    File Permissions: " + string.Join(",", permsFile));
                }
                else
                {
                    Beaprint.GoodPrint("    " + title);
                }

                if (permsFolder.Count > 0)
                {
                    Beaprint.BadPrint("    Possible DLL Hijacking, folder is writable: " + PermissionsHelper.GetFolderFromString(title));
                    Beaprint.BadPrint("    Folder Permissions: " + string.Join(",", permsFile));
                }
            }
            catch (Exception ex)
            {
                Beaprint.PrintException(ex.Message);
            }
        }
Exemple #2
0
        void PrintScheduled()
        {
            try
            {
                Beaprint.MainPrint("Scheduled Applications --Non Microsoft--");
                Beaprint.LinkPrint("https://book.hacktricks.xyz/windows/windows-local-privilege-escalation/privilege-escalation-with-autorun-binaries", "Check if you can modify other users scheduled binaries");
                List <Dictionary <string, string> > scheduled_apps = ApplicationInfoHelper.GetScheduledAppsNoMicrosoft();

                foreach (Dictionary <string, string> sapp in scheduled_apps)
                {
                    List <string> fileRights = PermissionsHelper.GetPermissionsFile(sapp["Action"], winPEAS.Checks.Checks.CurrentUserSiDs);
                    List <string> dirRights  = PermissionsHelper.GetPermissionsFolder(sapp["Action"], winPEAS.Checks.Checks.CurrentUserSiDs);
                    string        formString = "    ({0}) {1}: {2}";

                    if (fileRights.Count > 0)
                    {
                        formString += "\n    Permissions file: {3}";
                    }

                    if (dirRights.Count > 0)
                    {
                        formString += "\n    Permissions folder(DLL Hijacking): {4}";
                    }

                    if (!string.IsNullOrEmpty(sapp["Trigger"]))
                    {
                        formString += "\n    Trigger: {5}";
                    }

                    if (string.IsNullOrEmpty(sapp["Description"]))
                    {
                        formString += "\n    {6}";
                    }

                    Dictionary <string, string> colorsS = new Dictionary <string, string>()
                    {
                        { "Permissions.*", Beaprint.ansi_color_bad },
                        { sapp["Action"].Replace("\\", "\\\\").Replace("(", "\\(").Replace(")", "\\)").Replace("]", "\\]").Replace("[", "\\[").Replace("?", "\\?").Replace("+", "\\+"), (fileRights.Count > 0 || dirRights.Count > 0) ? Beaprint.ansi_color_bad : Beaprint.ansi_color_good },
                    };
                    Beaprint.AnsiPrint(string.Format(formString, sapp["Author"], sapp["Name"], sapp["Action"], string.Join(", ", fileRights), string.Join(", ", dirRights), sapp["Trigger"], sapp["Description"]), colorsS);
                    Beaprint.PrintLineSeparator();
                }
            }
            catch (Exception ex)
            {
                Beaprint.PrintException(ex.Message);
            }
        }