如何从 Java 小程序(浏览器内)提取数据

发布于 2024-11-27 18:32:46 字数 454 浏览 1 评论 0原文

好吧,好吧,我们开始...

我们有一个在常规浏览器(ff4+ 或 ie5+)上运行的 java 小程序。

我无法访问 java 代码/servlet。甚至也不到服务器。

我需要从此小程序发送/检索数据。这意味着我必须通过单击按钮并填写表单的文本框来模拟用户,并且还返回文本框中的数据(在服务器响应之后)。

因此可以使用的技术有C、VB、.NET(主要是webbrowser对象)、PHP(cUrl可用)、JavaScript、使用Fiddler嗅探浏览器/服务器通信。

我们确实需要这个。但如果那是不可能的,那么我们可能也必须知道。 这些数据归我公司所有,因此不构成任何版权。

另外,我对非传统解决方案持开放态度,例如将 html 保存为图像,然后使用某些 OCR 软件检索数据......

好吧,因此任何建议或指示将不胜感激。

谢谢

保罗·布埃诺。

Well, well, here we go...

We have a java applet running on a regular browser (ff4+ or ie5+).

I do NOT have access to the java code / servlet. Nor even to the server.

I NEED to send/retrieve data from this applet. This means i must emulate an user onto it by clicking buttons and filling form's textboxes and also return data (after server response) wich ll be inside textboxes.

So the technologies avaibles to be used are C, VB, .NET (webbrowser object mainly), PHP (cUrl avaible), JavaScript, Sniffing the browser/server communication using Fiddler.

We really need this. But if thats impossible so we may have to know also.
The data is owned by my company so no copyrigth is inflicted.

Also i'm open to non traditional solution such as saving the html as an image and then retrieve the data using some OCR software...

Well so any suggestion or pointing directions would be gratefully appreciated.

Thx

Paulo Bueno.

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

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

发布评论

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

评论(5

一页 2024-12-04 18:32:46

必须模拟用户浏览会带来问题,如果可行的话,我会建议替代路线。这些是我将采取的步骤:

  1. 从我的缓存中获取小程序类或 jar(任何访问页面/小程序的人都可以执行此操作)。
  2. 将代码反编译为 Java 源代码(使用 jad 或其他首选工具)
  3. 查看小程序与服务通信的过程
  4. 编写一个应用程序,将我的数据提交到小程序连接到的服务,并像小程序一样处理任何响应。

Having to emulate a user browsing is wrought with problems and i would suggest an alternate route, if its feasible. These are the steps I would take:

  1. Grab the applet class or jar from my cache (anyone accessing the page / applet can do this).
  2. Decompile the code into Java source (Using jad or other preferred tool)
  3. Review the process with which the applet communicates to the service
  4. Write an application to submit my data to the service that the applet connects to and handle any responses just as the applet would.
薔薇婲 2024-12-04 18:32:46

您可以使用 JRE 中附带的“appletviewer”在没有浏览器的情况下运行任何小程序。通过这种方式,可以通过 http://code.google.com 读取和发送虚假输入,但不切实际/p/windowlicker/ 控制 SWING GUI。

但在可以访问代码的常规浏览器环境中,您宁愿这样做:

在对象标记中使用“scriptable”和“mayscript”属性/元素。标准浏览器 JRE 包含一个“plugin.jar”,其中包含完成此工作所需的函数。这个接口让 Java-Applet 代码与 Javascript 进行反之亦然的通信,从中你可以做任何你想做的事情(即 ajax 请求)

这个主题相当复杂,所以看看 google 告诉我们的内容:

http://www.htmlcodetutorial.com/applets/_APPLET_MAYSCRIPT.html
http://www.raditha.com/java/javascript.php

使用此接口是真的很痛苦,所以我建议在你的小程序中实现 HTTPRequests 来告诉 PHP 服务器你想告诉它的任何信息。

问候,
迈克尔

You can run any applet without a browser using the "appletviewer" that is shipped in a JRE. This way it is possible but not practicable to read and send fake input with http://code.google.com/p/windowlicker/ to control the SWING GUI.

But within a regular browser environment with access to the code you would rather do this:

using the "scriptable" and "mayscript" attributes/elements in your object tag. standard browser JREs include a "plugin.jar" that contains the needed function to do this job. This interface lets Java-Applet code communicate vice versa to Javascript, from wich you can do whatever you want (i.e. ajax request)

this topic is rather complex, so check out what google tells us:

http://www.htmlcodetutorial.com/applets/_APPLET_MAYSCRIPT.html
http://www.raditha.com/java/javascript.php

Using this interface is a real pain, so i suggest to implement HTTPRequests within your applet to tell the PHP server whatever you want to tell it.

regards,
Michael

小…红帽 2024-12-04 18:32:46

我无权访问 java 代码/servlet。甚至也不至于
服务器。

嗯……这是很不寻常的情况。如果您有该小程序,当然,您应该有权访问其 src 文件进行修改:)

我需要从此小程序发送/检索数据。这意味着我必须
通过单击按钮并填写表单来模拟用户
文本框并返回数据(服务器响应后)
在文本框内。

无论如何,要“模拟”用户,您可以使用 Robot 对象但它仍然会要求你修改小程序代码以使其支持一些附加功能...据我记得,JS等无法从外部命令控制Java小程序,除非小程序确实包含JS支持的网页交互功能。但你还是说你。 无法访问该小程序 src,因此没有任何信息该小程序是否支持 netscape.javascript 以及它如何支持它,所以还不清楚...所以我必须问你吗有这个小程序的文档吗?

围绕问题文本并回到问题标题本身,上面写着

“如何从 Java 小程序(浏览器内)提取数据”

我可能会这么说
要从 Java Applet 中提取数据,您可以使用支持 Java Applet 和 JS 交互的 netscape lib 示例, 文档。在这种情况下这是最好的方法

祝你好运

I do NOT have access to the java code / servlet. Nor even to the
server.

Emm... It is quite unusual situation. If you have the applet, of course, you should have access to its src files to modify :)

I NEED to send/retrieve data from this applet. This means i must
emulate an user onto it by clicking buttons and filling form's
textboxes and also return data (after server response) wich ll be
inside textboxes.

Anyway, to "emulate" user you can use the Robot object but still it will demand you to modify the applet code to make it support some additional functionality... As I can remember, JS etc cannot control Java Applet from the outside commands unless the applet does contain JS supported functionality for web page interaction... But still you say you don't have any access to the applet src so there is no information does the applet support netscape.javascript or not and how it support it so it is quite unclear... So I must ask do you have any docs of this applet?

Comming around the question text and getting back to the question title itself which says

"How can I extract data from a Java applet (inside the browser)"

I may suppose to say that
To extract data from Java Applet you can use netscape lib which supports Java Applet and JS interaction example, docs. That is the most optimal way in this case

Good luck

冰葑 2024-12-04 18:32:46

反编译/更改/再次编译小程序可能不会太困难,除非它被混淆了。
我用的是杰德。
https://stackoverflow.com/questions/31353/is-jad-the-best- java反编译器

Might not be too difficult to de-compile/change/compile again the applet unless it is obfuscated.
I use JAD.
https://stackoverflow.com/questions/31353/is-jad-the-best-java-decompiler

坚持沉默 2024-12-04 18:32:46

如果您必须通过与 java 小程序交互来获取数据而不是对其进行逆向工程,请查看 FEST(Fixtures for简单的软件测试)。 FEST 旨在通过模拟用户交互来测试 Java Swing GUI,但您也可以轻松地使用它来自动化您的小程序。

查看测试小程序上的文档页面以开始使用。

If you must get your data by interacting with the java applet instead of reverse engineering it, check out FEST (Fixtures for Easy Software Testing). FEST is designed for testing Java Swing GUIs by simulating user interaction, but you can easily use it to automate your applet as well.

Check out the documentation page on testing applets to get started.

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