Java JAR 文件是否有可能损坏您的系统?如何检查它正在做什么?
我想评估一个软件解决方案,其中多人提交了 JAR 文件以在 Windows 上执行任务。
除了它声称在您的计算机上执行的行为之外,是否可以检查 JAR 文件是否执行任何其他不需要的行为?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我想评估一个软件解决方案,其中多人提交了 JAR 文件以在 Windows 上执行任务。
除了它声称在您的计算机上执行的行为之外,是否可以检查 JAR 文件是否执行任何其他不需要的行为?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
首先,您可以使用 SecurityManager 设置的 JVM 来运行您的应用程序可以限制对敏感功能的访问。
您还可以设置一个“沙箱”,这样 jar 就不能拥有沙箱之外的权限...您可以在 linux/unix 环境中使用 chroot 或类似的工具。
First, you can use a JVM set with SecurityManager to do run your application in a way that it can have limited access to sensitive functions.
You can also set up a "sandbox" so the jar cannot have permissions outside of the sandbox... you could use chroot or a similar tool in a linux/unix environment.
1.您可以使用 Sysinternals 的软件:
http://technet.microsoft.com/en-us/sysinternals/bb842062
您可以使用 HardMon 查看程序正在写入或删除硬盘中的某些内容,或者使用 RegMon 监视任何更改...查看他们的网站,他们有很多程序,您几乎可以监视所有内容!
2. 或者您可以安装 Sandboxie:
http://www.sandboxie.com/
然后在沙箱(“虚拟文件系统”)中运行您的程序。当您在沙箱内运行程序时,您可以看到该程序创建了哪些文件,而且最好的是,该程序所做的任何更改都会在其存在时被撤消,因此它不会损害您的系统。 :)
3. 另外,您可以尝试反编译 JAR 文件:
http://www.google.hr/search ?sourceid=chrome&ie=UTF-8&q=java+反编译器
1. You could use software from Sysinternals:
http://technet.microsoft.com/en-us/sysinternals/bb842062
You can see is program's writing or deleting something from hard drive with HardMon, or monitor any changes with RegMon... Check out their website, they have much programs and you can monitor practically everything!
2. Or you could install Sandboxie:
http://www.sandboxie.com/
and then run you program within sandbox ("virtual filesystem"). When you run a program inside of sandbox, you can see what files did the program make, and the best thing is that any changes that the program did will be undone when it exists, so it can't harm your system. :)
3. Also, you could try to decompile JAR file:
http://www.google.hr/search?sourceid=chrome&ie=UTF-8&q=java+decompiler
是和否。默认情况下,java 程序可以执行系统上任何本机程序可以执行的操作。这包括删除和替换它可以访问的任何文件,具体取决于您的操作系统和用户权限,这可能会影响系统关键文件。
可以限制 java应用程序可以做什么,小程序Webstart 程序通常通过这种方式得到保护。或者,您可以以不同/受限用户身份或在沙箱中运行任何程序,以限制其可能造成的损害。
如果您不信任该库/程序,请始终在上述受限环境之一中运行它。如果它做了不该做的事情,它可能会崩溃,但不会造成任何损害。
Yes and No. By default java programs can do the same things any native program on your system can do. This includes deleting and replacing any file it can access, depending on your operating system and your user privileges this may affect system critical files.
It is possible to restrict what java applications can do, applets and webstart programs usually are secured this way. Alternatively you can run any program as a different/restricted user or in a sandbox to limit the damage it can do.
If you do not trust the library/program always run it in one of the restricted environments mentioned above. It may crash if it does something it should not do, but it will be unable to do any damage.
我尝试了 来自 jensign.com 的解决方案,它看起来几乎限制了所有内容。我用来测试的 .jar 应用程序甚至无法下载网站。不过我不是这方面的专家,所以我无法判断这是否是 100% 安全的解决方案。
引用自 jensign.com
I tried the solution from jensign.com and it looks like it restricts almost everything. The .jar application that I used to test wasn't even able to download a website. However I'm not an expert at this stuff so I can't tell if it is a 100% safe solution.
cite from jensign.com
尝试使用反编译器,例如 Java Decompiler:
http://jd.benow.ca/
它反编译 .jar 文件,并向您显示源代码,但请记住它可能受版权保护:
顺便说一句,你为什么不要求他们也提交源代码,而不仅仅是提交.jar 文件?
基本上,.jar 文件就像增强版的 zip 文件,我相信即使 WinRAR 也可以打开 .jar 文件。摘自他们网站的一段话:
用WinRAR解压后,可以按照此链接作为京东的替代方法。
Try a decompiler, like Java Decompiler:
http://jd.benow.ca/
It decompiles the .jar file, and shows you the source, though keep in mind it might be copyrighted:
By the way, why don't you ask for them to submit the source code as well, instead of just the .jar files?
Basically, .jar files are like souped-up zip files, and I believe even WinRAR can open .jar files. A quote from their site:
After extracting with WinRAR, you can view the source by following this link as an alternate method to JD.