9

前言

我正在尝试反汇编和反向工程一个作者早已不在的程序。该程序提供了一些我在其他地方还没有找到的独特功能,并且……我对该程序进行逆向工程感到好奇和感兴趣。如果你只是想帮我找到另一个程序……别打扰了。

问题

我正在使用带有 Hex-Rays Decompiler 的 IDA Pro 来获得一些不错的伪代码,以尝试加速逆向工程。我认为有助于加快速度的一件大事是弄清楚字符串的含义。到目前为止,这就是我发现的长度超过 4 个字符的字符串:

dword_131894E = 54264588;
dword_131894A = 51381002;
dword_1318946 = 51380998;
dword_1318942 = 52429571;
dword_131893E = 52298503;
runtimeVersion[0] = 836;
szIndex = 0;
do
{
  runtimeVersion[szIndex] = (runtimeVersion[szIndex] - 1) ^ (szIndex + 882) ^ 0x47;
  ++szIndex;
}
while ( szIndex < 11 );

通过查看三个字符的字符串的类似伪代码,并使用 Hex-Rays 悬停在类型信息上,我是这样理解的:

  • runtimeVersion 是一个常量 wchar
  • 这意味着它具有 Unicode 字符 (UTF-16)
  • 该字符串嵌入内存中,但在这种情况下,是弱加密的(XOR?)

上面的伪代码对于所有大字符串都是相同的,除了每个字符串的常量“882”不同。我假设这是某种编译时加密或宏,它一个一个地找到字符串并唯一地“加密”它们。但是,问题是,我似乎无法通过复制伪代码来获得正确的字符串。这是我在 C# 中的内容:

ushort[] newCharArray = new ushort[rawCharacters.Length];

// Go through and decode all of the characters.
ushort i = 0;
do {
    newCharArray[i] = (ushort)((i + 882) ^ (rawCharacters[i] - 1) ^ 0x47);
    ++i;
}
while (i < 11);

'rawCharacters' 是一个超短数组。我将每个 dword 条目分成两半,并将每个条目视为 ushort。我将它们从底部到顶部放在数组中...因此分配给 runtimeVersion[0] 的值首先添加到我的数组中,然后是来自 dword_131893E 的值,然后是 dword_1318942 等。

我不确定我在这里缺少什么。这似乎很简单,以至于反转和恢复字符串应该是小菜一碟,但我对从伪代码到实际代码的转换感到困惑。

想法?

4

1 回答 1

6

Ok working through on a piece of paper here's what i get:

54264588 = 0x033c030c
51381002 = 0x0310030a
51380998 = 0x03100306
52429571 = 0x03200303
52298503 = 0x031E0307
836 = 0x0344
882 = 0x0372

v = 0x0076 = 0x47 ^ 0x0372 ^ (0x0344 - 1)
2 = 0x0032 = 0x47 ^ 0x0373 ^ (0x0307 - 1)
. = 0x002E = 0x47 ^ 0x0374 ^ (0x031E - 1)
0 = 0x0030 = 0x47 ^ 0x0375 ^ (0x0303 - 1)
. = 0x0076 = 0x47 ^ 0x0376 ^ (0x0320 - 1)
5 = 0x0035 = 0x47 ^ 0x0377 ^ (0x0306 - 1)
0 = 0x0030 = 0x47 ^ 0x0378 ^ (0x0310 - 1)
7 = 0x0037 = 0x47 ^ 0x0379 ^ (0x030a - 1)
2 = 0x0032 = 0x47 ^ 0x037a ^ (0x0310 - 1)
7 = 0x0037 = 0x47 ^ 0x037b ^ (0x030c - 1)
\0 = 0x0000 = 0x47 ^ 0x037c ^ (0x033c - 1)

Therefore the string is "v2.0.50727" I also checked the other endian option but this one looks much better. So i know this doesn't point out where your code is wrong but it should help you solve it with a debugger/printf.

Edit: added last 7 to string.

于 2012-08-11T09:21:05.547 回答