Facebook
From ThePenitentOne, 3 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 42
  1. package ihc.pokutnik;
  2.  
  3. import com.sun.deploy.config.JREInfo;
  4. import com.sun.deploy.ref.DeployJRE;
  5. import com.sun.javaws.jnl.JREDesc;
  6. import com.sun.jna.platform.mac.SystemB;
  7. import com.sun.jna.platform.win32.COM.TypeInfoUtil;
  8. import com.sun.jna.platform.win32.WinBase;
  9. import com.sun.org.apache.xerces.internal.util.SecurityManager;
  10. import javafx.geometry.Side;
  11. import jdk.internal.util.xml.impl.Input;
  12. import jdk.nashorn.internal.scripts.JD;
  13. import org.apache.commons.collections.ArrayStack;
  14. import org.apache.commons.collections.Closure;
  15. import org.apache.commons.collections.comparators.ComparableComparator;
  16. import org.apache.log4j.Category;
  17. import org.apache.log4j.Level;
  18. import org.apache.log4j.Logger;
  19. import org.apache.log4j.Priority;
  20. import org.apache.log4j.spi.LoggingEvent;
  21. import sun.applet.AppletSecurity;
  22. import sun.plugin2.message.BestJREAvailableMessage;
  23. import sun.security.provider.Sun;
  24. import sun.tools.jar.resources.jar_sv;
  25.  
  26. import javax.jnlp.DownloadService2;
  27. import javax.print.ServiceUI;
  28. import javax.swing.*;
  29. import java.applet.Applet;
  30. import java.io.*;
  31. import java.lang.reflect.Method;
  32. import java.lang.reflect.Proxy;
  33. import java.net.HttpURLConnection;
  34. import java.net.URL;
  35. import java.nio.file.FileSystem;
  36. import java.nio.file.spi.FileSystemProvider;
  37. import java.security.Provider;
  38. import java.security.Security;
  39. import java.util.Base64;
  40. import java.util.Calendar;
  41.  
  42. class Main
  43. {
  44.    /* public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
  45.  
  46.         ByteArrayInputStream in = new ByteArrayInputStream(data);
  47.         ObjectInputStream is = new ObjectInputStream(in);
  48.         return is.readObject();
  49.  
  50.  
  51.     }*/
  52.   static Category cat = Category.getInstance("foo.bar");
  53.    int bla = 6;
  54.    boolean ii = true;
  55.  
  56.    public static class GuyInMirror implements Serializable{};
  57.  
  58.     public static class obiekcik implements Serializable {
  59.         private static final long serialVersionUID = 1L;
  60.         private int age = 23;
  61.         private Object iii = new LoggingEvent("uwu",cat, Level.ERROR,null,new Exception("string"));
  62.  
  63.         GuyInMirror GuyInMirror = new  GuyInMirror();
  64.         private Object aaa = new java.applet.Applet();
  65.         transient int height;
  66.  
  67.         public obiekcik() throws IOException {
  68.         }
  69.  
  70.         // getters and setters
  71.     }
  72.  
  73.  
  74.  
  75.  
  76.  
  77.     public static void main(String[] args) throws IOException, ClassNotFoundException {
  78.         URL url = new URL("http://54.177.240.164:28080/object");
  79.         String postData = "foo1=bar1&foo2=bar2";
  80.  
  81.         HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  82.         class Message implements Serializable{
  83.             private final String text;
  84.  
  85.  
  86.             public Message(String text) {
  87.                 this.text = text;
  88.  
  89.             }
  90.  
  91.  
  92.  
  93.  
  94.             public String getText() {
  95.                 return text;
  96.             }
  97.         }
  98.  
  99.  
  100.  
  101.         String decodedB64 = Base64.getDecoder().decode("ew0KCSJ1cmwiOiAibXlVcmwub3JnL3Byb2R1Y3RzIiwNCgkibnVtIjogMTI1OTY1NA0KfQ==").toString();
  102.  
  103.  
  104.        // System.out.println(decodedB64);
  105.  
  106.  
  107.  
  108.  
  109.        // Object decodedobject = SerializeUtils.deserialize(decodedB64);
  110.       //  System.out.println(decodedobject);
  111.  
  112.  
  113.         Calendar rightNow = Calendar.getInstance();
  114.         obiekcik obiekcik = new obiekcik();
  115.  
  116.         try {
  117.             conn.setRequestMethod("POST");
  118.             conn.setDoOutput(true);
  119.             conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
  120.             conn.setRequestProperty("Content-Length", Integer.toString(postData.length()));
  121.             conn.setUseCaches(false);
  122.  
  123.             try (ObjectOutputStream dos = new ObjectOutputStream(conn.getOutputStream())) {
  124.                 //dos.writeObject(new LoggingEvent("uwu",cat, Level.ERROR,null,new Exception("string")));
  125.                 dos.writeObject(obiekcik.aaa);
  126.             }
  127.  
  128.  
  129.             try (BufferedReader br = new BufferedReader(new InputStreamReader(
  130.                     conn.getInputStream()))) {
  131.                 String line;
  132.                 while ((line = br.readLine()) != null) {
  133.                     System.out.println(line);
  134.                 }
  135.             }
  136.  
  137.         } catch (Exception e) {
  138.             e.printStackTrace();
  139.             InputStream in = conn.getErrorStream();
  140.             int i = in.read();
  141.             while (i != -1) {
  142.                 System.out.print((char) i);
  143.                 i = in.read();
  144.         }
  145.     }
  146. }
  147.  
  148. }