认识一个解密算法
逆向工程
拆卸
恶意软件
解密
2021-06-25 20:45:16
1个回答
该函数解析PE头以定位IMAGE_EXPORT_DIRECTORY具有结构的
NumberOfNames包含此 PE 导出的符号数,位于偏移量0x18.
AddressOfNames是指向以空分隔的导出函数名称列表数组的指针。这位于 offset 0x20。
NumberOfNames它使用该值迭代导出的函数名称列表并计算每个的哈希值。
计算哈希的算法类似于。
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main()
{
// The name to hash
char name[] = "GetModuleFileNameA";
unsigned int hash = 0;
unsigned char ch, cl;
for (int i=0; i<strlen(name); i++)
{
ch = ((hash >> 8) & 0xFF) ^ name[i];
hash = (hash & 0xffff00ff) | (ch << 8);
hash = _rotl(hash, 8);
cl = (hash & 0xFF) ^ ((hash >> 8) & 0xFF);
hash = (hash & 0xFFFFFF00) | cl;
}
printf("%08X", hash);
}
如果计算出的hash匹配,则返回对应的API地址。
上面的代码计算的散列GetModuleFileNameA所出到416F346F。因此可以假设代码是正确的。
在这里查看:https : //rextester.com/NIBW6473
其它你可能感兴趣的问题

