![Learning Python for Forensics](https://wfqqreader-1252317822.image.myqcloud.com/cover/923/36698923/b_36698923.jpg)
上QQ阅读APP看书,第一时间看更新
Running the script
We now have a script that takes a setupapi.dev.log file, as found on Windows 7, and outputs USB entries with their associated timestamps. The following screenshot shows how we can execute the script with a sample setupapi.dev.log file, which has been provided in the code bundle. Your output may vary depending on the setupapi.dev.log file you use the script on:
![](https://epubservercos.yuewen.com/F9A585/19470382208827306/epubprivate/OEBPS/Images/fd0d7ec0-c1ba-472c-b53b-cfb780f8fa95.png?sign=1739060704-aTylNQuPv8v4YhvkvsRHwSDLA2nv7THx-0-888bdb3dd5b8ba8d3e7cd4367732c431)
Since setupapi.dev.log has numerous entries, we have pulled out two additional snippets from our command's output that focus on USB and USBSTOR devices:
![](https://epubservercos.yuewen.com/F9A585/19470382208827306/epubprivate/OEBPS/Images/e0a7af39-e28b-49c8-9e83-af8c7cdd65cf.png?sign=1739060704-yFNqSuMQUyA3qO30QQBNZ8TWxA92UFpW-0-7aa7eddc21c7bd6c11bc497497c81dcb)
Our second snippet shows some details from the USBSTOR entries:
![](https://epubservercos.yuewen.com/F9A585/19470382208827306/epubprivate/OEBPS/Images/9f38a21a-037f-423c-b936-0f6172b92655.png?sign=1739060704-1nzN08y2bSprqSMnmEmXYLwkmdroW8hL-0-ba411966b5ebb0c0dfe0610366c563c0)
Our current iteration seems to generate some false positives by extracting responsive lines that do not pertain solely to USB devices; let's see how we can address that.