Jump to content

Recommended Posts

Posted

So I am trying to flash new firmware on my ducky and I am having issues with dfu-programmer finding the device under Linux. It works perfectly fine on one of my machines that dual boots windows 10 but I cannot get it to find the device under Linux. I tried this on Archlinux, Debian and Kali with no avail.

 

   root@Cerberus comhack #dfu-programmer at32uc3b1256 dump >dump.bincmd                                                                                                                                   
dfu-programmer: no device present.

Dmesg see the ducky just fine:

[164578.733853] usb 3-1.1: new full-speed USB device number 12 using xhci_hcd

[164578.832128] input: ATMEL AVR HID Keyboard as /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1.1/3-1.1:1.0/0003:03EB:2401.0009/input/input30

[164578.884027] hid-generic 0003:03EB:2401.0009: input,hidraw2: USB HID v1.11 Keyboard [ATMEL AVR HID Keyboard] on usb-0000:00:14.0-1.1/input0

I did notice one thing though. When I insert the ducky while holding down the button, it stays red on Linux but does not light up on Windows.

I have been researching for about an hour now with no luck. I do notice that most of the documentation and github repos for the ducky are from 2013 or so. Is most of the stuff still compatible or what?

Any ideas? Thanks

 

Posted

Did you compile dfu-programmer from the tarball on the github wiki, or did you install it as a package with (for example) apt-get?  I compiled mine on Linux Mint 17, but I had to do some modification of the Makefile (required) and configure.ac (not sure if this was required, but I did the modification, anyway) based on some errors I was getting, and google-fu search results around those errors.

The steps I took were to download the tarball linked to from the wiki:

https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Flashing-ducky

Unpack the tarball, then change directory into it.

tar xvfz dfu-programmer-0.5.4.tar.gz && cd dfu-programmer-0.5.4

Modify the configure.ac:

sed -i.bak -e ‘s/LDFLAGS/LIBS/g’ ./configure.ac

Run configure as normal:

./configure

Modify the src/Makefile:

sed -i.bak -ne ‘/^LDFLAGS =/{h;s/LDFLAGS = \(.*\)/LIBS = \1/;x;s/LDFLAGS =.*/LDFLAGS =/};/^LIBS = .*/{x;};p’

Compile:

make

Everything worked fine after that.  I did have to install the missing libusb-dev and libusb-1.0.0-dev packages before doing all of the above.

sudo apt-get install libusb-dev libusb-1.0.0-dev

 

Posted

Well I tried your flag but I got an error on modifying the src/makefile:

V

root@Europa:~/Downloads/dfu-programmer-0.5.4# sed -i.bak -ne ‘/^LDFLAGS =/{h;s/LDFLAGS = \(.*\)/LIBS = \1/;x;s/LDFLAGS =.*/LDFLAGS =/};/^LIBS = .*/{x;};p'
bash: syntax error near unexpected token `}'

It looks as though you closed all of your arguments so I dunno why it is complaining about }

Posted (edited)
18 minutes ago, shofti31 said:

Well I tried your flag but I got an error on modifying the src/makefile:

V


root@Europa:~/Downloads/dfu-programmer-0.5.4# sed -i.bak -ne ‘/^LDFLAGS =/{h;s/LDFLAGS = \(.*\)/LIBS = \1/;x;s/LDFLAGS =.*/LDFLAGS =/};/^LIBS = .*/{x;};p'
bash: syntax error near unexpected token `}'

It looks as though you closed all of your arguments so I dunno why it is complaining about }

