Advertisement
iApplet

Manipulator (KRClient, M): 90aif

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