首页
社区
课程
招聘
[旧帖] [求助]新人求助 0.00雪花
发表于: 2008-2-21 21:22 3170

[旧帖] [求助]新人求助 0.00雪花

2008-2-21 21:22
3170
在学习《软件加密技术内幕》第六章时看到壳的那部分有些有明白,求助

ShellStart0:
        call        next0
;********************
ImportTableBegin:
ImportTable        DD        AddressFirst-ImportTable  
                DD        0,0
AppImpRVA1        DD        DllName-ImportTable   
AppImpRVA2        DD        AddressFirst-ImportTable
                DD        0,0,0,0,0
AddressFirst        DD        FirstFunc-ImportTable   
AddressSecond        DD        SecondFunc-ImportTable   
AddressThird        DD        ThirdFunc-ImportTable
                DD        0
DllName                DB        'KERNEL32.dll'
                DW        0
FirstFunc        DW        0       
                DB        'GetProcAddress',0
SecondFunc        DW        0
                DB        'GetModuleHandleA',0
ThirdFunc        DW        0
                DB        'LoadLibraryA',0
ImportTableEnd:
ShellBase        DD        0                        ;保存外壳压缩部分相对于ShellStart0的偏移地址
ShellPackSize        DD        0                        ;保存外壳压缩部分的原始大小
Virtualalloc        DB        'VirtualAlloc',0
VirtualallocADDR        DD        0
TlsTable        DB        18h dup (?)                ;保存原始程序的TLS表
next0:
        pop        ebp
        sub        ebp,(ImportTable-ShellStart0)        ;保存ShellStart0的地址
        lea        esi,[ebp+(DllName-ShellStart0)]        ;指向KERNEL32.DLL
        push        esi
        call        dword ptr [ebp+(AddressSecond-ShellStart0)]        ;取得DLL句柄
        lea        esi,[ebp+(Virtualalloc-ShellStart0)]
        push        esi
        push        eax
        call        dword ptr [ebp+(AddressFirst-ShellStart0)]        ;取得VirtualAlloc函数入口
        mov        dword ptr [ebp+(VirtualallocADDR-ShellStart0)],eax
        push        PAGE_READWRITE
        push        MEM_COMMIT
        push        dword ptr [ebp+(ShellPackSize-ShellStart0)]
        push        0
        call        dword ptr [ebp+(VirtualallocADDR-ShellStart0)]        ;申请内存存入外壳第二段
        push        eax
        mov        ebx,dword ptr [ebp+(ShellBase-ShellStart0)]
        add        ebx,ebp
        push        eax
        push        ebx
        call        _aP_depack_asm
        pop        edx
        push        ebp                                                ;保存第一段的基址,以便第二段中使用
        jmp        edx                                                ;转到第二段继续执行

该如何理解ImportTable-ShellStart0这样的东西?
还有问下该如何理解 jmp $+3 ;call $+5类似这样语句中的$,新手,莫见笑。。。

[培训]科锐逆向工程师培训第53期2025年7月8日开班!

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 213
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
在汇编当中,$表示本句地址。
比方说:NEXT:SJMP NEXT   -----   跳到NEXT处(本句死循环)
    可变为:     SJMP $

以上就是"$"的用法,我也是新手,只能回答你的第二个问题,希望你能满意!
2008-2-21 21:57
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
恩。谢谢楼上的。调试了下是这样的,但应该是本句指令汇编后的内存首地址,呵。谢了
call $+5应该就是跳到下条指令吧。
2008-2-21 23:21
0
游客
登录 | 注册 方可回帖
返回