|
关于ImageBase的问题
那个没看,不过一般来说imagebase是可以从PE文件映射到了内存之中后,可以用映射到内存,这个地址就是PE的dos头的位置,所以。用PE结构就可以找出这个值是多少了。 补上,看上面的imagebase不是PE里的那个imagebase吧?这个函数看上去是判断是否是PE文件,所以这个imagebase应就是文件映射到内存中返回的那个地址。 |
|
|
|
[求助]IoCreateDevice,MjorFunction没反应?
iocreatedevice创建,他不产生irp么? |
|
|
|
[原创]自删除正在运行的...
其实,用批处理也是不错的,只要那个贴的加个ping延时一下就行了,因为要自删除的程序一般都是运行完了就自已退出,然后用批处理删exe文件。 若要一直自己运行的,还不如注入。 |
|
[推荐]2009第二届奇虎360软件安全大赛
各路大神大展身手的时候到了~~~偶路过一下~ |
|
[求助]kill360的一点疑问
神奇的MJ是无处不在的。 |
|
[原创]文件运行后自删除的汇编代码
转, 昨天在图书馆,突然想起来好久没有关注程序这方面的问题了,堕落了,着实是堕落了,想起以前对它的疯狂。于是又跑到那块熟悉的地方去找找,看能否有令我感兴趣的书。看到了一本Detmer写的关于汇编的书,翻了几页很是喜欢,嗯,这几天就关心一下这方面的内容吧。 上午在关注这方面的内容中,发现了下面这个贴子。其实以前在一本VC编程的书上看到过这个例子,只是当时对汇编什么都不懂,所以也没仔细看。现在觉得,那本书的作者完全就是抄的。中国人写的书就是这样(我感觉得是绝大多数),东拼西凑找些东西,不注重程序设计结构和算法,所以也就导致我现在“书非外国人写不读写”这种不好的状况。 下面的代码由Gary Nebbett写就.Gary Nebbett乃是WINDOWS NT/2000 NATIVE API REFERENCE的作者.乃NT系统一等一的高手.下面就分析一些他的这段代码. 这段代码在PROCESS没有结束前就将启动PROCESS的EXE文件删除了. int main(int argc, char *argv[]) { HMODULE module = GetModuleHandle(0); CHAR buf[MAX_PATH]; GetModuleFileName(module, buf, sizeof buf); CloseHandle(HANDLE(4)); __asm { lea eax, buf push 0 push 0 push eax push ExitProcess push module push DeleteFile push UnmapViewOfFile ret } return 0; } 现在,我们先看一下堆栈中的东西 偏移 内容 24 0 20 0 16 offset buf 12 address of ExitProcess 8 module 4 address of DeleteFile 0 address of UnmapViewOfFile 调用RET返回到了UnmapViewOfFile,也就是栈里的偏移0所指的地方.当进入UnmapViewOfFile的流程时,栈里见到的是返回地址DeleteFile和HMODUL module.也就是说调用完毕后返回到了DeleteFile的入口地址.当返回到DeleteFile时,看到了ExitProcess的地址,也就是返回地址.和参数EAX,而EAX则是buffer.buffer存的是EXE的文件名.由GetModuleFileName(module, buf, sizeof buf)返回得到.执行了DeleteFile后,就返回到了ExitProcess的函数入口.并且参数为0而返回地址也是0.0是个非法地址.如果返回到地址0则会出错.而调用ExitProcess则应该不会返回. 这段代码的精妙之处在于: 1.如果有文件的HANDLE打开,文件删除就会失败,所以,CloseHandle(HANDLE(4));是十分巧妙的一手.HANDLE4是OS的硬编码,对应于EXE的IMAGE.在缺省情况下,OS假定没有任何调用会关闭IMAGE SECTION的HANDLE,而现在,该HANDLE被关闭了.删除文件就解除了文件对应的一个句柄. 2.由于UnmapViewOfFile解除了另外一个对应IMAGE的HANDLE,而且解除了IMAGE在内存的映射.所以,后面的任何代码都不可以引用IMAGE映射地址内的任何代码.否则就OS会报错.而现在的代码在UnmapViewOfFile后则刚好没有引用到任何IMAGE内的代码. 3.在ExitProcess之前,EXE文件就被删除了.也就是说,进程尚在,而主线程所在的EXE文件已经没了.(WINNT/9X都保护这些被映射到内存的WIN32 IMAGE不被删除.) Gary Nebbett果然是WIN系列平台的顶尖高手之一.能写出如此代码.独辟蹊径啊:) |
|
[原创]小菜也学内核笔记---前提知识
抄下来的,打算打印出来看, |
|
[求助]~求助倒叙排列代码
看楼主的代码都是从小到大,从大到小的话直接输出~ 下面的,输是能输出不过有问题 .386 .model flat,stdcall option casemap:none include windows.inc include user32.inc include kernel32.inc includelib user32.lib includelib kernel32.lib .data szFin db '\in.txt',0 szOut db '\out.txt',0 .data? dwNum dd ? hFile dd ? hFileOut dd ? dwFread dd ? szRead db 4096 dup (?) szWrite db 4096 dup (?) szBuffer db 260 dup (?) szOutFile db 260 dup (?) szTemp db 260 dup (?) .const .code start: invoke GetCurrentDirectory,260,addr szBuffer invoke lstrcpy,addr szOutFile,addr szBuffer invoke lstrcat,addr szOutFile,addr szOut invoke lstrcat,addr szBuffer,addr szFin invoke CreateFile,addr szBuffer,GENERIC_ALL,FILE_SHARE_WRITE or FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL .if eax==-1 jmp EExit .endif mov hFile,eax invoke ReadFile,hFile,addr szRead,4000,addr dwFread,NULL lea esi,szRead add esi,dwFread ;dwFread 实际读取的数 lea edi,szWrite lea ebx,szTemp mov ecx,dwFread mov dwNum,0 cover: mov al,BYTE PTR [esi] cmp al,0ah jz xx cmp al,0dh jz yy mov BYTE PTR [ebx],al inc dwNum zz: inc ebx dec esi loop cover invoke CreateFile,addr szOutFile,GENERIC_READ or GENERIC_WRITE,FILE_SHARE_WRITE or FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL .if eax==-1 jmp EExit .endif mov hFileOut,eax invoke WriteFile,hFileOut,addr szWrite,dwFread,addr dwFread,NULL EExit: invoke CloseHandle,hFile invoke CloseHandle,hFileOut invoke ExitProcess,NULL xx: push ecx mov ecx,dwNum hh:mov al,BYTE PTR [ebx] mov BYTE PTR [edi],al dec ebx inc edi loop hh mov BYTE PTR [edi],0dh inc edi pushad invoke RtlZeroMemory,addr szTemp,260 popad lea ebx,szTemp pop ecx mov dwNum,0 jmp zz yy: mov BYTE PTR [edi],0ah inc edi lea ebx,szTemp jmp zz end start |
|
[原创]文件运行后自删除的汇编代码
呃,批处理删除? |
|
[分享]看雪论坛发展历史
我很喜欢这个论坛的界面。 |
|
[建议]最近在Win32/Win64编程子论坛的事
java的语法不是同C++一样的么?听说的~ |
|
[求助]请问学内核这二本书是否是最佳搭配?
是啊,,牛人的经验,总是有很多可以借俭的,,虽然他们的方法及所看的书不适菜鸟~。 |
|
[求助]请问学内核这二本书是否是最佳搭配?
我也看了前一二章,不过到了串口那边,若想明白一点,我觉得还是先看下详解那本书,我也是交叉看的。 |
|
|
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值