Advertisement
iApplet

Manipulator (KRClient): 90aim

Dec 8th, 2011
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.15 KB | None | 0 0
  1. import javassist.ClassPool;
  2. import javassist.CtClass;
  3. import javassist.CtMethod;
  4.  
  5. /**
  6.  *
  7.  * @author Flav
  8.  */
  9. public class Manipulator {
  10.     public static void main(String[] args) {
  11.         ClassPool cp = ClassPool.getDefault();
  12.         cp.importPackage("java.applet.AppletContext");
  13.         cp.importPackage("java.net.URL");
  14.         cp.importPackage("java.util.Enumeration");
  15.         cp.importPackage("java.util.StringTokenizer");
  16.  
  17.         try {
  18.             CtClass groupChat = cp.get("bb");
  19.  
  20.             groupChat.addMethod(CtMethod.make(
  21.                 "public AppletContext getAppletContext() {"
  22.             +       "return new Context();"
  23.             +   "}"
  24.             , groupChat));
  25.  
  26.             groupChat.addMethod(CtMethod.make(
  27.                 "public URL getCodeBase() {"
  28.             +       "return new URL(Parameter.get(\"codebase\"));"
  29.             +   "}"
  30.             , groupChat));
  31.  
  32.             groupChat.getDeclaredMethod(
  33.                 "getDocumentBase"
  34.             ).setBody(
  35.                 "{"
  36.             +       "return new URL(Parameter.get(\"documentbase\"));"
  37.             +   "}"
  38.             );
  39.  
  40.             groupChat.getDeclaredMethod(
  41.                 "getParameter", new CtClass[] { cp.get("java.lang.String") }
  42.             ).setName("getParameterHook");
  43.             groupChat.addMethod(CtMethod.make(
  44.                 "public String getParameter(String param1) {"
  45.             +       "String param = Parameter.get($1);"
  46.             +       "return param != null ? param : getParameterHook($1);"
  47.             +   "}"
  48.             , groupChat));
  49.  
  50.             groupChat.addMethod(CtMethod.make(
  51.                 "public String getButler() {"
  52.             +       "return (String) bo.elementAt(0);"
  53.             +   "}"
  54.             , groupChat));
  55.  
  56.             groupChat.addMethod(CtMethod.make(
  57.                 "public String getNickname() {"
  58.             +       "return aa();"
  59.             +   "}"
  60.             , groupChat));
  61.  
  62.             groupChat.addMethod(CtMethod.make(
  63.                 "public String getChannel() {"
  64.             +       "return a8();"
  65.             +   "}"
  66.             , groupChat));
  67.  
  68.             groupChat.addMethod(CtMethod.make(
  69.                 "public Enumeration getChannels() {"
  70.             +       "return ag();"
  71.             +   "}"
  72.             , groupChat));
  73.  
  74.             groupChat.addMethod(CtMethod.make(
  75.                 "public void print(String param1, String param2) {"
  76.             +       "Oy frame = k($1);"
  77.  
  78.             +       "if (frame != null) {"
  79.             +           "cx panel = frame.a;"
  80.             +           "panel.l($2);"
  81.             +       "}"
  82.             +   "}"
  83.             , groupChat));
  84.  
  85.             groupChat.addMethod(CtMethod.make(
  86.                 "public void receive(String param1) {"
  87.             +       "if ($1.startsWith(\":\" + u)) {"
  88.             +           "a($1, (\":\" + u).length());"
  89.             +       "} else {"
  90.             +           "af(new StringTokenizer($1, u, $1.startsWith(\"k\" + u)));"
  91.             +       "}"
  92.             +   "}"
  93.             , groupChat));
  94.  
  95.             groupChat.addMethod(CtMethod.make(
  96.                 "public void send(String param1) {"
  97.             +       "a($1, false, 0);"
  98.             +   "}"
  99.             , groupChat));
  100.  
  101.             groupChat.getDeclaredMethod(
  102.                 "a", new CtClass[] { cp.get("java.lang.String"), cp.get("int") }
  103.             ).setName("parseModuleInput");
  104.             groupChat.addMethod(CtMethod.make(
  105.                 "private final void a(String param1, int param2) {"
  106.             +       "parseModuleInput($1, $2);"
  107.             +   "}"
  108.             , groupChat));
  109.  
  110.             groupChat.getDeclaredMethod(
  111.                 "af", new CtClass[] { cp.get("java.util.StringTokenizer") }
  112.             ).setName("parseInput");
  113.             groupChat.addMethod(CtMethod.make(
  114.                 "private final void af(StringTokenizer param1) {"
  115.             +       "String opcode = $1.nextToken();"
  116.             +       "StringBuilder buffer = new StringBuilder(opcode);"
  117.  
  118.             +       "while ($1.hasMoreTokens()) {"
  119.             +           "if (!opcode.equals(\"k\")) {"
  120.             +               "buffer.append(u);"
  121.             +           "}"
  122.  
  123.             +           "buffer.append($1.nextToken());"
  124.             +       "}"
  125.  
  126.             +       "String packet = buffer.toString();"
  127.             +       "parseInput(new StringTokenizer(packet, u, packet.startsWith(\"k\" + u)));"
  128.             +   "}"
  129.             , groupChat));
  130.  
  131.             groupChat.getDeclaredMethod(
  132.                 "a", new CtClass[] { cp.get("java.lang.String"), cp.get("boolean"), cp.get("int") }
  133.             ).setName("parseOutput");
  134.             groupChat.addMethod(CtMethod.make(
  135.                 "public synchronized boolean a(String param1, boolean param2, int param3) {"
  136.             +       "String[] tokens = $1.split(u);"
  137.  
  138.             +       "if (tokens[0].equals(\"e\")) {"
  139.             +           "String msg = tokens[2];"
  140.             +           "String cmd = msg.substring(1).split(\" \")[0].trim().toLowerCase();"
  141.             +           "String arg = \"\";"
  142.  
  143.             +           "if (msg.length() > cmd.length() + 1) {"
  144.             +               "arg = msg.substring(msg.indexOf(' ') + 1);"
  145.             +           "}"
  146.  
  147.             +           "if (cmd.equals(\"sample\")) {"
  148.             +               "print(getChannel(), \"Du hast soeben die Sample-Funktion benutzt.\");"
  149.             +               "return true;"
  150.             +           "}"
  151.             +       "}"
  152.  
  153.             +       "return parseOutput($1, $2, $3);"
  154.             +   "}"
  155.             , groupChat));
  156.  
  157.             groupChat.writeFile();
  158.         } catch (Exception e) {
  159.             e.printStackTrace();
  160.         }
  161.     }
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement