Пример #1
0
 /// <summary>
 /// Allocate the payload to the target process. Handles unknown payload types.
 /// </summary>
 /// <author>The Wover (@TheRealWover)</author>
 /// <param name="Payload">The payload to allocate to the target process.</param>
 /// <param name="Process">The target process.</param>
 /// <returns>Base address of allocated memory within the target process's virtual memory space.</returns>
 public override IntPtr Allocate(PayloadType Payload, Process Process)
 {
     if (!IsSupportedPayloadType(Payload))
     {
         throw new PayloadTypeNotSupported(Payload.GetType());
     }
     return(Allocate(Payload, Process, IntPtr.Zero));
 }
Пример #2
0
        /// <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());
            }
        }
Пример #3
0
        /// <summary>
        /// Allocate the payload to the target process.
        /// </summary>
        /// <author>The Wover (@TheRealWover)</author>
        /// <param name="Payload">The payload to allocate to the target process.</param>
        /// <param name="Process">The target process.</param>
        /// <returns>Base address of allocated memory within the target process's virtual memory space.</returns>
        public virtual IntPtr Allocate(PayloadType Payload, Process Process)
        {
            Type[] funcPrototype = new Type[] { Payload.GetType(), typeof(Process) };

            try
            {
                // Get delegate to the overload of Allocate that supports the type of payload passed in
                MethodInfo allocate = this.GetType().GetMethod("Allocate", funcPrototype);

                // Dynamically invoke the appropriate Allocate overload
                return((IntPtr)allocate.Invoke(this, new object[] { Payload, Process }));
            }
            // If there is no such method
            catch (ArgumentNullException)
            {
                throw new PayloadTypeNotSupported(Payload.GetType());
            }
        }
Пример #4
0
 /// <summary>
 /// States whether the payload is supported.
 /// </summary>
 /// <author>The Wover (@TheRealWover)</author>
 /// <param name="Payload">Payload that will be allocated.</param>
 /// <returns></returns>
 public override bool IsSupportedPayloadType(PayloadType Payload)
 {
     return(supportedPayloads.Contains(Payload.GetType()));
 }