Jump to content

[Question] Firmware update in linux


Reaver9

Recommended Posts

I have been all over this forum, the github and google code page, but i cannot find the script to flash new firmware to the ducky using linux. i did find a couple things that mentioned how to do it as well as dependencies needed and the mention of duckyflash.sh, but it seems that this file is no longer exsists anywhere for download. So does anyone have any idea where to get it or how to get this done. Also when is the usbrubberducky website going to be back up and running.

Link to comment
Share on other sites

Thanks midnight.....i did find that before but the flash.sh seems to be flawed somewhere or im using incorrectly........i keep getting syntax errors from the code

reaver9@reaver9-Aspire-5536:~/Downloads$ ./flash.sh m_duck_v2.hex 
./flash.sh: 24: ./flash.sh: Syntax error: "fi" unexpected (expecting "then")
Link to comment
Share on other sites

Can you check that the file matches the following script:

 
#!/bin/sh
 
EXIT=0
if lsusb | awk '$6=="03eb:2ff6"{e=1}END{exit e}'; then
    echo "Is your Ducky connected and in DFU mode?  I don't see it.  Try"
    echo "unplugging it, then holding down the button while plugging it back in."
    EXIT=1
fi
 
FILE=${1:-firmware.hex}         # Where to get our dump.
if test -r "$FILE"; then
    if egrep -vq '^:' "$FILE"; then
        echo "That doesn't look like an ihex file."
        EXIT=1
    fi
else
    echo "No such input file or you don't have permissions to read it."
    EXIT=1
fi
 
if ! which dfu-programmer &>/dev/null; then
    echo "dfu-programmer not found.  Go install it and try again."
    EXIT=1
fi
test $EXIT -eq 1 && exit 1      # Get all the errors at once, then exit
 
die() {
    echo "$*"
    exit 2
}
 
echo Erasing...
sudo dfu-programmer at32uc3b1256 erase || die "Failed to erase"
echo Flashing...
sudo dfu-programmer at32uc3b1256 flash --suppress-bootloader-mem "$FILE" \
    || die "Failed to flash"
echo Flash complete.  Resetting your Ducky...
sudo dfu-programmer at32uc3b1256 reset || die "Failed to reset"
Edited by midnitesnake
Link to comment
Share on other sites

Srry Midnight....I just saw this....unfortunately I switched OSs in the mean time. I did get it to work earlier (backbox linux) by removing the lines of code pertaining to that error(asking about if/which dfu-programmer was available) once I did that it worked just fine. I understand just enough code to know what its trying to accomplish but not enough to find a simple syntax error. I now have Kali linux and will attempt to use the original file and see if i get the same errors. If I do i will compare to what you just posted. Either way I'll let you know what happens. Thank you.

Link to comment
Share on other sites

ok sooo after testing it on my new install using kali....i get a completely different error with both the downloaded flash.sh and the cut and paste of the script you posted above. als happens with dump.sh .....all files will tell me that dfu-programmer is not installed.

root@reaper:~/ducky/firmware# ./flash.sh m_duck_v2.hex 
dfu-programmer not found.  Go install it and try again.
root@reaper:~/ducky/firmware# /usr/local/bin/dfu-programmer

not sure why it says "/usr/local/bin/dfu-programmer" Im not typing that...the script is.

also again after i delete the portion of the script that checks which dfu-programmer...it continues on and appears to flash properly but im not sure it actually is flashing.

root@reaper:~/ducky/firmware# ./flash.sh m_duck_v2.hex 
Erasing...
Flashing...
Validating...
33672 bytes used (13.26%)
Flash complete. Resetting your Ducky...

so it is clear...i have tried installing dfu-programmer through both apt-get and the downloaded tar file.

any Ideas?

Link to comment
Share on other sites

dfu-programmer not found. Go install it and try again.

root@reaper:~/ducky/firmware# /usr/local/bin/dfu-programmer

dfu-programmer isn't in your path... edit the script so dfu-programmer becomes /usr/bin/local/dfu-programmer

also the script calls "sudo dfu-programmer" if your on backtrack / kali running as root, you can remove the sudo prefix.

looks like its flashed! - whats in dmesg when you insert the Ducky?

The script is just a wrapper the main commands (per rubber ducky flashing guide on ducky-decode)

dfu-programmer at32uc3b1256 erase
dfu-programmer at32uc3b1256 flash --suppress-bootloader-mem <firmware.hex> 
dfu-programmer at32uc3b1256 reset 
Edited by midnitesnake
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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...