Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script that find mass storage devices on a computer
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This directory contains files that may of may not be used in the project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from usb.core import find | ||
import usb.control | ||
|
||
|
||
def is_mass_storage(dev): | ||
import usb.util | ||
for cfg in dev: | ||
if usb.util.find_descriptor(cfg, bInterfaceClass=8) is not None: | ||
return True | ||
|
||
|
||
for mass in find(find_all=True, custom_match=is_mass_storage): | ||
print(mass) |