Java JAR 文件是否有可能损坏您的系统?如何检查它正在做什么?

发布于 2024-10-14 03:58:51 字数 108 浏览 8 评论 0 原文

我想评估一个软件解决方案,其中多人提交了 JAR 文件以在 Windows 上执行任务。

除了它声称在您的计算机上执行的行为之外,是否可以检查 JAR 文件是否执行任何其他不需要的行为?

I want to evaluate a software solution where multiple people have submitted JAR files to perform a task on Windows.

Is it possible to check whether the JAR file performs any additional unwanted behaviors besides those it claims to perform on your machine?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

╰◇生如夏花灿烂 2024-10-21 03:58:51

首先,您可以使用 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.

物价感观 2024-10-21 03:58:51

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

离鸿 2024-10-21 03:58:51

是和否。默认情况下,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.

撧情箌佬 2024-10-21 03:58:51

我尝试了 来自 jensign.com 的解决方案,它看起来几乎限制了所有内容。我用来测试的 .jar 应用程序甚至无法下载网站。不过我不是这方面的专家,所以我无法判断这是否是 100% 安全的解决方案。

JAR 应用程序可以在完全限制性的沙箱条件下启动(与 Java applet 默认安全沙箱非常相似):

<预><代码> java -jar -Djava.security.manager PropsFrame.jar

引用自 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.

The JAR'd application can be launched under fully restrictive sandbox conditions (very similar to Java applet default security sandboxing):

     java -jar -Djava.security.manager PropsFrame.jar

cite from jensign.com

节枝 2024-10-21 03:58:51

尝试使用反编译器,例如 Java Decompiler:
http://jd.benow.ca/

它反编译 .jar 文件,并向您显示源代码,但请记住它可能受版权保护:
alt text

顺便说一句,你为什么不要求他们也提交源代码,而不仅仅是提交.jar 文件?

基本上,.jar 文件就像增强版的 zip 文件,我相信即使 WinRAR 也可以打开 .jar 文件。摘自他们网站的一段话:

Java 存档文件(压缩文件
对于小程序和相关文件)(.JAR)

Java Archive 的缩写,一种文件格式
用于捆绑所需的所有组件
通过 Java 小程序。 JAR 文件简化
自所有以来,小程序的下载
组件(.class 文件、图像、
声音等)可以打包成
单个文件。另外,JAR
支持数据压缩,
进一步减少下载时间。

JAR 文件支持与 ZIP 相同
文件支持。 JAR = ZIP + 清单。
Microsoft VM支持未压缩
以及压缩 JAR 级别 0 和 1,但是
未签署 JAR。

WinRAR 提供了基本操作
其他工具创建的JAR文件:查看
内容、提取文件、显示评论
和存档信息。

您可以使用转换函数
将 .jar 文件转换为 .rar 格式。

您不需要任何外部
处理这些格式的程序。

用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:
alt text

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:

Java Archive File (a compressed file
for applets and related files) (.JAR)

Short for Java Archive, a file format
used to bundle all components required
by a Java applet. JAR files simplify
the downloading of applets since all
the components (.class files, images,
sounds, etc.) can be packaged into a
single file. Additionally, JAR
supports data compression, which
further decreases download times.

JAR file support is the same as ZIP
file support. JAR = ZIP + manifest.
The Microsoft VM supports uncompressed
and compressed JAR levels 0 and 1, but
not signed JAR.

WinRAR provides basic operations for
JAR files created by other tools: view
contents, extract files, show comments
and archive information.

You can use the convert function to
convert .jar files into .rar format.

You do not need to have any external
programs to handle these formats.

After extracting with WinRAR, you can view the source by following this link as an alternate method to JD.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文