decompile applet and proxify all URL and socket connection and recompile
Hi,
Please anybody have idea for the below.
I need to decomple the applet class file to .java file and need to change all URL and Socket connection to proxify all connections from applet. and recompile the sample applet to make ready to load in browser.
Thi is to load the applet form the web server through one proxy server. In the proxy server side While loading the applet from web server that applet code need to be changed to modify the URL and connections used in that applet to change the further connection from applet through proxyserver.
Compile and decompile is not a problem that i can use javac and javap respectively.
But I want to know how to change all URL and connection in applet. is there any easy way to handle this with out changing the applet code.
can Anybody help me.
Thanks and Regards,
Shiban.
[875 byte] By [
shiban_ka] at [2007-10-1 11:21:12]

hi
Thanks for your kind reply,
That applet which is to be changed to proxify is not my applet. That may anyother applet.
Actually From my system I can connect only to the proxy server using HTTPS (privet net)protocol and secure proxy server make ordinary HTTP connection to public net to get the page and it revert back to the client using the same HTTPS.
Client <-[HTTPS]--> Secure Gateway <[HTTP]->Web servers
. I am accessing one webpage through my secure proxy server(HTTPS). Now it is loaded to client and if any connection made inside the applet to some other system is not connectable since client can only connect to secure gateway only. So the needed thing is while downloading the applet through secure gateway I want to capture the applet class file and decompile the file and change the applet code to change all URL and Socket connection code to point the secure Gateway and compile the applet to send back to client. Now all connection request from applet will to secure Gateway.
If you have any shortcut idea to implement this please let me know.
Thanks and Regards,
Shiban.
Not sure how you do that:
Client <-[HTTPS]--> Secure Gateway <[HTTP]->Web servers
or
Internet Explorer/Mozilla <-[HTTPS]--> proxy <[HTTP]-> Google
Is the above correct?
If so than what are the proxy settings in IE/Moz, I can specify the proxy address in the
browsers but not the proxy type (SSL).
When you want to visit a page like google I gues you just type http://www.google.com in
the browsers address bar. The browser will figure out how to connect to the proxy.
Java has got the control panel in the general tabl there is a button "network settings...:"
I have it to "use browser settings" and this works for me.
All URL and URLConnections work but the sockets don't (maybe put in a bug report)
for example games.yahoo.com -> card games -> bridge -> create table
In the trace I can see:
[code]
network: Connecting http://yog70.games.scd.yahoo.com/yog/y/b/us-t1.ldict with proxy=HTTP @ myproxy/00.00.00.00:80
network: Connecting socket://yog70.games.scd.yahoo.com:11999 with proxy=DIRECT
The second one fails because port 11999 is not open (what idiot uses an unassigned
port for a profesional site is beyond me).
http://www.iana.org/assignments/port-numbers
#11968-11999 Unassiged
Even if the port was open on the proxy you'll notice with proxy=DIRECT that
"use browser settings" does not work with socket (bug report?).
Anyway my advice is to open the java console (windows control panel or javacpl.exe in
the bin dir of java.home) and make sure it is set to "use browser settings"
Then enable a full trace:
To turn the full trace on (windows) you can start the java console, to be found here:
C:\Program Files\Java\j2re1.4...\bin\jpicpl32.exe
In the advanced tab you can fill in something for runtime parameters fill in this:
-Djavaplugin.trace=true -Djavaplugin.trace.option=basic|net|security|ext|liveconnect
if you cannot start the java console check here:
C:\Documents and Settings\userName\Application Data\Sun\Java\Deployment\deployment.properties
I think for linux this is somewhere in youruserdir/java (hidden directory)
add or change the following line:
javaplugin.jre.params=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
for 1.5:
deployment.javapi.jre.1.5.0.args=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
The trace is here:
C:\Documents and Settings\your user\Application Data\Sun\Java\Deployment\log\plugin...log
I think for linux this is somewhere in youruserdir/java (hidden directory)
Print out the full trace of the exception:
try{...}catch(Exception e){e.printStackTrace();}
Then visit the games.yahoo and try to create a new table playing bridge.
Inspect the trace and see if it works/why it doesn't work.
First part of my post is gone I see.
In the first part I put in:
I have no problems using proxy allthough I don't use SSL from the client to the proxy.
How do you specify this in your browser?
I guess you specify the proxy address and port in the browser settings then when you
want to visit http://www.google.com you just type that in the address bar and the browser
will fugure out what proxy to use according to the settings.
I have "use browser settings" in my "java control panel" -> general -> "network settings"
and the jre has no problems finding, athenticating and using the proxy.
For example games.yahoo.com -> card games -> bridge gives me the following in the
trace:
........ --> my pref post