I left my USB at a friend’s house, and I believe he saw some personal files I had in it.
I’m a fool ’cause they weren’t password protected, I know. but right now I want software or something that can tell me the “history” of my USB. I mean, the latest opened or copied documents.
Is there anything like that?
How can we query connected USB devices info in Python?I want to get UID Device Name (ex: SonyEricsson W660), path to device (ex: /dev/ttyACM0)
And also what would be the best Parameter out of above info to be used as identifying the device whenever it's connected again? (UID?)
I am working on Ubuntu 11.04.
ATM I have this code (using pyUSB)
Guild wars 2 thief stealth. The problem is I don't get desired output, will paste one example:
First I don't get filename, it's most important to me. I am assuming it is the /dev/ttyACM0 etc part. Second, I guess there was some UID of every USB device, or I should use both Vendor or Product id?
EDIT: Apparently I have some setup issues, I think I am using wrong USB Library. (using libusb0.1) ATM. That's why I get Device (dev.filename) string empty. If someone can please just tell that on what operating system he is using what USB Library and what version of PyUSB I think it will solve my problems.
Josh Crozier
163k3838 gold badges288288 silver badges231231 bronze badges
BlackDivineBlackDivine
1,61622 gold badges1818 silver badges2828 bronze badges
7 Answers
I can think of a quick code like this.
Since all USB ports can be accessed via /dev/bus/usb/< bus >/< device > Bluetooth usb adapter class 1 long range rifle scope reviews.
For the ID generated, even if you unplug the device and reattach it [ could be some other port ]. It will be the same.
Sample output here will be:
meson10meson10
If you are working on windows, you can use
pywin32 .
I found an example here:
joaquinjoaquin
58.2k2222 gold badges126126 silver badges140140 bronze badges
For linux, I wrote a script called find_port.py which you can find here:https://github.com/dhylands/usb-ser-mon/blob/master/usb_ser_mon/find_port.py
It uses pyudev to enumerate all tty devices, and can match on various attributes.
Use the --list option to show all of the know USB serial ports and their attributes. You can filter by VID, PID, serial number, or vendor name. Use --help to see the filtering options.
find_port.py prints the /dev/ttyXXX name rather than the /dev/usb/.. name.
Dave HylandsDave Hylands
wRARwRAR
21.4k33 gold badges7070 silver badges8989 bronze badges
For a system with legacy usb coming back and libusb-1.0, this approach will work to retrieve the various actual strings. I show the vendor and product as examples. It can cause some I/O, because it actually reads the info from the device (at least the first time, anyway.) Some devices don't provide this information, so the presumption that they do will throw an exception in that case; that's ok, so we pass.
fyngyrzfyngyrz
When I run your code, I get the following output for example.
Noteworthy are that a) I have
usb.Device objects whereas you have usb.legacy.Device objects, and b) I have device filenames.
Each
usb.Bus has a dirname field and each usb.Device has the filename. As you can see, the filename is something like 001 , and so is the dirname. You can combine these to get the bus file. For dirname=001 and filname=001 , it should be something like /dev/bus/usb/001/001.
You should first, though figure out what this 'usb.legacy' situation is. I'm running the latest version and I don't even have a
legacy sub-module.
Finally, you should use the
idVendor and idProduct fields to uniquely identify the device when it's plugged in.
Apr 29, 2019 CyberGhost VPN Premium Key Features. CyberGhost Premium VPN is a well-known name among Internet online users to protect their private, personal and financial data information. As we have described above CyberGhost VPN Premium 7 is the latest version of this application. Upgrade to Cyberghost VPN 6 activation key Premium Plus version in 2018 and unlock all websites for free. Many people depend on antivirus products to remain safe from viruses but they don’t know that cyberghost vpn premium activation code can safe them from any online threat. This can be achieved just by safe online browsing so you. CyberGhost VPN 6 Crack Premium. CyberGhost VPN 6 Crack Pro version is the best VPN for anonymization of your identity and provides the high protection to your data. This Virtual private network created by the SRL company which hosted in Romania. This program used for. Cyberghost 6 serial key crack pro version.
user626998
If you just need the name of the device here is a little hack which i wrote in bash. To run it in python you need the following snippet. Just replace $1 and $2 with Bus number and Device number eg 001 or 002.
Alternately you can save it as a bash script and run it from there too. Just save it as a bash script like foo.sh make it executable.
Then call it in python script as
Qasim Ayyaz KhanQasim Ayyaz Khan
How To Check When Usb Was Last Accessed BackNot the answer you're looking for? Browse other questions tagged pythonusblibusb or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |