;------------------------------------------------------------------------
; About:
; keygen for mybase v4.52 coded by arbiter.
; this software are protected with a medium intensity scheme.
; Assemble:
; tasm32 /mx /m4 /z keygen.asm
; tlink32 -x -V4.0 -Tpe -aa -c keygen.obj,keygen,,,keygen.def,keygen.res
;------------------------------------------------------------------------
.386
.MODEL FLAT, STDCALL
LOCALS
UNICODE = 0
; below is what you need to compile this source. the inc. and imp32.
include E:\TASM5Plus\TASM5Plus\INCLUDE\w32.inc
includelib E:\TASM5Plus\TASM5Plus\LIB\imp32i.lib
; defined the resource for sequent operation.
IDD_MAINDLG = 101
BT_GENERATE = 1001
BT_EXIT = 1002
EDIT_NAME = 1003
EDIT_KEY = 1004
; declare the imported functions.
extrn wsprintfA : PROC
extrn CharUpperA : PROC
extrn strcat :
PROC
extrn strcpy :
PROC
; the limitation of input char lengths
MINCHARS = 5
MAXCHARS = 16
; data area
.DATA
defaultName db "arbiter", 0
paddingName db "junjiao.wang", 0
paddingLen = ( $ - paddingName )
format db "%s-%s-%s-%s", 0
cctable db "3456789ABCDEFGHJKMNPQRSTWXY",
0
;testmsg db "test!", 0
;debugIt db "debug!", 0
; -----------------------------------------------------------------
nameError db "Name 5 to 16 chars.NO leading/trailing spaces.",
0
; -----------------------------------------------------------------
.DATA?
hdlg dd ?
_hInst dd ?
nlen dd ?
userinput db 60 dup(?)
tempKey1 dd ?
tempKey2 dd ?
tempKey3 dd ?
tempKey4 dd ?
keyPart1 db 10 dup(?)
keyPart2 db 10 dup(?)
keyPart3 db 10 dup(?)
keyPart4 db 10 dup(?)
userCode db 60 dup(?)
; ------------------------ start ---------------------------------
.CODE
start: pushad
call GetModuleHandle, 0
test eax, eax
je ExitKeyGen
mov _hInst, eax
call DialogBoxParamA, _hInst,
IDD_MAINDLG, 0, offset DlgProc, 0
ExitKeyGen:
popad
call ExitProcess, 0
RET
;------------------------- DlgProc --------------------------------
DlgProc proc __hWnd:HWND, wmsg:UINT, _wparam:WPARAM, _lparam:LPARAM
uses ebx, edi, esi
mov eax, wmsg
cmp eax, WM_CLOSE
jz _wmDestroy
cmp eax, WM_COMMAND
jz _wmCommand
cmp eax, WM_INITDIALOG
jz _wmInitDlg
xor eax, eax
RET
; ------------------------ End DlgProc ----------------------------
; ------------------------ sub process ----------------------------
_wmDestroy:
call EndDialog, hdlg, 0
RET
; ----------------------------------------------------------------
_wmInitDlg:
mov eax, __hWnd
mov hdlg, eax
call GetDlgItem, __hWnd, EDIT_NAME
call SendMessageA, eax, EM_SETLIMITTEXT,
MAXCHARS, 0
call SetDlgItemTextA, __hWnd, EDIT_NAME,
offset defaultName
push 1
pop eax
RET
; ----------------------------------------------------------------
_wmCommand:
mov eax, _wparam
cmp ax, BT_EXIT
jz _wmDestroy
cmp ax, BT_GENERATE
jnz @out
call GenerateIt
@out: xor eax, eax
RET
; -----------------------------------------------------------------
DlgProc ENDP
; -----------------------------------------------------------------
; -----------------------------------------------------------------
; ###################### Generate KeyCode #########################
; -----------------------------------------------------------------
GenerateIt proc
xor eax, eax
mov tempKey1, eax
mov tempKey2, eax
mov tempKey3, eax
mov tempKey4, eax
call GetDlgItemTextA, hdlg, EDIT_NAME,
offset userinput, MAXCHARS+1
cmp eax, MINCHARS
jl @error
mov nlen, eax
; --------------------- for debugging ----------------------------------
; call MessageboxA, hdlg, offset testmsg,
offset debugIt, MB_OK
; ----------------------------------------------------------------------
call GenTempKey, offset tempKey2, offset
userinput, nlen
call strcat, offset userInput, offset paddingName
add esp, 8
mov eax, nlen
add eax, paddingLen
dec eax
mov nlen, eax
call GenTempKey, offset tempKey1, offset
userinput, nlen
xor eax, eax
xor ebx, ebx
mov eax, tempKey1
mov ebx, tempKey2
push eax
sub eax, ebx
mov tempKey4, eax
pop eax
add eax, ebx
mov tempKey3, eax
call GenEveryPart, offset keyPart1, tempKey1
call GenEveryPart, offset keyPart2, tempKey2
call GenEveryPart, offset keyPart3, tempKey3
call GenEveryPart, offset keyPart4, tempKey4
call wsprintfA, offset userCode, offset
format, offset keyPart1, \
offset keyPart2, offset keyPart3, offset keyPart4
add esp, 24
call SetDlgItemTextA, hdlg, EDIT_KEY, offset
userCode
@finish:
xor eax, eax
RET
@error: call SetDlgItemTextA, hdlg, EDIT_KEY, offset
nameError
jmp @finish
GenerateIt ENDP
; -----------------------------------------------------------------
; function: void GenTempKey( tempKey, userInput, nlen )
; describe: operating base on userInput to yield one DWORD value.
; -----------------------------------------------------------------
GenTempKey proc
push ebp
mov ebp, esp
push edi
push esi
xor edi, edi
xor esi, esi
mov ebx, [ebp+12]
mov edi, dword ptr[ebp+16]
@loop1:
mov eax, [ebp+8]
push eax
mov dl, byte ptr[ebx]
push edx
call Computel
add esp, 8
inc esi
inc ebx
cmp edi, esi
jg @loop1
pop esi
pop edi
pop ebp
xor eax, eax
RET 12
GenTempKey ENDP
; --------------------------------------------------------------------
Computel proc
push ebp
mov ebp, esp
push ebx
push esi
mov esi, [ebp+12]
xor edx, edx
mov eax, [esi]
mov ecx, eax
mov ebx, eax
xor eax, eax
and ecx, 0FFFFh
mov al, [ebp+8]
add eax, ecx
mov ecx, 0FFF1h
div ecx
shr ebx, 10h
mov ecx, edx
and ebx, 0FFFFh
xor edx, edx
lea eax, [ecx+ebx]
mov ebx, 0FFF1h
div ebx
mov ebx, edx
shl ebx, 10h
add ecx, ebx
mov [esi], ecx
pop esi
pop ebx
pop ebp
RET
Computel ENDP
; --------------------------------------------------------------------
; --------------------------------------------------------------------
; ######################## GenEveryPart keyCode #######################
; --------------------------------------------------------------------
GenEveryPart proc
push ebp
mov ebp, esp
push ecx
push ebx
push edx
push esi
push edi
xor ebx, ebx
mov edi, [ebp+8]
mov esi, dword ptr[ebp+12]
@loop2:
mov ecx, esi
not ecx
and ecx, 0ffh
mov eax, ecx
xor edx, edx
mov ecx, 27
div ecx
mov eax, edx
mov al, cctable[eax]
stosb
shr esi, 8
inc ebx
cmp ebx, 4
jl @loop2
pop edi
pop esi
pop edx
pop ebx
pop ecx
pop ebp
RET 8
GenEveryPart ENDP
END start
;;
- 标 题:keygen of mybase v4.52 8^) (7千字)
- 作 者:arbiter
- 时 间:2001-10-17 23:04:03
- 链 接:http://bbs.pediy.com