使用程序检查已安装的软件
我们需要创建一个程序..实际上我们被要求创建一个软件许可合规工具....我们如何检查机器内安装的软件.. 是通过注册表吗...在搜索时我看到一篇文章说我们需要研究 HKLM 的“卸载”子项。
另外,我们是否还可以获得有关软件是否是免费软件、共享软件、从注册表获得许可的信息???
我们计划使用 Python 和 Mysql 来完成此操作
We need to create a program ..actually we were asked to create a software licensing compliance tool....How do we check the installed software inside the machine..
Is it through the registry...while searching i saw a post which said we need to look into the "uninstall" subkey of HKLM .
Also do we also get information about whether the s/w is freeware ,shareware, licensed from the registry????
We plan to do this using Python and Mysql
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如您已经提到的,(正确)安装的程序列表可以在注册表中的键下找到,
请参阅此处 或使用 google 获取更多信息。使用
regedit
看看这个键,结构id非常明显。有关使用 python 访问注册表的信息,请参阅 python 标准库文档中的 _winreg – Windows 注册表访问 。
请注意,可能总会有一些软件没有出现在注册表中:有些软件仍然可以通过将其放入目录中来安装,你不会发现这些家伙......
对于第二部分,没有通过查看注册表来了解许可类型或许可状态(即正确许可)的方式。没有标准方法来存储此信息。您能做的最好的事情就是编制尽可能多的程序列表(您必须手动执行此操作,即使对于 Office、Adobe 等标准程序,这也会很耗时)并存储所有必要的信息(即注册表中的 GUID 密钥、许可证类型等)在数据库中。
然后,您的工具可以将当前安装的程序列表与您的列表进行比较,可能会检查许可状态。作为第一步,这将更加困难,因为每个软件都有自己的(大部分是秘密的!)存储信息的方式 - 毕竟,如果这些信息是可访问的,那么它也可以被伪造。
然后,您的工具可以通知系统管理员其发现以及任何不在列表中的程序,他必须手动检查它们的许可。您可以提供一些组织帮助来管理此信息,甚至可以更新数据库以供将来使用。
HTH
马丁·
As you already mentioned the list of (properly) installed programs can be found in the registry under the key
See here for example or use google for further information. Have a look at this key using
regedit
, the structure id quite obvious.For accessing the registry using python, see _winreg – Windows registry access in the python standard library documentation.
Note that there may always be software which doesnt show up in the registry: Some software can still be installed by just putting it in a directory, you'll not catch these guys...
For the second part, there is no way of telling the license type or licensing status (i.e. properly licensed) from looking at the registry. There is no standard way to store this information. The best you can do is to compile a list of as many programs as you can (you'll have to do this by hand, that will be time-consuming even for standard programs like Office, Adobe etc.) and store all necessary information (i.e. GUID key in registry, license type etc.) in a database.
Your tool could then compare the list of currently installed programs against your list, possibly checking the licensing status. This will be even harder as the first step since every software has it's own (mostly secret!) way of storing this - after all if this information is accessible it could also be forged.
Then your tool could inform the system adminstrator about its findings and any programs that are not on the list, he would have to check the licensing manually for them. You could provide some organisational help for managing this information and perhaps even update the database for future use.
HTH
Martin
您可以使用 AutoIt 一种强大的 Windows 脚本语言,它在 Windows 上具有非常好的且易于使用的 API。
You can use AutoIt a powerful scripting language for windows which has really good and simple to use API on Windows.