Allow already connected Bunny

No more need to disconnect and reconnect the bunny when using
bunny-connecter.sh

Also, it now looks for 00:11:22:33:44:55 instead of just 00:11:22
pull/575/head
rsxchin 2023-01-29 18:19:26 -10:00
parent e23e35a831
commit 1d7b83cdcc
1 changed files with 2 additions and 8 deletions

View File

@ -125,12 +125,6 @@ function manualsetup {
} }
function guidedsetup { function guidedsetup {
bunnydetected=$(ip addr | grep '00:11:22' -B1 | awk {'print $2'} | head -1 | grep 'eth\|en')
if [[ "$?" == 0 ]]; then
printf "\n Bash Bunny detected. Please disconnect the Bash Bunny from\n this computer and $(tput bold)press any key$(tput sgr0) to continue with guided setup.\n "
read -r -sn1 anykey
guidedsetup
fi
hasiproute2=$(which ip) hasiproute2=$(which ip)
if [[ "$?" == 1 ]]; then if [[ "$?" == 1 ]]; then
printf "\n\n Configuration requires the 'iproute2' package (aka the 'ip' command).\n Please install 'iproute2' to continue.\n"; menu printf "\n\n Configuration requires the 'iproute2' package (aka the 'ip' command).\n Please install 'iproute2' to continue.\n"; menu
@ -174,7 +168,7 @@ function guidedsetup {
printf "\n $(tput setaf 3)Step 3 of 3: Select Bash Bunny Interface$(tput sgr0)\n Please connect the Bash Bunny to this computer.\n " printf "\n $(tput setaf 3)Step 3 of 3: Select Bash Bunny Interface$(tput sgr0)\n Please connect the Bash Bunny to this computer.\n "
a="0" a="0"
until bunnyiface=$(ip addr | grep '00:11:22' -B1 | awk {'print $2'} | head -1 | grep 'eth\|en') until bunnyiface=$(ip addr | grep '00:11:22:33:44:55' -B1 | awk {'print $2'} | head -1 | grep 'eth\|en')
do do
printf "." printf "."
sleep 1 sleep 1
@ -186,7 +180,7 @@ function guidedsetup {
done done
printf "[Checking]" printf "[Checking]"
sleep 5 # Wait as the system is likely to rename interface. Sleeping rather than more advanced error handling becasue reasons. sleep 5 # Wait as the system is likely to rename interface. Sleeping rather than more advanced error handling becasue reasons.
bunnyiface=$(ip addr | grep '00:11:22' -B1 | awk {'print $2'} | head -1 | grep 'eth\|en' | sed 's/://g') bunnyiface=$(ip addr | grep '00:11:22:33:44:55' -B1 | awk {'print $2'} | head -1 | grep 'eth\|en' | sed 's/://g')
printf "\n Detected Bash Bunny on interface $(tput bold)$bunnyiface$(tput sgr0)\n"; printf "\n Detected Bash Bunny on interface $(tput bold)$bunnyiface$(tput sgr0)\n";
read -r -p " Use the above detected Bash Bunny interface? [Y/n]? " pi read -r -p " Use the above detected Bash Bunny interface? [Y/n]? " pi
case $pi in case $pi in