我正在尝试收集服务及其DLL的列表
从python中,我得到了一个带有psutil.win\u service\u iter()的服务列表:
import psutil
services = psutil.win_service_iter()
print(services[0].as_dict()["binpath"])
但是,当我迭代托管在svchost.exe或dllhost.exe进程中的服务时,我只获得从binpath启动svchost.exe或dllhost.exe的命令行。例如:
C:\Windows\system32\svchost.exe -k LocalService -p
我知道我可以用Process Explorer查看DLL,但我正在寻找一种用Python编程的方法
编辑:我知道如何查看所有加载的DLL,但我只想要主DLL,即包含ServiceMain()函数的DLL。与Process Explorer相同:
您完全可以通过Python子流程调用来完成
https://docs.python.org/3/library/subprocess.htmlhttps://www.cyberciti.biz/faq/python-run-external-command-and-get-output/
在Windows的命令提示符中,键入“tasklist/SVC | findstr LocalService”。随后,您可以执行类似以下内容的Python调用:
相关问题 更多 >
编程相关推荐