RazerBlade Posted March 12, 2017 Share Posted March 12, 2017 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. Quote Link to comment Share on other sites More sharing options...
GermanNoob Posted March 12, 2017 Share Posted March 12, 2017 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 Quote Link to comment Share on other sites More sharing options...
RazerBlade Posted March 12, 2017 Author Share Posted March 12, 2017 I ran the script and it just outputed a blank txt file. So no luck I guess. I hope darrren can take a look into this problem. Quote Link to comment Share on other sites More sharing options...
GermanNoob Posted March 12, 2017 Share Posted March 12, 2017 @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. Quote Link to comment Share on other sites More sharing options...
MrSnowMonster Posted March 12, 2017 Share Posted March 12, 2017 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... Quote Link to comment Share on other sites More sharing options...
RazerBlade Posted March 12, 2017 Author Share Posted March 12, 2017 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 Quote Link to comment Share on other sites More sharing options...
RazerBlade Posted March 12, 2017 Author Share Posted March 12, 2017 Found the problem. Bunny_helpers.sh was encoded as DOS line ending and not unix format. Problem solved! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.