1 概述
最近在學習逆向的過程中,有時候IDA 的使用還是有不少技巧的,因爲用的少,極其容易忘記,因此寫一篇文章在此記錄一下
1、反編譯重構結構體
2、反編譯重構數組
2 IDA使用技巧
2.1 重構結構體
參考文章:IDA-Pro反彙編數據結構定義與導入操作
上面這個小哥,筆記做的非常充分,非常贊,值得關注學習
2.1.1 案例
#include <stdio.h>
#include <string.h>
struct Student
{
char name[20];
int age;
int score;
};
int main(char argc, char* argv[]) {
struct Student stu[3];
for (int i = 0; i < 3; ++i)
{
printf("請輸入第%d個學生的信息:", i+1);
scanf ("%s %d %d", stu[i].name, &stu[i].age, &stu[i].score);
}
struct Student stumax = stu[0];
for (int j=1; j<3; ++j)
{
if (stumax.score < stu[j].score)
{
stumax = stu[j];
}
}
printf("BestScore name:%s age: %d score:%d\n", stumax.name, stumax.age, stumax.score);
return 0;
}
2.1.2 反編譯結果
注意看上面的反編譯結果,大部分反編譯之後,類似的這種情況都是結構體
v11 + 28 + i
v11 + 28 + i + 20
v11 + 28 + i + 24
根據scanf的內容,推算和指針的偏移(真正在實際的程序中,會比較複雜,有時候要反覆計算),推算,第一個是字符串(20個字節),後面兩個是int型
採用上面參考博客中,比較簡單的方法:
接下來按insert鍵
然後就出現了這個:
通過設置這個東西,就出現了
2.2 數組定義
如果在反編譯的代碼,發現這種東西,同樣的類型存在很多個,並且有大片的內存,並且什麼for循環等一類的,就多半是個數組。
通過在雙擊進去右鍵選擇array,這個數字需要根據經驗去猜,比如for循環的次數,內存的大小等
然後就發現了數組了