Ban USB devices from the ports

An USB device has some descriptors and based on them we could find out information about that connected device.

But here comes a problem, what if a device tells us it is what he is not (like a HID device). Well, in that case the driver would be automatically loaded and someone could have access to our computer.

Screenshot from 2015-06-09 20:32:39

Lucky for us, we can manually “unload a driver” using the unbind special file. Unload a driver is not specifically a correct term, you do not really unload it, but you unbind the device from that driver.

By simply writing (could use echo) the bus id of the device to that file, would cause the device to not be usable.

Screenshot from 2015-06-09 20:39:15

To make it usable again, simply write the same bus id of the device to the bind file.

Screenshot from 2015-06-09 20:39:59

By simply doing this, you could play with the device and allow it to be seen or not by your PC.

This could be easily implemented in Python, simply opening the bind/unbind file and writing in it a specific bus id.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s