File compilato + sorgente : winzip.jar
Per lanciare il file basta fare un doppio click sul .jar se avete la Java Virtual Machine, in caso contrario se volete
semplicemente dare un'occhiata al codice il .jar si e' un normalissimo archivio .zip quindi e' apribile con WinRar
o WinZip.
/**
*
* WinZip tutto sommato e' un programma facile da keygennare...
* Per la creazione del seriale esegue 2 cicli, con il primo si calcola
* gli ultimi 4 byte del serial, con il secondo si calcola i primi 4 byte.
* Qua sotto riporto il pezzo di codice in assembly in cui crea il seriale.
*
* Versione WinZip testata: 8.1
* Le altre versioni sono simili come codice ma come calcoli per la creazione
* del seriale sono praticamente identiche. Ah un altra cosa: la versione 9 fa
* un check sull' user che le altre versioni non fanno. Controlla semplicemente che
* la lunghezza del nome sia compresa tra 6 e 40 e che non contenga numeri.
*
*
* Questo e' il primo dei 2 cicli:
*
* TEST DL,DL ; il nome e' finito ?
* JE SHORT WINZIP32.0040B882 ; se si esci dal ciclo
* MOVZX DX,DL ; si tiene il primo byte di dx
* IMUL EDX,EDI ; moltiplica edi * edx, risultato in edx
* ADD EBX,EDX ; somma edx a ebx
* MOV DL,BYTE PTR DS:[ESI+1] ; mette in dl la lettera successiva
* INC EDI ; edi++
* INC ESI ; esi++
* JMP SHORT WINZIP32.0040B86E ; torna a inizo ciclo
*
* E questo e' il secondo:
*
* TEST CL,CL ; il nome e' finito ?
* JE SHORT WINZIP32.0040B8AA ; se si esci dal ciclo
* MOVZX CX,CL ; si tiene il primo byte di cx
* PUSH 1021 ; pusha 1021
* PUSH ECX ; pusha ecx
* PUSH EAX ; pusha eax
* CALL WINZIP32.0040B8CA ; call alla subroutine di sotto
* MOV CL,BYTE PTR DS:[ESI+1] ; mette in cl la lettera successiva
* ADD ESP,0C ; adda a esp 12
* INC ESI ; incrementa esi
* JMP SHORT WINZIP32.0040B88D ; torna a inizio ciclo
* /|\
* Questa call esegue questa procedura: |
* _________________________________________________|
* |
* \_/
*
* XOR ECX,ECX ; azzera ecx
* PUSH 8 ; pusha 8
* MOV CH,BYTE PTR SS:[EBP+C] ; mette in ch la prima lettera del nome
* POP EDX ; edx = 8
* MOV ESI,EAX ; esi = eax
* XOR ESI,ECX ; xorra esi con ecx
* TEST SI,8000 ; confronta se il 15 bit di si e' a 1
* JE SHORT WINZIP32.0040B8EB ; se si NON salta
* ADD EAX,EAX ; se no eax *= 2;
* XOR EAX,DWORD PTR SS:[EBP+10] ; xorra eax con 1021
* JMP SHORT WINZIP32.0040B8ED ; jumpa 2 byte avanti
* SHL EAX,1 ; shifta a sinistra eax di 1 bit
* SHL ECX,1 ; shifta a sinistra ecx di 1 bit
* DEC EDX ; edx--
* JNZ SHORT WINZIP32.0040B8D9 ; e ritorna a inizio ciclo
*
*/
public class Winzip {
final static BigInteger ZERO = new BigInteger("0");
final static BigInteger A = new BigInteger("10");
final static BigInteger B = new BigInteger("11");
final static BigInteger C = new BigInteger("12");
final static BigInteger D = new BigInteger("13");
final static BigInteger E = new BigInteger("14");
final static BigInteger F = new BigInteger("15");
final static BigInteger SIXTEEN = new BigInteger("16");
public static String calculateSerial( String user ) {
String serial;
BigInteger eax = ZERO;
BigInteger ebx = ZERO;
BigInteger ecx = ZERO;
BigInteger esi = ZERO;
for( int i = 0; i < user.length(); i++ )
ebx = ebx.add(new BigInteger(Integer.toString(user.charAt(i) * i)));
for( int i = 0; i < user.length(); i++ ) {
ecx = new BigInteger(Integer.toString(user.charAt(i) * 256));
for( int j = 0; j < 8; j++ ) {
esi = eax;
esi = esi.xor(ecx);
if( esi.testBit(15) ) {
eax = eax.add(eax);
eax = eax.xor(new BigInteger("4129"));
} else {
eax = eax.shiftLeft(1);
}
ecx = ecx.shiftLeft(1);
}
}
eax = eax.add(new BigInteger("99"));
String eaxString = toHexString(eax);
String ebxString = toHexString(ebx);
eaxString = eaxString.substring(eaxString.length() - 4);
switch( ebxString.length() ) {
case 1: serial = eaxString + "000" + ebxString; break;
case 2: serial = eaxString + "00" + ebxString; break;
case 3: serial = eaxString + "0" + ebxString; break;
default: serial = eaxString + ebxString.substring(ebxString.length() - 4);
}
return serial;
}
private static String toHexString( BigInteger number ) {
String hexString = "";
BigInteger mod = ZERO;
while( number.compareTo(ZERO) != 0 ) {
mod = number.mod(SIXTEEN);
if( mod.compareTo(A) == 0 )
hexString = 'A' + hexString;
if( mod.compareTo(B) == 0 )
hexString = 'B' + hexString;
if( mod.compareTo(C) == 0 )
hexString = 'C' + hexString;
if( mod.compareTo(D) == 0 )
hexString = 'D' + hexString;
if( mod.compareTo(E) == 0 )
hexString = 'E' + hexString;
if( mod.compareTo(F) == 0 )
hexString = 'F' + hexString;
if( mod.compareTo(A) < 0 )
hexString = mod + hexString;
number = number.divide(SIXTEEN);
}
return hexString;
}
public static boolean isVersionNine( String user ) {
if( user.length() < 6 || user.length() > 40 )
return false;
for( int i = 0; i < user.length(); i++ )
if( user.charAt(i) >= 0x30 && user.charAt(i) <= 0x39 )
return false;
return true;
}
}
|