Jump to content

Bunny_helper.sh Problems


RazerBlade
 Share

Recommended Posts

Hello Everyone!

I have a problem with my Bash Bunny where bunny_helper.sh doesent function so I have to always specify the switch when running an attack, for instance Usb_exfiltrator. I use the latest version from github but it still doesent functiion properly. Please help.

Link to comment
Share on other sites

Hmm, have you tried to use a short test script? I wrote this one and it works fine for me:

LED R G B

source bunny_helpers.sh

echo $SWITCH_POSITION >> /root/loot/switch.txt

sync

LED G

 

Link to comment
Share on other sites

@RazerBlade

Instead of waiting for others, why don't you evaluate / debug by yourself? just insert some echo "whatever" >> whatever-file within the bunny_helpers.sh to get an idea why it isn't working... With more information people might be able to help you.

Link to comment
Share on other sites

You could always copy this inside your payload:

 

check_switch() {
	switch1=`cat /sys/class/gpio_sw/PA8/data`
	switch2=`cat /sys/class/gpio_sw/PL4/data`
	switch3=`cat /sys/class/gpio_sw/PL3/data`
	if [ "x$switch1" = "x0" ] && [ "x$switch2" = "x1" ] && [ "x$switch3" = "x1" ]; then
		SWITCH_POSITION="switch1"
	elif [ "x$switch1" = "x1" ] && [ "x$switch2" = "x0" ] && [ "x$switch3" = "x1" ]; then
		SWITCH_POSITION="switch2"
	elif [ "x$switch1" = "x1" ] && [ "x$switch2" = "x1" ] && [ "x$switch3" = "x0" ]; then
		SWITCH_POSITION="switch3"
	else
		SWITCH_POSITION="invalid"
	fi
}

check_switch

This is basicly what the bunny helper does. If this doesnt work, then something is wrong with your bashbunny...

Link to comment
Share on other sites

I ran source bunny_helpers.sh via serial and it outputs this:

root@bunny:~/udisk/payloads/library# source bunny_helpers.sh
-bash: $'\r': command not found
: No such file or directoryases
-bash: command substitution: line 19: syntax error near unexpected token `|'
-bash: command substitution: line 19: `         | sort | uniq | tail -n1 | sed "s/^[ \t]*//" | sed 's/\"//g' | sed 's/;//''
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: bunny_helpers.sh: line 25: syntax error near unexpected token `$'{\r''
'bash: bunny_helpers.sh: line 25: `check_switch() {

 

If i run:

cat /sys/class/gpio_sw/PA8/data
cat /sys/class/gpio_sw/PL4/data
cat /sys/class/gpio_sw/PL3/data

It outputs the correct data and if I remove the check switch bracket in the beginning of bunny_helpers so the script looks like this:

#check_switch() {
        switch1=`cat /sys/class/gpio_sw/PA8/data`
        switch2=`cat /sys/class/gpio_sw/PL4/data`
        switch3=`cat /sys/class/gpio_sw/PL3/data`
        echo "--- switch1 = $switch1, switch2 = $switch2, switch3 = $switch3"
        if [ "x$switch1" = "x0" ] && [ "x$switch2" = "x1" ] && [ "x$switch3" = $
                SWITCH_POSITION="switch1"
        elif [ "x$switch1" = "x1" ] && [ "x$switch2" = "x0" ] && [ "x$switch3" $
                SWITCH_POSITION="switch2"
        elif [ "x$switch1" = "x1" ] && [ "x$switch2" = "x1" ] && [ "x$switch3" $
                SWITCH_POSITION="switch3"
        else
                SWITCH_POSITION="invalid"
        fi
#}

Then the script just spews out problems

-bash: $'\r': command not found
: No such file or directoryases
-bash: command substitution: line 19: syntax error near unexpected token `|'
-bash: command substitution: line 19: `         | sort | uniq | tail -n1 | sed "s/^[ \t]*//" | sed 's/\"//g' | sed 's/;//''
-bash: $'\r': command not found
-bash: $'\r': command not found
, switch3 = 0 1
-bash: apa.sh: line 32: syntax error near unexpected token `elif'
'bash: apa.sh: line 32: `       elif [ "x$switch1" = "x1" ] && [ "x$switch2" = "x0" ] && [ "x$switch3" = "x1" ]; then

I really don't know what to do I expect Darren to look into this issue ASAP
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...