It could be a copy/pasta error (where the noodles got overcooked.)  What you pasted to show as an example of what you tried looks like it has a back tick ` instead of a single quote ' to open the sed statement (right after the -ne flag.)  There should only be single quotes in the example, so try cleaning those up and give it another shot, maybe?

I should have vetted my example before pasting it here.  I did a raw copy from my blog, and the quotes probably got mangled on my end when I pasted.  I should have pasted into something like notepad first, then re-copied to clipboard to paste here.  You might want to do similar, maybe.  Good luck!

Also, you need to put "src/Makefile" at the end of that sed statement on the same line.  I meant to include it, but somehow missed it.  Sorry.

Edited by UnixSecLab
Posted

That was the only line I didn't type out but I just did and the syntax still isn't correct:

 

root@Europa:~/Downloads/dfu-programmer-0.5.4# sed -i.bak -ne '/^LDFLAGS =/{h;s/LDFLAGS -.*/LDFLAGS =/};/^LIBS = .*/{x};p'
sed: no input files

Here is line by line what I did http://ix.io/1mmH

 

 

Posted
4 minutes ago, shofti31 said:

That was the only line I didn't type out but I just did and the syntax still isn't correct:

 


root@Europa:~/Downloads/dfu-programmer-0.5.4# sed -i.bak -ne '/^LDFLAGS =/{h;s/LDFLAGS -.*/LDFLAGS =/};/^LIBS = .*/{x};p'
sed: no input files

Here is line by line what I did http://ix.io/1mmH

 

 

Yep.  I edited my previous comment twice to get my full thought out, and you had already run off before I got the last part out which is to include the src/Makefile on the end so that it knows what file to modify :)  Make sure that's an "M" and not an "m" in the Makefile bit, since case matters.

Posted

Do you have lib-usb-dev and libusb-dev and libusb-1.0.0-dev installed? You might need to install those, then re-run ./configure && make.

sudo apt-get install libusb-dev libusb-1.0.0-dev

If you have those installed, you may need to paste the errors so we can see what you see.

Posted

Yes, they are installed:

    root@Europa:~/Downloads/dfu-programmer-0.5.4# sudo apt-get install libusb-dev libusb-1.0.0-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libusb-1.0-0-dev' for regex 'libusb-1.0.0-dev'
libusb-1.0-0-dev is already the newest version (2:1.0.20-1).
libusb-dev is already the newest version (2:0.1.12-30).
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.

Here is the output from make:

   root@Europa:~/Downloads/dfu-programmer-0.5.4# make
make  all-recursive
make[1]: Entering directory '/root/Downloads/dfu-programmer-0.5.4'
Making all in src
make[2]: Entering directory '/root/Downloads/dfu-programmer-0.5.4/src'
gcc -Wall -g -O2   -o dfu-programmer main.o arguments.o atmel.o commands.o dfu.o intel_hex.o util.o  
main.o: In function `main':
/root/Downloads/dfu-programmer-0.5.4/src/main.c:62: undefined reference to `usb_init'
/root/Downloads/dfu-programmer-0.5.4/src/main.c:110: undefined reference to `usb_release_interface'
/root/Downloads/dfu-programmer-0.5.4/src/main.c:123: undefined reference to `usb_close'
/root/Downloads/dfu-programmer-0.5.4/src/main.c:81: undefined reference to `usb_set_debug'
dfu.o: In function `dfu_transfer_out':
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:845: undefined reference to `usb_control_msg'
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:845: undefined reference to `usb_control_msg'
dfu.o: In function `dfu_transfer_in':
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:872: undefined reference to `usb_control_msg'
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:872: undefined reference to `usb_control_msg'
dfu.o: In function `dfu_transfer_out':
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:845: undefined reference to `usb_control_msg'
dfu.o:/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:872: more undefined references to `usb_control_msg' follow
dfu.o: In function `dfu_device_init':
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:475: undefined reference to `usb_find_busses'
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:476: undefined reference to `usb_find_devices'
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:479: undefined reference to `usb_get_busses'
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:492: undefined reference to `usb_open'
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:494: undefined reference to `usb_set_configuration'
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:495: undefined reference to `usb_claim_interface'
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:506: undefined reference to `usb_release_interface'
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:507: undefined reference to `usb_close'
dfu.o: In function `dfu_make_idle':
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:816: undefined reference to `usb_reset'
dfu.o: In function `dfu_device_init':
/root/Downloads/dfu-programmer-0.5.4/src/dfu.c:516: undefined reference to `usb_close'
collect2: error: ld returned 1 exit status
Makefile:235: recipe for target 'dfu-programmer' failed
make[2]: *** [dfu-programmer] Error 1
make[2]: Leaving directory '/root/Downloads/dfu-programmer-0.5.4/src'
Makefile:264: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/Downloads/dfu-programmer-0.5.4'
Makefile:200: recipe for target 'all' failed
make: *** [all] Error 2
root@Europa:~/Downloads/dfu-programmer-0.5.4# 

 

Posted

Those were the errors I got before I found the fixes I listed when I originally did this.  I did this on Linux Mint, which is Ubuntu and thus Debian based.  Something might be "off" from all of the troubleshooting you were doing, so the best I can suggest at this point is to do the following:

1) Delete the dfu-programmer-0.5.4 directory.

2) Untar the tarball to get a fully clean slate.

3) Do the "sed" to fix the configure file.

4) Run ./configure.

5) Do the "sed" to fix the src/Makefile file.

6) Run make

If it still fails, you might try blowing it away again, and do your ./configure and make without the sed modifications and see if it compiles on your system.  If you still have issues, I'll gather more information about the binary I built when I get back to work tomorrow (in case there are other libraries missing.)  Sorry this is giving you so much trouble.

Posted
33 minutes ago, shofti31 said:

Everything is working. No errors on make or make install and dfu-programmer is working with my ducky.

 

Thanks again

Sweet.  Glad you got it working!  Sorry I gave muddled instructions the first time around.  I'll try to pay more attention in future ;)

Posted

Not a problem, I appreciate it. I learned years ago that Open source is all about giving back and I do the same thing through support (Google+ Communities and a few forums I admin). 

 

Thanks

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