format PE console use32 entry start include win32a inc ---------------

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
format PE console
use32
entry start
include 'win32a.inc'
;---------------------------------------
res dd ?
std_handle dd 0
s8 db 104,112,120 ;3
s7 db 102,109,116 ;3
s6 db 102,108,114,120 ;4
s5 db 100,105,110,115,120 ;5
s4 db 100,104,108,112,116,120 ;6
s3 db 99,102,105,108,111,114,117,120 ;8
s2 db 98,100,102,104,106,108,110,112,114,116,118,120,122 ;13
s1 db 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122 ;a-z 26
serial db 8 dup(?)
seed dd ?
;---------------------------------------
start:
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov [std_handle],eax
xor ebx,ebx
inc ebx
call set_seed
cikl:
cmp ebx,1
jnz @f
call get_rnd
xor edx, edx
push 27
pop ecx
div cl
mov al,[s1+eax]
mov [serial+ebx],al ;~~
@@:
cmp ebx,2
jnz @f
call get_rnd
xor edx, edx
push 14
pop ecx
div cl
mov al,[s2+eax]
mov [serial+ebx],al
@@:
cmp ebx,3
jnz @f
call get_rnd
xor edx, edx
push 9
pop ecx
div cl
mov al,[s3+eax]
mov [serial+ebx],al
@@:
cmp ebx,4
jnz @f
call get_rnd
xor edx, edx
push 7
pop ecx
div cl
mov al,[s4+eax]
mov [serial+ebx],al
@@:
cmp ebx,5
jnz @f
call get_rnd
xor edx, edx
push 6
pop ecx
div cl
mov al,[s5+eax]
mov [serial+ebx],al
@@:
cmp ebx,6
jnz @f
call get_rnd
xor edx, edx
push 5
pop ecx
div cl
mov al,[s6+eax]
mov [serial+ebx],al
@@:
cmp ebx,7
jnz @f
call get_rnd
xor edx, edx
push 4
pop ecx
div cl
mov al,[s7+eax]
mov [serial+ebx],al
@@:
cmp ebx,8
jnz @f
call get_rnd
xor edx, edx
push 4
pop ecx
div cl
mov al,[s8+eax]
mov [serial+ebx],al
@@:
cmp ebx,8
jz ok
inc ebx
jmp cikl
ok:
invoke WriteConsole,[std_handle],serial,8,res,NULL
invoke ExitProcess,0
set_seed:
rdtsc
mov dword[seed], eax
retn
get_rnd:
mov eax, [seed]
mov ecx, 1103515245
cdq
mul ecx
add eax, 12345
mov [seed], eax
retn
data import
library kernel32,'KERNEL32.DLL',\
user32, 'USER32.DLL'
include 'api\kernel32.inc'
include 'api\user32.inc'
end data