Elaina Posted December 14, 2021 Share Posted December 14, 2021 Hey I was wondering if it was possible to use the Bash Bunny Command WAIT_FOR_PRESENT in a if statement so instead of stopping the code and searching for a device name it would simply check for one and if not found move on. Sorry if this is an easy question to answer, I'm a little new to this and thanks for your time. Quote Link to comment Share on other sites More sharing options...
dark_pyrro Posted December 14, 2021 Share Posted December 14, 2021 Why do you want to use it along with an if statement? I get the idea in general. I would probably not rush over that if statement in that case but rather wait for a while since a quick "check and run" might miss a device nearby. Perhaps a "while" or "for" with some delays before skipping it and continuing with the code execution. Quote Link to comment Share on other sites More sharing options...
Elaina Posted December 14, 2021 Author Share Posted December 14, 2021 @dark_pyrro I want this so I can run different payloads depending on what device I trigger it from, I also see the sense of delays but in the end I'm looking for a way to check for a Bluetooth device for lets say 5 seconds and if not picked up then go check for the next one. and the while loop makes it constantly check for devices. Making a way to run different payloads depending on what trigger is used. Quote Link to comment Share on other sites More sharing options...
Solution dark_pyrro Posted December 14, 2021 Solution Share Posted December 14, 2021 you could probably also change the default WAIT_FOR_PRESENT extension, it's in the /payloads/extensions directory on the udisk of the Bunny as a bash file Quote Link to comment Share on other sites More sharing options...
Elaina Posted December 14, 2021 Author Share Posted December 14, 2021 @dark_pyrro Thanks a lot, It seems to work although I wouldn't call it pretty. Here it is, just want your opinion on it as you know a lot more than I do. #!/bin/bash WAIT_FOR_BLUETOOTH() { stty -F /dev/ttyS1 speed 115200 cs8 -cstopb -parenb -echo -ixon -icanon -opost stty -F /dev/ttyS1 speed 115200 cs8 -cstopb -parenb -echo -ixon -icanon -opost sleep 1 echo -n -e "AT+ROLE=2" > /dev/ttyS1 echo -n -e "AT+RESET" > /dev/ttyS1 timeout 5s cat /dev/ttyS1 > /tmp/bt_observation } ATTACKMODE HID device="attack1" otherdevice="attack2" while true; do LED W WAIT_FOR_BLUETOOTH LED Y if grep -qao $device /tmp/bt_observation; then LED G Q GUI r Q DELAY 100 Q STRING "notepad" Q ENTER Q DELAY 200 Q STRING "attack1" Q ENTER break fi sleep 1 if grep -qao $otherdevice /tmp/bt_observation; then LED B Q GUI r Q DELAY 100 Q STRING "notepad" Q ENTER Q DELAY 200 Q STRING "attack2" Q ENTER break fi sleep 1 done Q DELAY 2000 LED M Quote Link to comment Share on other sites More sharing options...
dark_pyrro Posted December 15, 2021 Share Posted December 15, 2021 I have no opinion really. Or to be more exact, I don't have the time to look more in detail. Just test it and verify that it runs as expected. The thing that I probably would focus on (as long as the code is OK) is the delays just so that the Bluetooth communication gets the time it needs to "see" any BT device nearby. 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.