Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

From nasm to masm

Featured Replies

Posted

when i use nasm.exe in cmd and choose the filepath to my asm file it will generate a new file. Just like this in cmd; nasm.exe mynasmsource.asm. this will geneate a new file.


 


now i want do the same with masm32. i got the same source but this time written in masm, now i need that new file like what nasm.exe generated.


how?


Edited by Yoshi

convert INTEL to NASM syntax...

C++ code (not tested too much, but should work for basic ASM instructions):

static bool issegment(const char* str){    if(!strncasecmp(str, "gs", 2))        return true;    if(!strncasecmp(str, "fs", 2))        return true;    if(!strncasecmp(str, "es", 2))        return true;    if(!strncasecmp(str, "ds", 2))        return true;    if(!strncasecmp(str, "cs", 2))        return true;    if(!strncasecmp(str, "ss", 2))        return true;    return false;}static const char* Intel2Nasm(const char* intel){    char temp[256]="";    static char nasm[256]="";    memset(nasm, 0, sizeof(nasm));    memset(temp, 0, sizeof(temp));    int len=strlen(intel);    for(int i=0,j=0; i<len; i++) //fix basic differences and problems    {        if(!strncasecmp(intel+i, "ptr", 3)) //remote "ptr"        {            i+=2;            if(intel[i+1]==' ')                i++;            continue;        }        else if(!strncasecmp(intel+i, "  ", 2)) //remove double spaces            continue;        else if(intel[i]=='\t') //tab=space        {            j+=sprintf(temp+j, " ");            continue;        }        j+=sprintf(temp+j, "%c", intel[i]);    }    len=strlen(temp);    for(int i=0,j=0; i<len; i++)    {        if(temp[i]==' ' and temp[i+1]==',')            continue;        else if(temp[i]==',' and temp[i+1]==' ')        {            j+=sprintf(nasm+j, ",");            i++;            continue;        }        else if(issegment(temp+i) and temp[i+2]==' ')        {            j+=sprintf(nasm+j, "%c%c", temp[i], temp[i+1]);            i+=2;            continue;        }        else if(temp[i]==':' and temp[i+1]==' ')        {            j+=sprintf(nasm+j, ":");            i++;            continue;        }        j+=sprintf(nasm+j, "%c", temp[i]);    }    len=strlen(nasm);    for(int i=0,j=0; i<len; i++)    {        if(issegment(nasm+i) and nasm[i+2]==':' and nasm[i+3]=='[')        {            j+=sprintf(temp+j, "[%c%c:", nasm[i], nasm[i+1]);            i+=3;            continue;        }        j+=sprintf(temp+j, "%c", nasm[i]);    }    strcpy(nasm, temp);    return nasm;}

intel2nasm.zip

Edited by Mr. eXoDia

I think you mean make a Exe from a source?

 

ml /c /coff /Cp "xyz.Asm"
link /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /OUT:"xyz.exe" "xyz.obj" 

  • Author

thank both of you but that is not really what i want to do.


 


let me explain.


 


i found a crypter.


in this package there is nasm/nasm.exe. and a stub.asm.


 


when i use nasm.exe in cmd and choose the filepath to the stub.asm, it will generate a new stub file. this new stub file will be used in the crypter.


 


now i got my own written stub in masm which is called stub2.asm.so how do i convert my own stub to a new file and use it in the crypter?


Edited by Yoshi

I knew you meant this, you need to manually convert the syntax. MASM uses invoke for example, nasm doesnt have this. Notice that default interpretion mode in NASM is DEC, so you should prefix your values with 'h'

The converter provided converts stuff like "mov byte ptr fs:[X]" to "mov byte [fs:X]" automatically. You could use the code I provided to parse a file and convert the basic syntax first.

Greetings

  • Author

okidoki mister exodia high thank for you and ragdog


  • Author

okidoki mister exodia high thank for you and ragdog


Ahh convert the source to Masm :scratch:


 


Is not really difficult


 


A other good option is Load the compiled exe in Ida or Olly and you see the Masm syntax :prop:


Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.