Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javassist.ClassPool;
- import javassist.CtClass;
- import javassist.CtMethod;
- /**
- *
- * @author Flav
- */
- public class Manipulator {
- public static void main(String[] args) {
- ClassPool cp = ClassPool.getDefault();
- cp.importPackage("java.applet.AppletContext");
- cp.importPackage("java.net.URL");
- cp.importPackage("java.util.Enumeration");
- cp.importPackage("java.util.StringTokenizer");
- try {
- CtClass groupChat = cp.get("xq");
- groupChat.addMethod(CtMethod.make(
- "public AppletContext getAppletContext() {"
- + "return new Context();"
- + "}"
- , groupChat));
- groupChat.addMethod(CtMethod.make(
- "public URL getCodeBase() {"
- + "return new URL(Parameter.get(\"codebase\"));"
- + "}"
- , groupChat));
- groupChat.getDeclaredMethod(
- "getDocumentBase"
- ).setBody(
- "{"
- + "return new URL(Parameter.get(\"documentbase\"));"
- + "}"
- );
- groupChat.getDeclaredMethod(
- "getParameter", new CtClass[] { cp.get("java.lang.String") }
- ).setName("getParameterHook");
- groupChat.addMethod(CtMethod.make(
- "public String getParameter(String param1) {"
- + "String param = Parameter.get($1);"
- + "return param != null ? param : getParameterHook($1);"
- + "}"
- , groupChat));
- groupChat.addMethod(CtMethod.make(
- "public String getButler() {"
- + "return (String) bp.elementAt(0);"
- + "}"
- , groupChat));
- groupChat.addMethod(CtMethod.make(
- "public String getNickname() {"
- + "return aa();"
- + "}"
- , groupChat));
- groupChat.addMethod(CtMethod.make(
- "public String getChannel() {"
- + "return a9();"
- + "}"
- , groupChat));
- groupChat.addMethod(CtMethod.make(
- "public Enumeration getChannels() {"
- + "return ag();"
- + "}"
- , groupChat));
- groupChat.addMethod(CtMethod.make(
- "public void print(String param1, String param2) {"
- + "kx frame = k($1);"
- + "if (frame != null) {"
- + "SJ panel = frame.a;"
- + "panel.l($2);"
- + "}"
- + "}"
- , groupChat));
- groupChat.addMethod(CtMethod.make(
- "public void receive(String param1) {"
- + "if ($1.startsWith(\":\" + u)) {"
- + "a($1, (\":\" + u).length());"
- + "} else {"
- + "af(new StringTokenizer($1, u, $1.startsWith(\"k\" + u)));"
- + "}"
- + "}"
- , groupChat));
- groupChat.addMethod(CtMethod.make(
- "public void send(String param1) {"
- + "a($1, false, 0);"
- + "}"
- , groupChat));
- groupChat.getDeclaredMethod(
- "a", new CtClass[] { cp.get("java.lang.String"), cp.get("int") }
- ).setName("parseModuleInput");
- groupChat.addMethod(CtMethod.make(
- "private final void a(String param1, int param2) {"
- + "parseModuleInput($1, $2);"
- + "}"
- , groupChat));
- groupChat.getDeclaredMethod(
- "af", new CtClass[] { cp.get("java.util.StringTokenizer") }
- ).setName("parseInput");
- groupChat.addMethod(CtMethod.make(
- "private final void af(StringTokenizer param1) {"
- + "String opcode = $1.nextToken();"
- + "StringBuilder buffer = new StringBuilder(opcode);"
- + "while ($1.hasMoreTokens()) {"
- + "if (!opcode.equals(\"k\")) {"
- + "buffer.append(u);"
- + "}"
- + "buffer.append($1.nextToken());"
- + "}"
- + "String packet = buffer.toString();"
- + "parseInput(new StringTokenizer(packet, u, packet.startsWith(\"k\" + u)));"
- + "}"
- , groupChat));
- groupChat.getDeclaredMethod(
- "a", new CtClass[] { cp.get("java.lang.String"), cp.get("boolean"), cp.get("int") }
- ).setName("parseOutput");
- groupChat.addMethod(CtMethod.make(
- "public synchronized boolean a(String param1, boolean param2, int param3) {"
- + "String[] tokens = $1.split(u);"
- + "if (tokens[0].equals(\"e\")) {"
- + "String msg = tokens[2];"
- + "String cmd = msg.substring(1).split(\" \")[0].trim().toLowerCase();"
- + "String arg = \"\";"
- + "if (msg.length() > cmd.length() + 1) {"
- + "arg = msg.substring(msg.indexOf(' ') + 1);"
- + "}"
- + "if (cmd.equals(\"sample\")) {"
- + "print(getChannel(), \"Du hast soeben die Sample-Funktion benutzt.\");"
- + "return true;"
- + "}"
- + "}"
- + "return parseOutput($1, $2, $3);"
- + "}"
- , groupChat));
- groupChat.writeFile();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement