/// <summary> /// Execute a payload in the current process using a specific allocation technique. /// </summary> /// <author>The Wover (@TheRealWover)</author> /// <param name="Payload">The type of payload to execute.</param> /// <param name="AllocationTechnique">The allocation technique to use.</param> /// <returns></returns> public virtual bool Inject(PayloadType Payload, AllocationTechnique AllocationTechnique) { Type[] funcPrototype = new Type[] { Payload.GetType(), AllocationTechnique.GetType() }; try { // Get delegate to the overload of Inject that supports the type of payload passed in MethodInfo inject = this.GetType().GetMethod("Inject", funcPrototype); // Dynamically invoke the appropriate Allocate overload return((bool)inject.Invoke(this, new object[] { Payload, AllocationTechnique })); } // If there is no such method catch (ArgumentNullException) { throw new PayloadTypeNotSupported(Payload.GetType()); } }
public bool Inject(PICPayload Payload, AllocationTechnique AllocationTechnique, Process Process) { IntPtr baseAddr = AllocationTechnique.Allocate(Payload, Process); return(Inject(Payload, baseAddr, Process)); }
/// <summary> /// Inject a payload into the current process using a specified allocation and execution technique. /// </summary> /// <param name="Payload"></param> /// <param name="AllocationTechnique"></param> /// <param name="ExecutionTechnique"></param> /// <returns></returns> public static bool Inject(PayloadType Payload, AllocationTechnique AllocationTechnique, ExecutionTechnique ExecutionTechnique) { return(ExecutionTechnique.Inject(Payload, AllocationTechnique)); }