Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created Jul 26, 2015
Embed
What would you like to do?
;MOVfuscator
;domas 2015
USE32
section .data
DATA equ 131072
%macro c_s 1
%1: dd 0
d_%1: dd 0
s_%1: dd d_%1, %1
%endmacro
s_ms: dd s, m
s_mz: dd z, m
b: dd 0
t: dd 0
c: db 0
c_s dp
c_s id
c_s ot
on: dd 4
d_on: dd 0
s_on: dd d_on, on
o: dd o_0, o_1
o_0: dd 0, 4
o_1: dd 4, 4
a: dd a_0, a_1
a_0: dd 0, 0
a_1: dd 0, 4
n: dd 4, 0
nh: dd 0
h: dd nh, 0
trim: dd 0
times 255 dd 1
incb:
%assign y 1
%rep 256
db y&0xff
%assign y y+1
%endrep
decb:
%assign y 256-1
%rep 256
db y&0xff
%assign y y+1
%endrep
incw:
%assign y 1
%rep 256*256
dw y&0xffff
%assign y y+1
%endrep
decw:
%assign y 256*256-1
%rep 256*256
dw y&0xffff
%assign y y+1
%endrep
%macro eq 3
mov eax, 0
mov edx, 0
mov ax, [%2]
mov byte [e+eax], 0
mov byte [e+%3], 4
mov dl, [e+eax]
mov [%1], edx
%endmacro
%macro neq 3
mov eax, 0
mov edx, 0
mov ax, [%2]
mov byte [e+eax], 4
mov byte [e+%3], 0
mov dl, [e+eax]
mov [%1], edx
%endmacro
%macro or 3
mov eax, [%2]
mov edx, [o+eax]
mov eax, [%3]
mov eax, [eax+edx]
mov [%1], eax
%endmacro
%macro and 3
mov eax, [%2]
mov edx, [a+eax]
mov eax, [%3]
mov eax, [eax+edx]
mov [%1], eax
%endmacro
%macro not 2
mov eax, [%2]
mov eax, [n+eax]
mov [%1], eax
%endmacro
section .bss
m: resb DATA
s: resb DATA
z: resb DATA
e: resb 256*256
section .text
global _start
_start:
loop:
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov [ot], dword 0
mov eax, [dp]
mov edx, 0
mov dl, [m+eax]
mov [t], edx
eq t, t, 0
and b, on, t
mov eax, [b]
mov eax, [s_id+eax]
mov [eax], dword 1
mov eax, [b]
mov eax, [s_on+eax]
mov [eax], dword 0
mov eax, [b]
mov eax, [s_ot+eax]
mov [eax], dword 4
not t, on
eq b, id, 1
and b, b, t
not t, ot
and b, b, t
mov eax, [b]
mov eax, [s_on+eax]
mov [eax], dword 4
mov eax, [on]
mov ebx, [s_dp+eax]
mov eax, [ebx]
mov edx, 0
mov dx, [incw+2*eax]
mov [ebx], edx
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [incb+eax]
mov [ebx+edx], al
mov eax, [on]
mov ebx, [s_dp+eax]
mov eax, [ebx]
mov edx, 0
mov dx, [decw+2*eax]
mov [ebx], edx
mov eax, [on]
mov ebx, [s_ms+eax]
mov edx, [dp]
mov eax, 0
mov al, [ebx+edx]
mov al, [decb+eax]
mov [ebx+edx], al
mov [ot], dword 0
mov eax, [dp]
mov edx, 0
mov dl, [m+eax]
mov [t], edx
neq t, t, 0
and b, on, t
mov eax, [b]
mov eax, [s_id+eax]
mov [eax], dword 1
mov eax, [b]
mov eax, [s_on+eax]
mov [eax], dword 0
mov eax, [b]
mov eax, [s_ot+eax]
mov [eax], dword 4
not t, on
eq b, id, 1
and b, b, t
not t, ot
and b, b, t
mov eax, [b]
mov eax, [s_on+eax]
mov [eax], dword 4
mov eax, [on]
mov ebx, [s_dp+eax]
mov eax, [ebx]
mov edx, 0
mov dx, [incw+2*eax]
mov [ebx], edx
mov eax, [on]
mov eax, [s_mz+eax]
mov edx, [dp]
mov al, [eax+edx]
mov [c], al
mov eax, 4
mov ebx, 1
mov ecx, c
mov edx, 1
int 0x80
jmp loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment