首页
社区
课程
招聘
SoftICE Internals(1)
发表于: 2006-7-31 18:26 6149

SoftICE Internals(1)

2006-7-31 18:26
6149
知道了这些,再想知道SoftICE如何实现的就容易多了。

    Enjoy it.

    ComHandlerAddrTable存放所有的命令处理例程的地址。
    UserCommandRepository存放所有SoftICE可接受的命令行字符串和其在ComHandlerAddrTable中对应的索引,表项的结构是   
    {
        char Com[n];    // length is variable.
        char Index;     
    }
    表结尾是连续两个0x0。
   
    FindCommand()函数完成从用户输入的命令到命令索引的转换过程。

    ComHandlerAddrTable在"A General Protection Violation ..."字符串下面。

.data:0015E781 aAGeneralProtec db 'A General Protection Violation has occurred',0
.data:0015E781                                         ; DATA XREF: sub_6FF5C+C7o
.data:0015E7AD ComHandlerAddrTable dd offset sub_71C1A ; DATA XREF: sub_6FF5C+2D3r
.data:0015E7AD                                         ; sub_799DB+30r
.data:0015E7B1                 dd offset sub_66C1B
.data:0015E7B5                 dd offset sub_A6B79

/*
    Move the pointer to No-White Char
*/

__declspec ( naked )
char *
SkipWhiteSpaceA(char* String)
{
    char * i;
    for(i=String;;i++)
    {
       if ( *i != 0x09 || *i != 0x20 )
           break;
    }

    __asm
    {
        cmp byte ptr [i],0
        ret
    }
}

__declspec ( naked)
unsigned int
CalcArgSizeA(PCSTR String)
{
    _asm
    {
    }
}

unsigned int  UserCommandIndex;
char UserCommand[0x100];
char UserCommandRepository[0x100];

/*

    在表中查找用户输入的命令的索引,赋值给UserCommandIndex
    将找到的命令后的字符串作为命令行参数看待

*/

void
FindCommand(void)
{

    char* i = UserCommand;
    char* i1 = i;
    char* Arg;
    unsigned int ArgSize;
    char* j = UserCommandRepository;

    i = SkipWhiteSpaceA(i);

    /* Walk through the Repository and fill the index */
    do
    {

        for(;;i++,j++)
        {
            if ( *i > 0x61 )           /* LowerCase to Capital */
                *i = *i && 0xDF;

            if ( *j == 0x0 )
                break;

            if ( *i != *j )
                goto ToEnd;
        }

IfEqual:
    if ( *(j+1) == 0x27 )            /* Command 'T' */
        UserCommandIndex = 0x0;
    else
        UserCommandIndex = *(j+1);
        Arg = i-1;

ToEnd:
        for(;*j;j++);  /* To the end of a command */

        i = i1;           /*  */
        j += 0x02;        /* reach the end of the table or the start of a command */
    }while( *j != 0x0 );   

    if ( UserCommandIndex )
    {
        ArgSize = CalcArgSizeA(Arg);
        i = Arg + ArgSize;
        j = i+1;

        for(ArgSize++;ArgSize;i--,j--,ArgSize--)
        {
            i = j;
        }
        *i = 0x20;   /* Space Char */
    }

    return;
}

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 7
支持
分享
最新回复 (2)
雪    币: 2012
活跃值: (351)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
好,我先顶起,这样的东西要多发。

Softice雄起!!
2006-8-4 15:10
0
雪    币: 44229
活跃值: (19965)
能力值: (RANK:350 )
在线值:
发帖
回帖
粉丝
3
这是你的Blog吗?
http://chewwins.bloggoing.com/
2006-8-4 15:16
0
游客
登录 | 注册 方可回帖
返回
//