The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: QvasiModo on December 19, 2007, 05:20:43 PM

Title: Nanomites
Post by: QvasiModo on December 19, 2007, 05:20:43 PM
I found a MASM macro to add nanomites to your code in openrce.org, here's the link to the original article:

https://www.openrce.org/blog/view/999/Nanomites_by_Deroko

Here's another article explaining what nanomites are:

<<  Removed for Reverse Engineering references which are against forum rules.  Regards,  P1   :8)  >>

And here's the code:

EXCEP_INT3 equ 010h
EXCEP_DIV0 equ 011h
EXCEP_PRIV equ 012h
EXCEP_ILLE equ 013h
EXCEP_ACCE equ 014h

nanomite_m macro i_ExcepType, i_JumpType, i_Address
    local    @nano
@nano:
    if i_ExcepType eq EXCEPT_INT3
        int    03h 
    elif i_ExcepType eq EXCEP_DIV0
        xor    ebx, ebx
        xor    edx, edx
        mov    eax, 02h
        div    ebx
    elif i_ExcepType eq EXCEP_ACCE
        xor    eax, eax
        xchg   dword ptr [eax], eax
    elif i_ExcepType eq EXCEP_PRIV
        ; TODO: Add code to generate this exception
    elif i_ExcepType eq EXCEP_ILLE
        ; TODO: Add code to generate this exception
    endif
    db    i_ExcepType
    db    i_JumpType
    dd    offset i_Address - offset @nano
endm


I hope you find this interesting. :)
Title: Re: Nanomites
Post by: Ehtyar on December 20, 2007, 11:52:30 AM
Good to see people interested in RE still browse this forum. Nice work.
P.S. For those interested in the original source of this code (tasm), google for "deroko".

Ehtyar.