Rshell is a powerful and advanced reverse shell generator supporting multiple programming languages and shell variants. It is designed for penetration testers and security professionals to quickly generate reverse shell commands with encoding options and shell stabilization tips.
Note: This tool was entirely developed using AI assistance from VSCode and Claude 3.5 Sonnet.
- Multiple Shell Languages: Supports Bash, Python, PHP, Perl, Powershell, Java, Golang, Socat, AWK, Lua, and more.
- Shell Variants: Provides various shell methods for bypassing different security controls.
- Encoding Support: Offers Base64 and URL encoding for payloads.
- Shell Stabilization Tips: Includes tips for stabilizing shells after exploitation.
- Command Saving: Ability to save generated commands to a file.
- Color-Coded Output: Enhances readability with colored output (can be disabled).
- Raw Output Mode: Outputs only the reverse shell command for easy scripting.
- Comprehensive Help: Detailed usage instructions and examples.
- Usage
- Installation
- Examples
- Available Shells
- Shell Stabilization Tips
- Contribution
- License
- Disclaimer
Usage:
rshell <ip> <port> [options] # Generate reverse shell
rshell --list # List all available shells
rshell --version # Show version information
Required Arguments:
ip Target IP address (e.g., 192.168.1.10)
port Target port number (1-65535)
Core Options:
-h, --help Show this help message
-v, --version Show version information
--list List all available reverse shells
--raw Output only the shell command without formatting
--no-color Disable colored output
Shell Options:
-l, --language <language> Specify shell language (default: bash)
--no-tips Disable shell stabilization tips
Output Options:
-e, --encode <method> Encode payload using specified method
Supported encodings: base64, url
-s, --save <file> Save output to specified file
-
Clone the Repository
git clone https://github.com/ErvisTusha/rshell.git
-
Navigate to the Directory
cd rshell
-
Make the Script Executable
chmod +x rshell.py
-
Ensure Python 3 is Installed
Rshell requires Python 3 to run. You can check your Python version with:
python3 --version
Generate a basic Bash reverse shell:
./rshell.py 192.168.1.10 4444
Generate a Python reverse shell:
./rshell.py 10.0.0.1 9001 -l python
Generate a Base64 encoded payload:
./rshell.py 192.168.1.10 4444 -e base64
Save the command to a file:
./rshell.py 192.168.1.10 4444 -s shell.txt
Output only the command without additional formatting:
./rshell.py 192.168.1.10 4444 --raw
Generate a PHP reverse shell without stabilization tips:
./rshell.py 192.168.1.10 4444 -l php --no-tips
- bash: Basic bash TCP reverse shell
- python: Python socket-based reverse shell
- php: Standard PHP reverse shell (recommended)
- perl: Perl socket-based reverse shell
- nc: Netcat reverse shell with
-e
option - ruby: Ruby socket-based reverse shell
- powershell: PowerShell reverse shell with stream handling
- java: Java runtime reverse shell
- golang: Go TCP reverse shell
- socat: Socat reverse shell
- awk: AWK reverse shell
- lua: Lua socket-based reverse shell
- php-system: PHP shell using
system()
- php-passthru: PHP shell using
passthru()
- php-shell_exec: PHP shell using
shell_exec()
- php-popen: PHP shell using
popen()
- php-proc_open: PHP shell using
proc_open()
- perl-pipe: Perl reverse shell using pipe
- perl-fork: Perl reverse shell using fork
- python-export: Python reverse shell using environment variables
- bash-196: Bash reverse shell using file descriptor 196
- nc-mkfifo: Netcat reverse shell using named pipe
- python-short: Shortened Python reverse shell
- bash-tcp: Bash reverse shell using TCP
- nc-e: Netcat reverse shell with
-e
flag - nc-c: Netcat reverse shell with
-c
flag - ruby-shell: Ruby reverse shell with file descriptor
- xterm: X11 terminal reverse shell
Use ./rshell.py --list
to display all available shells directly from the tool.
After obtaining a reverse shell, you may need to stabilize it for better interaction. Below are some tips for various shells.
Basic Upgrade:
python -c 'import pty; pty.spawn("/bin/bash")'
Full TTY Upgrade Process:
-
Spawn a TTY shell:
python -c 'import pty; pty.spawn("/bin/bash")'
-
Set terminal type:
export TERM=xterm
-
Background the shell:
Press
Ctrl + Z
-
Adjust terminal settings:
stty raw -echo; fg
-
Reset the shell:
reset
-
Resize terminal window:
stty rows <num_rows> columns <num_columns>
Basic Upgrade:
SHELL=/bin/bash script -q /dev/null
Full TTY Upgrade Process:
-
Start a new shell session:
SHELL=/bin/bash script -q /dev/null
-
Set terminal type and size:
export TERM=xterm stty rows <num_rows> columns <num_columns>
Basic Upgrade:
perl -e 'exec "/bin/bash";'
Full TTY Upgrade Process:
-
Start a new shell session:
perl -e 'exec "/bin/bash";'
-
Adjust terminal settings as with Bash.
Contributions are welcome! Please follow these steps:
-
Fork the Repository
-
Create a Feature Branch
git checkout -b feature/YourFeature
-
Commit Your Changes
git commit -m "Add your feature"
-
Push to the Branch
git push origin feature/YourFeature
-
Open a Pull Request
Please ensure your code adheres to the existing style and includes appropriate documentation.
This project is licensed under the MIT License - see the LICENSE file for details.
Legal Disclaimer: This tool is intended for educational purposes and ethical penetration testing only. Unauthorized use of this tool to attack targets without prior mutual consent is illegal.
The developer of Rshell is not responsible for any misuse or damage caused by this tool.
Author: Ervis Tusha
GitHub: https://github.com/ErvisTusha/rshell
Twitter: https://x.com/ET
Developed with AI assistance from VSCode and Claude 3.5 Sonnet.