# PInject

The `PInject` command in Amnesiac is used to load the ProcessInjection tool, which was designed for process injection. Process injection is a technique used to hide the execution of malware code within the address space of a legitimate process.

To load the ProcessInjection module, simply type `PInject` in your active Amnesiac session.

<figure><img src="https://1622982705-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxZYmkSsz78lM8RvvHGKL%2Fuploads%2Fj76Of1WLLRacTSgnyntE%2Fimage.png?alt=media&#x26;token=52ce2dc9-606c-48d9-bcd8-6cb240835ebd" alt=""><figcaption></figcaption></figure>

This module provides you with the capability to specify two critical parameters:

1. Target Process: specify the target process into which you want to inject your shellcode.&#x20;
2. Shellcode: the shellcode you want to inject into the target process in hexadecimal format.&#x20;

To generate the shellcode, you have a couple of options:

* Use the `ShellGen` command provided in Amnesiac. Simply follow it with the command you want to execute on the target via process injection. `ShellGen` will then convert that command into shellcode, which you can subsequently use with the `PInject` command for injection.
* Alternatively, you can use the msfvenom tool from the Metasploit Framework to generate your shellcode with specific payloads and configurations.

The combination of `PInject` and `ShellGen` allows you to perform execution of arbitrary code within a running process.
