欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

javascript shellcode to c shellcode

程序员文章站 2022-07-15 14:39:17
...

分析脚本类的shellcode时,需要转成C版本的,更方便调试一些
javascript shellcode to c shellcode
为此写了一个010editor脚本,一键转换

javascript shellcode to c shellcode

#define TITLE "js-shellcode-to-c"


void Main(void)
{
    int iIter;
    int iStart;
    int iSize;
    string sToClipboard;
    string sTemp;

    if (FileCount() == 0)
    {
        MessageBox(idOk, TITLE, "At least one file needs to be open.");
        return;
    }

    // Initializes the variables
    iSize = GetSelSize();
    iStart = GetSelStart();

    // Check that bytes were selected, otherwise process complete file
    if (iSize == 0)
    {
      iSize = FileSize();
      iStart = 0;
    }

    if (iSize > 10000 && MessageBox(idYes | idNo, TITLE, "It could take a long time to process %d bytes, do you want to continue?", iSize) == idNo)
      return;

     int i;
     sTemp = "unsigned char sc[] = \"";
     for(i = 0;i < iSize; i+=6)
     {
       if(i % 8 == 0)
       {
        sTemp += "\n";
       }
       sTemp += "\\x";
       sTemp += ReadString(iStart+i+4,2);
       sTemp += "\\x";
       sTemp += ReadString(iStart+i+2,2);
        
        
       //Printf("%s\n",ReadString(iStart+i+2,4));        
     }
     sTemp+= "\";\n";
     Printf(sTemp);
     ClearClipboard();
     CopyStringToClipboard(sTemp);
     FileNew("Hex");
    
     Printf("Successfully created a new tab with [ 0x%x ] bytes.\n", i);
    
}

Main();

然后再用scdbg跑一下shellcode,简单看下调用了哪些api

javascript shellcode to c shellcode

相关标签: 心情杂货铺