Hey guys, so I have a problem with hooking using reflection, the software I have was built so it can get methods from the applet. However I do not know how to grab instance variables.
This is the Class that Loads the applet and puts the main class into an interface called Client.
Client hook; public void a() { try { ClassThing b1 = new ClassThing(); byte abyte0[] = a("http://applet.com/appletlinkgoeshere", "Starting up"); if (abyte0 == null) throw new Exception("Client download failed"); b1.a = new ClientClassLoader(abyte0); Class class1 = b1.loadClass("sign.signlink"); class1.getField("mainapp").set(null, this); Class class2 = b1.loadClass("client"); reflectObject = class2.newInstance(); _fldfor = (Applet) reflectObject; _fldfor.init(); _fldfor.start(); setClient((Client) _fldfor); /*java.lang.reflect.Field[] fields = class2.getFields(); for (int i=0; i<fields.length;i++) { System.out.println(fields[i]); }*/ } catch (Exception exception) { String s = exception.getMessage(); if (s == null) s = "null"; a(s); exception.printStackTrace(); } } public void setClient(Client c) { hook = c; }
This is the client interface with all the methods from within the applet
package com.bsbot.hooks; import java.awt.*; public interface Client extends RSApplet { public String getUsername(); public String getPassword(); public Component getGameComponentHook(int a); public Npc[] getNpcs(); public int getBaseX(); public int getBaseY(); public Player getMyPlayer(); public int getPlayerId(); public int getTime(); public int[] getMaxStats(); public int[] getCurrentStats(); public int[] getExperience(); public boolean isLoggedIn(); public Player[] getPlayers(); public String getLoginMessage2(); public boolean isMenuOpen(); public String[] getMenuActionNames(); public int getMenuActionRow(); int getMenuOffsetX(); int getMenuOffsetY(); String[] getChatMessages(); int getMinimapInt1(); int getMinimapInt2(); int getMinimapInt3(); int getXCameraCurve(); int getYCameraCurve(); int getXCameraPos(); int getYCameraPos(); int getZCameraPos(); int getPlane(); public void setLoginIndex(int i); public int getLoginIndex(); int getOpenTab(); int[][][] getGroundIntArray(); byte[][][] getGroundByteArray(); GameInterface[][] getInterfaceCache(); public String getSelectedItemName(); public ItemDef getForId(int id); public ObjectDef getForIdObject(int id); int getMouseX(); int getMouseY(); public NodeList[][][] getGroundArray(); public WorldController getWorldController(); }
So my question is how can I get and use an instance variable that already exists in the applet? For example, in the applet there is: public String eN;
How can I get the value of eN to use in my reflection program?
Help is VERY appreciated, because I've spent some time banging my head against my desk.