![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=1739348274-5QgYm3nBMQGX874T2blzfkJKoMDsqlUI-0-11e3e84ba68e549b584c9a1f704c883f)
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=1739348274-71NBoDvukxl4VAosGElLEg2f05h5ekAz-0-d0cfbe99b29b515fe3463dba56b12060)
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=1739348274-H5LAXc7vsKjUIe2DSy2Jz6sXEpHRxp4X-0-b727536643aeae6c25849c2ee72304cb)
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.