Alok Menghrajani

Security engineer at Square. Previously co-author of Hack and put the 's' in https at Facebook. Maker of CTFs.

Home | Contact me | Github | Twitter | Facebook

How can you cheaply control the ports on a usb hub?

On a build server, we wanted to sign various builds using Yubikeys. For various reasons, we wanted to use several Yubikeys. Unfortunately, simply plugging multiple Yubikeys on a single host doesn't work because there's no API to pick which token you want to communicate with.

There are various ways to solve this problem, such as buying expensive USB hubs. I however figured out that some cheap D-Link hubs let you control the power at the individual port level.

This technique is also useful when you need to copy a file to a hundred USB flash drives.

Some useful source code: https://github.com/alokmenghrajani/hub-ctrl.c