首页
社区
课程
招聘
[转帖]Odbgscript Updated to 1.65.4 by sunbeam
发表于: 2008-1-24 01:19 9636

[转帖]Odbgscript Updated to 1.65.4 by sunbeam

2008-1-24 01:19
9636
From:SnD

Odbgscript Updated to 1.65.4 by sunbeam

Updated to 1.65.4 (fixed issues concerning ASK and ASM commands in scripts).


Found bug here:

bool OllyLang:: DoASK(string args)
{
    string ops[1];
    string title;

    if(!CreateOperands(args, ops, 1))
        return false;

    if(GetSTROpValue(ops[0], title))
    {
        if (wndProg.hw!=NULL)
            InvalidateRect(wndProg.hw, NULL, FALSE);

        HINSTANCE hi = (HINSTANCE)GetModuleHandle("ODbgScript.dll");
        HWND hw = 0; //not modal but dialog need to be closed on plugin close.
        char* returned_buffer = (char*)DialogBoxParam(hi, MAKEINTRESOURCE(IDD_INPUT), hw, (DLGPROC) InputDialogProc, (LPARAM)title.c_str());
        if ((BYTE)returned_buffer != NULL)
        {
            string returned = returned_buffer;
            delete[256] returned_buffer;
            
            if(is_hex(returned)) 
            {
                variables["$RESULT"] = strtoul(returned.c_str(), 0, 16);
                variables["$RESULT_1"] = (int) (returned.length() / 2);            //size
            }
            else 
            {
                UnquoteString(returned, '"', '"'); // To Accept input like "FFF" (forces string)
                variables["$RESULT"] = returned.c_str();
                variables["$RESULT_1"] = (int) returned.length();
            }
        }
        else
        {    
            variables["$RESULT"] = 0; //****added this!!****
            Pause();
        }
        return true;
    }
    return false;
}

By doing that, if you leave the dialog box empty or press Cancel, it makes $RESULT 0 instead of empty as it used to..

Example:
ask "Enter text:" //here, when you press Cancel or don't type anything in, $RESULT = EMPTY..
cmp $RESULT,0
je #cancel
mov bla,$RESULT


Found another bug with ODbgScript.. When your variable holds addresses like B239E0, ODbgScript will fail to ASM them. Example:

eval "mov dword ptr [{GPA}],{cave}"
asm cave,$RESULT

For this case, with:

Command= eval "mov dword ptr [{GPA}],{cave}"
Result="mov dword ptr [A71074],B23A39"

Because of not putting a 0 in front of A71074, ODbgScript will error -> "unknown command".

Fixed here, in OllyLang.cpp:

[quote]else if(variables[op].vt == DW)
        {
            char buffer[12] = {0};
            if (hex8forExec)
                //For Assemble Command (EXEC/ENDE) ie "0DEADBEEF"
                sprintf(buffer, "%09X", variables[op].dw);
            else 
                sprintf(buffer, "%08X", variables[op].dw); //****changed from %X to %08X****
            value = buffer;
            goto values_ok;
        }

Now it should work fine;)

Script Execution, item 66
Line=66
Command= asm cave,$RESULT
Result=A
EIP= i
Values <---="mov dword ptr [00A71074],00B23A39" B23A01

[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

上传的附件:
收藏
免费 1
支持
分享
最新回复 (4)
雪    币: 716
活跃值: (162)
能力值: ( LV9,RANK:250 )
在线值:
发帖
回帖
粉丝
2
sunbeam have done a good job,greetz
2008-1-25 12:25
0
雪    币: 205
活跃值: (22)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
试用了一下,怎么不能运行原来的脚本呢,不知道别人有没有这种现象,是何原因。
2008-1-30 11:25
0
雪    币: 201
活跃值: (98)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
我到是没遇到这种情况
2008-2-2 10:14
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
东西就要收藏。谢谢
2008-2-2 15:09
0
游客
登录 | 注册 方可回帖
返回
//