示例#1
0
        private static async Task <bool> WaitForUsmtExit(string ImageName)
        {
            Running = true;
            bool result = await Remote.WaitForProcessExit(CurrentTarget, ImageName);

            Running = false;
            if (result)
            {
                Logger.Success("USMT Finished.");
            }
            await Task.Delay(3000);

            return(result);
        }
示例#2
0
 /// <summary>
 /// Deletes a list of SIDs (Security Identifiers (User Profiles)) from a host.
 /// </summary>
 /// <param name="Host">Host to delete profiles from.</param>
 /// <param name="SIDs">List of SIDs that identify the profiles that need to be deleted.</param>
 /// <returns>Awaitable Task.</returns>
 public static Task DeleteFromSource(string Host, string[] SIDs)
 {
     ShouldCancelRemoteProfileDelete = false;
     return(Task.Run(async() =>
     {
         try
         {
             Logger.Information("Sending Profile Delete Daemon...");
             string exePath = Path.Combine(GetBestPathToC(Host), @"ProgramData\SuperGratePD.exe");
             FileStream SuperGratePD = File.OpenWrite(exePath);
             SuperGratePD.Write(
                 Properties.Resources.SuperGrateProfileDelete,
                 0,
                 Properties.Resources.SuperGrateProfileDelete.Length
                 );
             SuperGratePD.Close();
             int count = 0;
             foreach (string SID in SIDs)
             {
                 if (ShouldCancelRemoteProfileDelete)
                 {
                     break;
                 }
                 string name = GetUserByIdentity(SID);
                 Logger.Information("Deleting '" + name + "' from " + Host + "...");
                 await Remote.StartProcess(
                     Host,
                     @"C:\ProgramData\SuperGratePD.exe " + SID,
                     @"C:\ProgramData\"
                     );
                 Logger.UpdateProgress((int)((++count - 0.5) / SIDs.Length * 100));
                 await Remote.WaitForProcessExit(Host, "SuperGratePD");
             }
             Logger.Information("Removing Daemon...");
             File.Delete(exePath);
             Logger.Success("Done.");
         }
         catch (Exception e)
         {
             Logger.Exception(e, "Failed to delete user(s) from target: " + Host + ".");
         }
     }));
 }