简体   繁体   English

HTML Applet标签,可通过Chrome开发者工具进行访问

[英]Html applet tag, accessing through chrome developer tools

i happen to receive a Html with an applet tag, is there a way to access the class received through chrome developer tools, i cant see it in the scripts. 我碰巧收到带有applet标签的HTML,有没有办法访问通过chrome开发人员工具收到的类,我在脚本中看不到它。 If there isnt how can i access it? 如果没有,我该如何访问?

<applet name="tradesapp" id="tradesapp" code="loader3.SunLoaderApplet.class" archive="loader_20110113.jar" codebase="http://ih.advfn.com/" width="1100" height="2000" mayscript="" alt="This browser either has java disabled or does not support it" title="Java"><param name="manifestcrc" value="1211857157"><param name="storagepath" value="ih.advfn.com"><param name="masterloader" value="master"><param name="initial_focus" value="false"><param name="cache_archive" value="loader_20110113.jar"><param name="cache_version" value="1.0.7.7"><param name="java_arguments" value="-Dsun.java2d.d3d=false"><param name="advfn_url" value="http://ih.advfn.com/"><param name="streamer" value="stream-9.advfn.com"><param name="user" value="ih_340884"><param name="root" value="advfnclient.framework.BaseControl"><param name="page" value="advfnclient.TradesContainer"><param name="tz" value="US/Eastern"><param name="clearAllDateStamp" value="1272534624504"><param name="clearCacheDateStamp" value="1272534624504"><param name="language" value="us"><param name="view" value="ih"><param name="config_name" value="trades"><param name="config_default" value="Default"><param name="params" value="w=1100&amp;h=2000&amp;symbol=N%5EMSFT&amp;montage=true&amp;sources=afx:ukreg:rssnon&amp;dims=664 79 15 0&amp;col_widths=45 55 344 90 115&amp;sid=1f58fa6b4ea88725c5b8e23d614a6e80&amp;page_key=1338581393&amp;w=1100&amp;h=2000&amp;pid=applet_embed&amp;mypid=trades"><center><iframe width="600" height="300" src="/p.php?pid=javadisabled"></iframe></center></applet>

Chrome doesn't include a Java debugger and an applet isn't a script. Chrome浏览器不包含Java调试器,小应用程序也不是脚本。

You can access it via document.getElementById('tradesapp'); 您可以通过document.getElementById('tradesapp');访问它document.getElementById('tradesapp'); in the JS console. 在JS控制台中。 If you want to do anything with it, then the applet will have to explicitly expose methods to JavaScript . 如果您想对其进行任何操作,则该applet必须将方法显式公开给JavaScript

I suspect this is not your Java project, so I can't imagine Quentin's advice will help you. 我怀疑这不是您的Java项目,所以我无法想象Quentin的建议会为您提供帮助。 It sounds to me like you want to run the Java Applet yourself, perhaps making changes and having access to a debugger. 在我看来,您想要自己运行Java Applet,也许进行更改并可以访问调试器。 I decided to see what I could do as I've never had experience with this kind of stuff before. 我决定看看自己能做些什么,因为我以前从未对这种东西有经验。

First of all, you can download the .jar file in the archive property. 首先,您可以在存档属性中下载.jar文件。 In your case it looks to be located at http://ih.advfn.com/loader_20110113.jar 就您而言,它似乎位于http://ih.advfn.com/loader_20110113.jar

You can then use Java Decomipler to decompile the .jar file. 然后,您可以使用Java Decomipler来反编译.jar文件。 If you do so, you'll see that this jar file acts as a loader, and pulls more java classes from advfn.com. 如果这样做,您将看到此jar文件充当加载程序,并从advfn.com中提取更多的Java类。 It saves them in the location given by: 它将它们保存在以下位置:

String path = System.getProperty("user.home");

On windows this is C:\\<USER>\\advfn 在Windows上,这是C:\\ <USER> \\ advfn

You can decompile these classes as well if you're interested. 如果您有兴趣,也可以反编译这些类。 You'll be left with an approximation of the original source code. 您将获得原始源代码的近似值。 In this case, a fairly good one. 在这种情况下,相当不错。

If want you go one step further and decide to build the project yourself, you can import the classes into Eclipse. 如果您想更进一步并决定自己构建项目,则可以将类导入Eclipse。 You'll notice there are some strange errors such as the following: 您会注意到其中存在一些奇怪的错误,例如:

LoadFile(String paramLong, long arg3)
{
    this.name = paramLong;
    Object localObject;
    this.size = localObject;
}

I've never built a decompiler myself and am not at all familiar with Java bytecode, but if I had to guess, I'd imagine that the decompiler was trying to represent a local instance of the argument that was passed in to it. 我自己从来没有构建过反编译器,也不熟悉Java字节码,但是如果我不得不猜测,我会认为反编译器正在尝试表示传递给它的参数的本地实例。

The fix is fairly obvious once you know this.size is of type Long . 一旦知道this.sizeLong类型,修复this.size明显了。

LoadFile(String paramLong, long arg3)
{
    this.name = paramLong;
    this.size = arg3;
}

If you continue to make these changes, your code will compile successfully. 如果您继续进行这些更改,您的代码将成功编译。 But it still won't run as you're missing parameters set in the HTML. 但是它仍然无法运行,因为您缺少HTML中设置的参数。 A sample line in LoaderApplet.java is as follows: LoaderApplet.java中的示例行如下:

this.manifestCRC = Long.parseLong(getParameter("manifestcrc"));

If you return to the HTML page you found this at, you'll find a variety of parameters are specified there. 如果返回到在此找到的HTML页面,则会发现在其中指定了各种参数。 You should be able to go through your project and replace requests for parameters with their appropriate values. 您应该能够遍历项目,并用适当的值替换对参数的请求。

This was my first experience decompiling Java, so I might have missed a few details. 这是我第一次反编译Java经验,所以我可能错过了一些细节。 Let me know if you need more help. 让我知道您是否需要更多帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM