找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 3360|回复: 1

暴力搜索内存查找隐藏进程

[复制链接]

280

主题

203

回帖

0

精华

版主

积分
1808
发表于 2011-1-16 00:25:54 | 显示全部楼层 |阅读模式
void EnumBySearchMemory( PVOID Buffer)
{
    DWORD Index,Index2;
    DWORD Address;
    PHYSICAL_ADDRESS physical_address;

    for ( Index=MmSystemRangeStart; Index<=0xFFFF0000; Index+=0x1000)
    {
        if ( !MmIsAddressValid((PVOID)Index))
            continue;
        // 需要 MmGetPhysicalAddress和MmGetVirtualForPhysical两个函数
        // 的结果判断一下
        physical_address = MmGetPhysicalAddress( (PVOID)Index);
        if ( physical_address.HighPart > g_PhysicalPage.HighPart )
            continue;
        if ( physical_address.HighPart = g_PhysicalPage.HighPart &&
             physical_address.LowPart  > g_PhysicalPage.LowPart   
           )
             continue;

        Address = (DWORD)MmGetVirtualForPhysical( physical_address);
        if ( Address != Index)
            continue;
        for ( Index2 = 0x1b5; Index2 != 0; Index2--,Address+=8)
        {
            if ( IsValidEproc( Address))
                CopyProcessInfo( Address, Buffer);
        }
    }
    return;
}


bool IsValidEproc( DWORD eproc)
{
    DWORD Var;
    if ( *(DWORD*)(eproc+HandleTableOffset) <= MmSystemRangeStart)
        return false;
    if ( *(DWORD*)(eproc+4) != 0 )
        return false;
    if ( *(DWORD*)(eproc+ExitTimeOffset) != 0 || *(DWORD*)(eproc+ExitTimeOffset+4) != 0 )
        return false;
    if ( *(DWORD*)(eproc+PIDOFFSET) >= 0x100000 )
        return false;
    if ( *(DWORD*)(eproc+PebOffset) >= MmSystemRangeStart)
        return false;
    if ( *(DWORD*)(eproc+PebOffset) <= 0x10000)
        return false;   
    if( *(DWORD*)(eproc+0x88)  <= MmSystemRangeStart ||
        *(DWORD*)(eproc+0x8c)  <= MmSystemRangeStart ||
        *(DWORD*)(eproc+0x190) <= MmSystemRangeStart ||
        *(DWORD*)(eproc+0x194) <= MmSystemRangeStart ||
        *(DWORD*)(eproc+0x50)  <= MmSystemRangeStart ||
        *(DWORD*)(eproc+0x40)  <= MmSystemRangeStart ||
        *(DWORD*)(eproc+0x44)  <= MmSystemRangeStart ||
        *(DWORD*)(eproc+0x54)  <= MmSystemRangeStart
     )
        return false;
    if ( !MmIsAddressValid( *(PVOID*)(eproc+HandleTableOffset)) )
        return false;
    if ( !MmIsAddressValid( *(PVOID*)(eproc+0x50)) )
        return false;
    if ( !MmIsAddressValid( *(PVOID*)(eproc+0x54)) )
        return false;
    Var = *(DWORD*)(eproc+0x190)-0x224;
    if ( !MmIsAddressValid( (PVOID)Var ) )
        return false;   
    if ( !MmIsAddressValid( (PVOID)(Var+Eproc_Offset_TList) ) )
        return false;
    return true;
}





查找未导出函数的地址:

BOOLEAN IsAPI(ULONG Arr)
{
if (Arr >= start_address && Arr <= start_address+sys_info->Size)
{
return TRUE;
}
else
{
return FALSE;
}
}

typedef struct _SYSTEM_MODULE_INFORMATION { // Information Class 11
        ULONG Reserved[2];
        PVOID Base;
        ULONG Size;
        ULONG Flags;
        USHORT Index;
        USHORT Unknown;
        USHORT LoadCount;
        USHORT ModuleNameOffset;
        CHAR ImageName[256];
} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;

12

主题

144

回帖

0

精华

铜牌会员

积分
281
发表于 2011-12-26 12:36:37 | 显示全部楼层
这么玩肯定蓝屏!
您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

快速回复 返回顶部 返回列表