Jump to content

[Firmware] Firmware Beta - Linux Support


Recommended Posts

We have been hard at work on the new firmware and here it is.

Added Linux Support Beta RC0 - https://github.com/downloads/hak5darren/USB-Rubber-Ducky/Duck%20Linux%20Beta.hex

How to re-flash :

- Download http://hak5.org/Duck%20Programming.zip

- Install appropriate driver from Atmel FLIP package

- hold button while inserting the duck into a windows computer. The duck is now in firmware update mode (DFU)

- Run 'program.bat duck.hex'

There will be more releases as the week goes on.

Link to comment
Share on other sites

Here's a script in Linux to flash the duck.

#!/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;
#    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"

And a script to backup the existing firmware from the duck.


#!/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:-dump.bin}		# Where to put our dump.
if [ -f "$FILE" ]; then
    echo "Output file already exists.  Remove it or specify another."
    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

sudo dfu-programmer at32uc3b1256 dump >$FILE
echo Dump complete.  Resetting your Ducky...
sudo dfu-programmer at32uc3b1256 reset

So sorry I forget the user who posted the scripts, will update with credit with I find it.

Link to comment
Share on other sites

does this firmware still function the same on windows?

and what about the duckencoder, is there an updated one with a few extra languages?

thank you Jason and Darren for releasing this

I am sure once the process for figuring out other languages/key codes becomes second nature will make this project bloom again:-D

Edited by petertfm
Link to comment
Share on other sites

does this firmware still function the same on windows?

and what about the duckencoder, is there an updated one with a few extra languages?

thank you Jason and Darren for releasing this

I am sure once the process for figuring out other languages/key codes becomes second nature will make this project bloom again:-D

I will try later.... (edit) Actually still works fine in Windows(/edit)

Sadly, does not work for me in Linux Gentoo kernel 3.2.1, or Ubuntu Kernel 11.04 3.0.1.

Looking at the USB packets there are descriptors for an apple keyboard (?why?), and it tries to setup Mass Storage support (i can see LUN setup). Still get a few malformed USB packets but not as many as the previous firmware. So the USB handshake looks like it needs more work, but looks like we are getting closer.

There are a lot of code changes in the hex file...so Im interested in what has actually changed in the code.

ASF Framework has about 10 layers of abstraction which makes things difficult, but once you get it right, the USB handshake should work on any OS. I don't forsee the need for different firmwares for different OS's. So in theory it should work in both Linux and Windows.

Think this release is just to settle people, who appear fed up. To prove support is actually still ongoing. ]

Would be nice to see updates in the git source repo.

Edited by midnitesnake
Link to comment
Share on other sites

I will try later.... (edit) Actually still works fine in Windows(/edit)

Sadly, does not work for me in Linux Gentoo kernel 3.2.1, or Ubuntu Kernel 11.04 3.0.1.

Looking at the USB packets there are descriptors for an apple keyboard (?why?), and it tries to setup Mass Storage support (i can see LUN setup). Still get a few malformed USB packets but not as many as the previous firmware. So the USB handshake looks like it needs more work, but looks like we are getting closer.

There are a lot of code changes in the hex file...so Im interested in what has actually changed in the code.

ASF Framework has about 10 layers of abstraction which makes things difficult, but once you get it right, the USB handshake should work on any OS. I don't forsee the need for different firmwares for different OS's. So in theory it should work in both Linux and Windows.

Think this release is just to settle people, who appear fed up. To prove support is actually still ongoing. ]

Would be nice to see updates in the git source repo.

It was tested on Ubuntu and it works great. Based on your comments is seems you might have a usb analyzer, can you provide me with a capture?

Link to comment
Share on other sites

This is what I'm seeing from dmesg on 2.6.32

[195381.975755] usb 6-1: new full speed USB device using uhci_hcd and address 8
[195382.156921] usb 6-1: configuration #1 chosen from 1 choice
[195382.159936] scsi22 : SCSI emulation for USB Mass Storage devices
[195382.160016] usb-storage: device found at 8
[195382.160019] usb-storage: waiting for device to settle before scanning
[195382.165870] input: Apple Inc. Keyboard as /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.1/input/input12
[195382.165951] generic-usb 0003:16C0:047C.0009: input,hidraw6: USB HID v1.11 Keyboard [Apple Inc. Keyboard] on usb-0000:00:1d.0-1/input1

And it's executing my payloads.

Link to comment
Share on other sites

Hello,

Just for my understanding......

1- Is there a way to make sure it is in DFU mode ? ( is the LED on or blinking ? )

2- When I execute "program.bat" a cmd window opens and closes real fast so i am not even sure it updated the duck is that normal ?

3- How can I see what firmware version I have on duck ? ( just to see if it updated OK )

Thanks

Link to comment
Share on other sites

Hello,

Just some more info.

At first I took the Micro SD card out and I was not able to install the drivers.

I also had issues installing the Atmel drivers.

So here are my findings.

1- Make sure to leave the Micro SD in the Ducky

2- To get the ducky into DFU mode when inserting press the button and hold it do not release immediatly it takes some time.

3- You should see under Devices a " Atmel USB Device" under there you can see that the drivers are missing, right click and install the drivers from where you downloaded them

now you should be able to see the ducky.

So I got that but I believe the flashing is still not functionning the CMD screen pops up and closes so fast I can not see it it flashes or not.

Link to comment
Share on other sites

Open a new command prompt from Start > Run > CMD <enter>

That way when you run the program.bat it won't disappear on completion. Also you must specify the hex file to be programmed. I believe the syntax is

program.bat duck.hex

Also keep in mind there are no drivers to install if flashing on the Linux side.

Cheers,

Darren

Link to comment
Share on other sites

Hello,

In windows i have this:

I copied "program.bat" and "duck.hex" on to C:

I then opened a terminal window and typed in " program.bat duck.hex"

The "bat" file executes but stops with the following error message:

" The command "batchisp" is either written wrong or could not be found "

In Linux I have this:

I put the script above into a file called duck.sh ( and made it executable)

I then ran " sh duck.sh Duck.hex "

I got the following output:

Erasing...

sudo: dfu-programmer: command not found

Failed to erase

So also in Linux no luck

has anybody been able to flash the ducky ?

Thanks

Edited by webdirector
Link to comment
Share on other sites

Test failed in Ubuntu with 2.6.35-32-generic. Still not working for me unless a keyboard LED is activated. Seems like this is still triggering on the same condition as the previous firmware. See this thread for more detail on that. If this is the same firmware that was being tested back in February, why is the source still not available? If binary is released before source, then it is not open source.

The section Darren commented out of flash.sh was missing the "then". That error check should make things a bit more clear for folks like webdirector.

Link to comment
Share on other sites

  • 5 months later...

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...