public override string GetLauncher(string StagerCode, byte[] StagerAssembly, Grunt grunt, ImplantTemplate template) { this.StagerCode = StagerCode; this.Base64ILByteString = Convert.ToBase64String(StagerAssembly); this.DiskCode = XMLTemplate.Replace("{{GRUNT_IL_BYTE_STRING}}", this.Base64ILByteString); this.DiskCode = DiskCode.Replace("{{TARGET_NAME}}", this.TargetName); this.DiskCode = DiskCode.Replace("{{TASK_NAME}}", this.TaskName); // Replacements for obfuscation this.DiskCode = DiskCode.Replace("{{PATCH_AMSI}}", this.random_var_patchAmsi); this.DiskCode = DiskCode.Replace("{{AMSI}}", this.random_var_amsi); this.DiskCode = DiskCode.Replace("{{MEMORY_STREAM}}", this.random_var_outputMemoryStream); this.DiskCode = DiskCode.Replace("{{DEFLATE_STREAM}}", this.random_var_deflateStream); this.DiskCode = DiskCode.Replace("{{BYTE_ARRAY}}", this.random_var_byteArray); this.DiskCode = DiskCode.Replace("{{READ}}", this.random_var_read); this.DiskCode = DiskCode.Replace("{{LIB}}", this.random_var_lib); this.DiskCode = DiskCode.Replace("{{AMSI_DLL_0}}", this.random_var_amsi_dll[0]); this.DiskCode = DiskCode.Replace("{{AMSI_DLL_1}}", this.random_var_amsi_dll[1]); this.DiskCode = DiskCode.Replace("{{AMSI_SCAN_BUFF_0}}", this.random_var_amsiScanBuffer[0]); this.DiskCode = DiskCode.Replace("{{AMSI_SCAN_BUFF_1}}", this.random_var_amsiScanBuffer[1]); this.DiskCode = DiskCode.Replace("{{AMSI_SCAN_BUFF_2}}", this.random_var_amsiScanBuffer[2]); this.DiskCode = DiskCode.Replace("{{ASSEMBLY_BUFFER}}", this.random_var_assemblyBuffer); string launcher = "msbuild.exe" + " " + template.Name + ".xml"; this.LauncherString = launcher; return(this.LauncherString); }
public override void Update(LiveEntity entity) { Grunt grunt = (Grunt)entity; base.Update(grunt); GameObject ao = grunt.attachedObject; if (Director.playerIsAlive) { LiveEntity target = Director.player; Vector2 vectorToTarget = (target.attachedObject.transform.position - ao.transform.position); decisionTimer -= Time.deltaTime * Mathf.Max(1, grunt.aggroRadius / (vectorToTarget.magnitude)); if ((ao.transform.position - target.attachedObject.transform.position).magnitude < grunt.attackRadius) { grunt.Attack(target); } else { if (decisionTimer <= 0) { grunt.StandardSeek(target); decisionTimer = entity.decisionTimerMax; } } } }
public TaskMenuItem(CovenantAPI CovenantClient, Grunt Grunt) : base(CovenantClient) { try { this.Grunt = Grunt; this.MenuTitle = "Task"; this.MenuDescription = "Task a Grunt to do something."; this.MenuItemParameters = new List <MenuCommandParameter> { new MenuCommandParameter { Name = "Task Name", Values = this.CovenantClient.ApiGrunttasksGet().Select(T => new MenuCommandParameterValue { Value = T.Name }).ToList() } }; this.AdditionalOptions.Add(new MenuCommandTaskShow(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandTaskStart(CovenantClient)); var setCommand = new MenuCommandTaskSet(CovenantClient); this.AdditionalOptions.Add(setCommand); this.AdditionalOptions.Add(new MenuCommandGenericUnset(setCommand.Parameters.FirstOrDefault(P => P.Name == "Option").Values)); } catch (HttpOperationException e) { EliteConsole.PrintFormattedWarningLine("CovenantException: " + e.Response.Content); } }
public override void Command(MenuItem menuItem, string UserInput) { menuItem.Refresh(); GruntsMenuItem gruntsMenu = ((GruntsMenuItem)menuItem); string[] commands = UserInput.Split(" "); if (commands.Length != 3 || commands[0].ToLower() != "rename") { menuItem.PrintInvalidOptionError(UserInput); return; } Grunt grunt = gruntsMenu.Grunts.FirstOrDefault(G => G.Name.ToLower() == commands[1]); if (grunt == null) { EliteConsole.PrintFormattedErrorLine("Grunt with name: " + commands[1] + " does not exist."); menuItem.PrintInvalidOptionError(UserInput); } else if (gruntsMenu.Grunts.Where(G => G.Name.ToLower() == commands[2].ToLower()).Any()) { EliteConsole.PrintFormattedErrorLine("Grunt with name: " + commands[2] + " already exists."); menuItem.PrintInvalidOptionError(UserInput); } else { grunt.Name = commands[2]; this.CovenantClient.ApiGruntsPut(grunt); } }
public override void Command(MenuItem menuItem, string UserInput) { GruntsMenuItem gruntsMenuItem = (GruntsMenuItem)menuItem; string[] commands = UserInput.Split(" "); if (commands.Length != 2 || commands[0].ToLower() != "hide") { menuItem.PrintInvalidOptionError(UserInput); return; } if (commands[1].ToLower() == "all") { gruntsMenuItem.HiddenGruntNames.AddRange(gruntsMenuItem.Grunts.Select(G => G.Name)); } Grunt grunt = gruntsMenuItem.Grunts.FirstOrDefault(G => G.Name == commands[1]); if (grunt == null) { EliteConsole.PrintFormattedErrorLine("Invalid GruntName: \"" + commands[1] + "\""); menuItem.PrintInvalidOptionError(UserInput); return; } EliteConsole.PrintFormattedWarning("Hide Grunt: " + commands[1] + "? [y/N] "); string input = EliteConsole.Read(); if (!input.ToLower().StartsWith("y")) { return; } gruntsMenuItem.HiddenGruntNames.Add(grunt.Name); }
public override string GetLauncher(string StagerCode, byte[] StagerAssembly, Grunt grunt, ImplantTemplate template) { this.StagerCode = StagerCode; this.Base64ILByteString = Convert.ToBase64String(StagerAssembly); this.PowerShellCode = PowerShellLauncherCodeTemplate.Replace("{{GRUNT_IL_BYTE_STRING}}", this.Base64ILByteString); return(GetLauncher(PowerShellCode)); }
public async Task <string> Jobs(Grunt grunt, GruntCommand command, List <ParsedParameter> parameters) { string Name = "Jobs"; if (parameters.Count != 1 || !parameters[0].Value.Equals(Name, StringComparison.OrdinalIgnoreCase)) { return(EliteConsole.PrintFormattedErrorLine("Usage: Jobs")); } GruntTask jobsTask = await _context.GetGruntTaskByName("Jobs"); await _context.CreateGruntTasking(new GruntTasking { Id = 0, GruntId = grunt.Id, GruntTaskId = jobsTask.Id, GruntTask = jobsTask, Name = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10), Status = GruntTaskingStatus.Uninitialized, Type = GruntTaskingType.Jobs, Parameters = new List <string> { "Jobs" }, GruntCommand = command, GruntCommandId = command.Id }, _grunthub); return(""); }
public Enemy spawn() { Enemy enemy; switch (enemyType) { case "Grunt": //set center to be top right or left of the screen enemy = new Grunt(x, y); break; case "Captain": //set center to be top right or left of the screen enemy = new Captain(x, y); break; case "Commander": //set center to be top right or left of the screen enemy = new Commander(x, y); break; case "Assassin": //set center to be top right or left of the screen enemy = new Assassin(x, y); break; case "General": //set center to center top of the screen enemy = new General(x, y); break; } enemyCount--; return(enemy); }
public override string GetLauncher(string StagerCode, byte[] StagerAssembly, Grunt grunt, ImplantTemplate template) { this.StagerCode = StagerCode; this.Base64ILByteString = Convert.ToBase64String(StagerAssembly); var code = CodeTemplate.Replace("{{GRUNT_IL_BYTE_STRING}}", this.Base64ILByteString); var references = grunt.DotNetVersion == Common.DotNetVersion.Net35 ? Common.DefaultNet35References : Common.DefaultNet40References; references.Add(new Compiler.Reference { File = grunt.DotNetVersion == Common.DotNetVersion.Net35 ? Common.CovenantAssemblyReferenceNet35Directory + "System.ServiceProcess.dll" : Common.CovenantAssemblyReferenceNet40Directory + "System.ServiceProcess.dll", Framework = grunt.DotNetVersion, Enabled = true }); this.DiskCode = Convert.ToBase64String(Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest { Language = template.Language, Source = code, TargetDotNetVersion = grunt.DotNetVersion, OutputKind = OutputKind.ConsoleApplication, References = references })); this.LauncherString = string.Format("{0}{1}.exe", template.Name, "SVC"); return(this.LauncherString); }
public string ListenerCompileGruntExecutorCode(HttpListener listener, Grunt grunt, HttpProfile profile, bool Compress = false) { Common.DotNetVersion version = Common.DotNetVersion.Net35; switch (grunt.DotNetFrameworkVersion) { case DotNetVersion.Net35: version = Common.DotNetVersion.Net35; break; case DotNetVersion.Net40: version = Common.DotNetVersion.Net40; break; case DotNetVersion.NetCore21: version = Common.DotNetVersion.NetCore21; break; } byte[] ILBytes = Compiler.Compile(new Compiler.CompilationRequest { Source = this.ListenerGetGruntExecutorCode(listener, grunt, profile), TargetDotNetVersion = version, OutputKind = OutputKind.DynamicallyLinkedLibrary, References = grunt.DotNetFrameworkVersion == DotNetVersion.Net35 ? Common.DefaultNet35References : Common.DefaultNet40References }); if (ILBytes == null || ILBytes.Length == 0) { throw new CovenantCompileGruntStagerFailedException("Compiling Grunt code failed"); } if (Compress) { ILBytes = Utilities.Compress(ILBytes); } return(Convert.ToBase64String(ILBytes)); }
public override string GetLauncher(Listener listener, Grunt grunt, HttpProfile profile, ImplantTemplate template) { this.StagerCode = listener.GetGruntStagerCode(grunt, profile, template); this.Base64ILByteString = listener.CompileGruntStagerCode(grunt, profile, template, this.OutputKind, true); this.PowerShellCode = PowerShellLauncherCodeTemplate.Replace("{{GRUNT_IL_BYTE_STRING}}", this.Base64ILByteString); return(GetLauncher(PowerShellCode)); }
public override StateIDs Update() { //FIGHTING? if (IsCombatViable()) { return(StateIDs.Combat); } if (Grunt.Self.Gold < 2) { return(StateIDs.Mining); } if (Grunt.Self.MineRatio == 0) //nothing to lose { return(StateIDs.Mining); } if (Grunt.Self.Life < START_MINING_HEALTH) { return(StateIDs.Drinking); } if (!Grunt.IsThreatened(5)) { return(StateIDs.Mining); } return(StateIDs.Drinking); }
public async Task <string> Kill(Grunt grunt, GruntCommand command, List <ParsedParameter> parameters) { if (parameters.Count() != 1) { StringBuilder toPrint = new StringBuilder(); toPrint.Append(EliteConsole.PrintFormattedErrorLine("Usage: Kill")); return(toPrint.ToString()); } GruntTask killTask = await _context.GetGruntTaskByName("Kill"); await _context.CreateGruntTasking(new GruntTasking { Id = 0, GruntId = grunt.Id, GruntTaskId = killTask.Id, GruntTask = killTask, Name = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10), Status = GruntTaskingStatus.Uninitialized, Type = GruntTaskingType.Kill, GruntCommand = command, GruntCommandId = command.Id }, _grunthub); return(""); }
public override string GetLauncher(string StagerCode, byte[] StagerAssembly, Grunt grunt, ImplantTemplate template) { this.StagerCode = StagerCode; this.Base64ILByteString = Convert.ToBase64String(StagerAssembly); this.LauncherString = template.Name + ".exe"; return(this.LauncherString); }
public async Task <List <string> > GetSuggestions(string GruntName) { Grunt grunt = await _context.Grunts.FirstOrDefaultAsync(G => G.Name.Equals(GruntName, StringComparison.OrdinalIgnoreCase)); IEnumerable <GruntTasking> taskings = await _context.GetGruntTaskingsForGrunt(grunt.Id); List <string> suggestions = new List <string>(); foreach (var task in await _context.GetGruntTasks()) { if (!task.Name.StartsWith("SharpShell-", StringComparison.Ordinal)) { suggestions.Add(task.Name); GetSuggestionRecursive(task, 0, task.Name, ref suggestions); foreach (var altname in task.AlternateNames) { suggestions.Add(altname); GetSuggestionRecursive(task, 0, altname, ref suggestions); } } } suggestions.AddRange(new List <string> { "Show", "Note", "History" }); suggestions.AddRange(taskings.Select(GT => $"History {GT.Name}")); return(suggestions); }
private bool IsChildGrunt(int ParentId, int ChildId) { if (ParentId == ChildId) { return(true); } Grunt parentGrunt = _context.Grunts.FirstOrDefault(G => G.Id == ParentId); Grunt childGrunt = _context.Grunts.FirstOrDefault(G => G.Id == ChildId); if (parentGrunt == null || childGrunt == null) { return(false); } if (parentGrunt.Children.Contains(childGrunt.GUID)) { return(true); } foreach (string child in parentGrunt.Children) { Grunt directChild = _context.Grunts.FirstOrDefault(G => G.GUID == child); if (IsChildGrunt(directChild.Id, ChildId)) { return(true); } } return(false); }
public override string GetLauncher(Listener listener, Grunt grunt, HttpProfile profile) { this.StagerCode = listener.GetGruntStagerCode(grunt, profile); this.Base64ILByteString = listener.CompileGruntStagerCode(grunt, profile, this.OutputKind); this.LauncherString = this.Base64ILByteString; return(this.LauncherString); }
public override string GetLauncher(Listener listener, Grunt grunt, HttpProfile profile) { this.StagerCode = listener.GetGruntStagerCode(grunt, profile); this.Base64ILByteString = listener.CompileGruntStagerCode(grunt, profile, this.OutputKind, true); string code = CodeTemplate.Replace("{{GRUNT_IL_BYTE_STRING}}", this.Base64ILByteString); List <Compiler.Reference> references = grunt.DotNetFrameworkVersion == Common.DotNetVersion.Net35 ? Common.DefaultNet35References : Common.DefaultNet40References; references.Add(new Compiler.Reference { File = "System.Configuration.Install.dll", Framework = grunt.DotNetFrameworkVersion, Enabled = true }); this.DiskCode = Convert.ToBase64String(Compiler.Compile(new Compiler.CompilationRequest { Source = code, TargetDotNetVersion = grunt.DotNetFrameworkVersion, OutputKind = OutputKind.DynamicallyLinkedLibrary, References = references })); this.LauncherString = "InstallUtil.exe" + " " + "/U" + " " + "file.dll"; return(this.LauncherString); }
public override string GetLauncher(string StagerCode, byte[] StagerAssembly, Grunt grunt, ImplantTemplate template) { this.StagerCode = StagerCode; string inputf = Common.CovenantTempDirectory + Utilities.GetSanitizedFilename(template.Name + ".exe"); string outputf = Common.CovenantTempDirectory + Utilities.GetSanitizedFilename(template.Name + ".bin"); File.WriteAllBytes(inputf, StagerAssembly); DonutConfig config = new DonutConfig { Arch = 3, Bypass = 3, InputFile = inputf, Class = "GruntStager", Method = "Execute", Args = "", Payload = outputf }; int ret = Generator.Donut_Create(ref config); if (ret == Constants.DONUT_ERROR_SUCCESS) { this.Base64ILByteString = Convert.ToBase64String(File.ReadAllBytes(outputf)); this.LauncherString = template.Name + ".bin"; } return(this.LauncherString); }
public async Task <string> Connect(Grunt grunt, GruntCommand command, List <ParsedParameter> parameters) { string Name = "Connect"; StringBuilder toPrint = new StringBuilder(); if (parameters.Count < 2 || parameters.Count > 3 || !parameters[0].Value.Equals(Name, StringComparison.OrdinalIgnoreCase)) { return(EliteConsole.PrintFormattedErrorLine("Usage: Connect <ComputerName> [ <PipeName> ]")); } GruntTask connectTask = await _context.GetGruntTaskByName("Connect"); string PipeName = "gruntsvc"; if (parameters.Count == 3) { PipeName = parameters[2].Value; } await _context.CreateGruntTasking(new GruntTasking { Id = 0, GruntId = grunt.Id, GruntTaskId = connectTask.Id, GruntTask = connectTask, Name = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10), Status = GruntTaskingStatus.Uninitialized, Type = GruntTaskingType.Connect, Parameters = new List <string> { parameters[1].Value, PipeName }, GruntCommand = command, GruntCommandId = command.Id }, _grunthub); return(toPrint.ToString()); }
public async Task <string> History(Grunt grunt, List <ParsedParameter> parameters) { string Name = "History"; if (parameters.Count() != 2 || !parameters[0].Value.Equals(Name, StringComparison.OrdinalIgnoreCase)) { StringBuilder toPrint1 = new StringBuilder(); toPrint1.Append(EliteConsole.PrintFormattedErrorLine("Usage: History <tasking_name>")); return(toPrint1.ToString()); } StringBuilder toPrint = new StringBuilder(); GruntTasking tasking = await _context.GruntTaskings.FirstOrDefaultAsync(GT => GT.Name == parameters[1].Value); if (tasking == null) { toPrint.Append(EliteConsole.PrintFormattedErrorLine("Invalid History command, invalid tasking name. Usage is: History [ <tasking_name> ]")); } else { GruntCommand command = await _context.GruntCommands .Include(GC => GC.CommandOutput) .Include(GC => GC.User) .FirstOrDefaultAsync(GC => GC.Id == tasking.GruntCommandId); toPrint.Append(EliteConsole.PrintFormattedInfoLine("[" + tasking.CompletionTime + " UTC] Grunt: " + grunt.Name + " " + "GruntTasking: " + tasking.Name)); toPrint.Append(EliteConsole.PrintInfoLine("(" + command.User.UserName + ") > " + command.Command)); toPrint.Append(EliteConsole.PrintInfoLine(command.CommandOutput.Output)); } return(toPrint.ToString()); }
// GET: /grunt/hide/{id} public async Task <IActionResult> Hide(int id) { try { Grunt g = await _context.GetGrunt(id); _context.Entry(g).State = EntityState.Deleted; if (g.Status == GruntStatus.Hidden) { g.Status = GruntStatus.Active; } else { g.Status = GruntStatus.Hidden; } await _context.EditGrunt(g, _userManager, HttpContext.User, _grunthub, _eventhub); return(RedirectToAction(nameof(Index))); } catch (Exception e) when(e is ControllerNotFoundException || e is ControllerBadRequestException || e is ControllerUnauthorizedException) { ModelState.AddModelError(string.Empty, e.Message); return(RedirectToAction(nameof(Index))); } }
public override async void Command(MenuItem menuItem, string UserInput) { GruntsMenuItem gruntsMenu = ((GruntsMenuItem)menuItem); string[] commands = UserInput.Split(" "); if (commands.Length != 3 || !commands[0].Equals("rename", StringComparison.OrdinalIgnoreCase)) { menuItem.PrintInvalidOptionError(UserInput); return; } Grunt grunt = gruntsMenu.Grunts.FirstOrDefault(G => G.Name.Equals(commands[1], StringComparison.OrdinalIgnoreCase)); if (grunt == null) { EliteConsole.PrintFormattedErrorLine("Grunt with name: " + commands[1] + " does not exist."); menuItem.PrintInvalidOptionError(UserInput); return; } if (gruntsMenu.Grunts.Any(G => G.Name.Equals(commands[2], StringComparison.OrdinalIgnoreCase))) { EliteConsole.PrintFormattedErrorLine("Grunt with name: " + commands[2] + " already exists."); menuItem.PrintInvalidOptionError(UserInput); return; } grunt.Name = commands[2]; try { await this.CovenantClient.ApiGruntsPutAsync(grunt); } catch (HttpOperationException e) { EliteConsole.PrintFormattedWarningLine("CovenantException: " + e.Response.Content); } }
public override string GetLauncher(string StagerCode, byte[] StagerAssembly, Grunt grunt, ImplantTemplate template) { this.StagerCode = StagerCode; this.Base64ILByteString = Convert.ToBase64String(StagerAssembly); string code = CodeTemplate.Replace("{{GRUNT_IL_BYTE_STRING}}", this.Base64ILByteString); List <Compiler.Reference> references = grunt.DotNetFrameworkVersion == Common.DotNetVersion.Net35 ? Common.DefaultNet35References : Common.DefaultNet40References; references.Add(new Compiler.Reference { File = grunt.DotNetFrameworkVersion == Common.DotNetVersion.Net35 ? Common.CovenantAssemblyReferenceNet35Directory + "System.Configuration.Install.dll" : Common.CovenantAssemblyReferenceNet40Directory + "System.Configuration.Install.dll", Framework = grunt.DotNetFrameworkVersion, Enabled = true }); this.DiskCode = Convert.ToBase64String(Compiler.Compile(new Compiler.CompilationRequest { Language = template.Language, Source = code, TargetDotNetVersion = grunt.DotNetFrameworkVersion, OutputKind = OutputKind.DynamicallyLinkedLibrary, References = references })); this.LauncherString = "InstallUtil.exe" + " " + "/U" + " " + "file.dll"; return(this.LauncherString); }
public async Task GetSuggestions(string gruntName) { Grunt grunt = await _service.GetGruntByName(gruntName, StringComparison.CurrentCultureIgnoreCase); List <string> suggestions = await _service.GetCommandSuggestionsForGrunt(grunt); await this.Clients.Caller.SendAsync("ReceiveSuggestions", suggestions); }
public static GruntEncryptedMessage Create(Grunt grunt, byte[] message, GruntEncryptedMessageType Type = GruntEncryptedMessageType.Tasking) { if (grunt.Status == GruntStatus.Uninitialized || grunt.Status == GruntStatus.Stage0) { return(Create(grunt.Guid, message, Convert.FromBase64String(grunt.GruntSharedSecretPassword), Type)); } return(Create(grunt.Guid, message, Convert.FromBase64String(grunt.GruntNegotiatedSessionKey), Type)); }
public async Task <string> SharpShell(Grunt grunt, GruntCommand command, List <ParsedParameter> parameters) { if (parameters.Count() < 2 || !parameters[0].Value.Equals("SharpShell", StringComparison.OrdinalIgnoreCase)) { return(EliteConsole.PrintFormattedErrorLine("Usage: SharpShell <code>")); } string WrapperFunctionFormat = @"using System; using System.IO; using System.Linq; using System.Text; using System.Security; using System.Security.Principal; using System.Collections.Generic; using SharpSploit.Credentials; using SharpSploit.Enumeration; using SharpSploit.Execution; using SharpSploit.Generic; using SharpSploit.Misc; public static class Task {{ public static string Execute() {{ {0} }} }}"; string csharpcode = string.Join(" ", parameters.Skip(1).Select(P => P.Value).ToArray()); GruntTask newSharpShellTask = await _context.CreateGruntTask(new GruntTask { Name = "SharpShell-" + Utilities.CreateShortGuid(), AlternateNames = new List <string>(), Description = "Execute custom c# code.", Code = string.Format(WrapperFunctionFormat, csharpcode), Options = new List <GruntTaskOption>() }); await _context.AddAsync(new GruntTaskReferenceSourceLibrary { ReferenceSourceLibrary = await _context.GetReferenceSourceLibraryByName("SharpSploit"), GruntTask = newSharpShellTask }); await _context.SaveChangesAsync(); await _context.CreateGruntTasking(new GruntTasking { GruntId = grunt.Id, GruntTaskId = newSharpShellTask.Id, Type = GruntTaskingType.Assembly, Status = GruntTaskingStatus.Uninitialized, GruntCommandId = command.Id, GruntCommand = command }, _grunthub); return(""); }
public override Move Act() { if (Grunt.Self.Life < START_MINING_HEALTH || Grunt.DistanceToNextTavern() > 1) { return(Grunt.World["taverns"].GetMove(Grunt.Self.Position)); } return(Move.Stay); }
// post task private async Task <ActionResult> PostTask(Grunt egressGrunt, Grunt targetGrunt, ModelUtilities.GruntEncryptedMessage outputMessage, string guid) { if (targetGrunt == null || targetGrunt.Status != GruntStatus.Active || egressGrunt == null || egressGrunt.Guid != guid) { // Invalid GUID. May not be legitimate Grunt request, respond NotFound return(NotFound()); } string TaskName = outputMessage.Meta; if (string.IsNullOrWhiteSpace(TaskName)) { // Invalid task response. This happens on post-register write return(NotFound()); } GruntTasking gruntTasking; try { gruntTasking = await _client.ApiGruntsTaskingsByTaskingnameGetAsync(TaskName); } catch (HttpOperationException) { // Invalid taskname. May not be legitimate Grunt request, respond NotFound return(NotFound()); } if (targetGrunt == null || targetGrunt.Status != GruntStatus.Active) { // Invalid Grunt. May not be legitimate Grunt request, respond NotFound return(NotFound()); } if (!outputMessage.VerifyHMAC(Convert.FromBase64String(targetGrunt.GruntNegotiatedSessionKey))) { // Invalid signature. Almost certainly not a legitimate Grunt request, respond NotFound return(NotFound()); } string taskOutput = Common.CovenantEncoding.GetString(_utilities.GruntSessionDecrypt(targetGrunt, outputMessage)); gruntTasking.GruntCommand.CommandOutput = new CommandOutput { Id = 0, GruntCommandId = gruntTasking.GruntCommandId, Output = taskOutput }; gruntTasking.GruntCommand.CommandOutputId = 0; gruntTasking.Status = GruntTaskingStatus.Completed; gruntTasking.CompletionTime = DateTime.UtcNow; gruntTasking.GruntCommand = await _client.ApiCommandsPutAsync(gruntTasking.GruntCommand); await _client.ApiTaskingsPutAsync(gruntTasking); targetGrunt.LastCheckIn = DateTime.UtcNow; await _client.ApiGruntsPutAsync(targetGrunt); return(Ok()); }
public void ShootGruntWithBazooka() { Weapon testWeapon = new Bazooka(); Enemy testEnemy = new Grunt(); testWeapon.Shoot(testEnemy); int test = Grunt.Grunt_Starting_Energy - Bazooka.Bazooka_Damage_Points; Assert.AreEqual(test, testEnemy.EnergyRemaining); }
// Update is called once per frame void Update() { colliders = Physics.OverlapSphere(transform.position,2F); if(colliders.Length>0){ foreach(Collider col in colliders){ grunt = col.gameObject.GetComponent<Grunt>(); if( grunt != null){ //mostra display H //libera possibilidade de apertar o H return; }else{ //bloqueia o H } } } }
/// <summary> Processes a single incoming message by sending it to the appropriate /// internal location. If an incoming message contains /// an MSA-2 field, it is assumed that this message is meant as a reply to a message that has been sent /// earlier. In this case an attempt is give the message to the object /// that sent the corresponding outbound message. If the message contains an MSA-2 but there are no objects that /// appear to be waiting for it, it is discarded and an exception is logged. If the message does not /// contain an MSA-2 field, it is concluded that the message has arrived unsolicited. In this case /// it is sent to the Responder (in a new Thread). /// </summary> protected internal virtual void processMessage(System.String message) { System.String ackID = conn.Parser.getAckID(message); if (ackID == null) { Grunt g = new Grunt(this, conn, message); g.Start(); } else { NuGenMessageReceipt mr = conn.findRecipient(ackID); if (mr == null) { } else { mr.Message = message; } } }