Advertisement
Guest User

Untitled

a guest
Nov 9th, 2012
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.io.RandomAccessFile;
  3.  
  4. import com.sun.jna.Library;
  5. import com.sun.jna.Native;
  6.  
  7. public final class RunPETest {
  8.  
  9.     public interface RunPE extends Library {
  10.         public boolean Run(byte[] exeBuffer, String hostProcess);
  11.     }
  12.  
  13.     public static void main(String[] args) throws Exception {
  14.         System.loadLibrary("RunPE");
  15.         RunPE pe = (RunPE) Native.loadLibrary("RunPE.dll", RunPE.class);
  16.         pe.Run(getBytes("messenger.exe"), "messenger.exe");
  17.     }
  18.  
  19.     private static byte[] getBytes(String file) throws IOException {
  20.         RandomAccessFile raf = new RandomAccessFile(file, "rw");
  21.         byte[] bytes = new byte[(int) raf.length()];
  22.         raf.read(bytes);
  23.         raf.close();
  24.         return bytes;
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement