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
format PE console
use32
entry start
include 'win32a.inc'
;---------------------------------------
res dd ?
std_handle dd 0
s8 db 104,112,120
s8l =($-s8)
s7 db 102,109,116
s7l =($-s7)
s6 db 102,108,114,120
s6l =($-s6)
s5 db 100,105,110,115,120
s5l =($-s5)
s4 db 100,104,108,112,116,120
s4l =($-s4)
s3 db 99,102,105,108,111,114,117,120
s3l =($-s3)
s2 db 98,100,102,104,106,108,110,112,114,116,118,120,122
s2l =($-s2)
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
s1l =($-s1)
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
cdq
inc ebx
mov ecx, ebx
dec ebx
div ecx
mov byte [serial+ebx],al
@@:
cmp ebx,2
jnz @f
call get_rnd
cdq
inc ebx
mov ecx, ebx
dec ebx
div ecx
mov byte [serial+ebx],al
@@:
cmp ebx,3
jnz @f
call get_rnd
cdq
inc ebx
mov ecx, ebx
dec ebx
div ecx
mov byte [serial+ebx],al
@@:
cmp ebx,4
jnz @f
call get_rnd
cdq
inc ebx
mov ecx, ebx
dec ebx
div ecx
mov byte [serial+ebx],al
@@:
cmp ebx,5
jnz @f
call get_rnd
cdq
inc ebx
mov ecx, ebx
dec ebx
div ecx
mov byte [serial+ebx],al
@@:
cmp ebx,6
jnz @f
call get_rnd
cdq
inc ebx
mov ecx, ebx
dec ebx
div ecx
mov byte [serial+ebx],al
@@:
cmp ebx,7
jnz @f
call get_rnd
cdq
inc ebx
mov ecx, ebx
dec ebx
div ecx
mov byte [serial+ebx],al
@@:
cmp ebx,8
jnz @f
call get_rnd
cdq
inc ebx
mov ecx, ebx
dec ebx
div ecx
mov byte [serial+ebx],al
@@:
test ebx,8
jz ok
inc ebx
jmp start
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