是否可以使用小程序获取正在运行的进程列表?
我想使用在浏览器中运行的 java 小程序获取正在运行的进程列表。我的理解是,只要小程序签名了,就能够得到这些信息。这准确吗?对于未签名的小程序来说这可能吗?最后,有没有可用的 FOS 小程序可供我查看?
谢谢。
I'd like to get the list of running processes using a java applet running in a browser. My understanding is that, as long as the applet is signed, it will be able to get this information. Is this accurate? Is this possible with an unsigned applet? Finally, are there any FOS applets available that I could take a look at?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当小程序想要访问/执行本地系统资源时,需要进行签名。这包括执行
Runtime#exec()
或ProcessBuilder
需要它才能获取正在运行的进程列表。您可以在此处找到如何在 Windows 中获取该列表的基本示例。我建议在继续之前检查
if (System.getProperty("os.name").startsWith("win"))
。将给定的示例移植到小程序中并不难,只需让类扩展
JApplet
并从AccessController#doPrivileged()
。至于对小程序进行签名,您可以手动签名 ,最终用户只会面临安全警告,并确认是否执行它,或者您可以让它由第三方公司签署一些 $$$,例如 VeriSign,这样最终用户就不会面临安全警告。不签名会导致小程序根本无法运行。
An applet needs to be signed whenever it want to access/execute local system resources. This includes executing
Runtime#exec()
orProcessBuilder
which is required to be able to get a list of running processes.You can find here a basic example how to get that list in Windows. I'd suggest to check
if (System.getProperty("os.name").startsWith("win"))
before continuing with that.Porting the given example into an applet isn't that hard, just let the class extend
JApplet
and execute the whole code from insideAccessController#doPrivileged()
.As to signing the applet, you can either sign it manually, the enduser would only face a security warning with a confirmation whether to execute it or not, or you can let it sign by a 3rd party company for some $$$, e.g. VeriSign, this way the enduser won't face the security warning. Not signing it will cause the applet not be able to run at all.
您必须执行特定于操作系统的命令(通过
Runtime.getRuntime().exec
),例如用于 Windows 的tasklist.exe
和ps
对于类 Unix 系统。至于安全措施,我很确定这在标准“沙箱”中是不可能的,但“特权”小程序可以做到。
You'll have to execute OS-specific commands (through
Runtime.getRuntime().exec
), liketasklist.exe
for windows andps
for unix-like systems.As for security measures, I'm pretty sure it's impossible in standard 'sandbox', but 'privileged' applet can do it.