今天是2023年1月1日,新年第一天,祝大家新年快乐,身体健康,幸福如意!
这篇文章接上一篇《阳生记三:GhidraThon》,系它的姐妹篇,Ghidra的ChatGPT插件,这个网上的过程介绍基本没有,有一定的繁琐难度,我也是费了不少劲才搞定的,作为新年礼物奉献给大家。
ChatGPT for Ghidra的插件来源于:https://github.com/evyatar9/GptHidra。官方给出的解释是:GptHidra is a Ghidra plugin that uses the OpenAI Chat GPT to explain functions. 我们的目标是在Ghidra引入OpenAI来识别函数。
做法:将这个插件Py放入到ghidra_scripts目录下。
这个py下载下来后,有些问题,我们要作如下修改:
1、将import urllib2修改成 import urllib.request
2、将所有urllib2全部替换成urllib.request
3、将urllib.request.Request(url, data, 替换成urllib.request.Request(url, data.encode('utf-8'),
4、加入api-key,就是你在chat.openai.com中注册后生成的一个key;
=========================
5、启动上篇中的Ghidra;
6、选中一段函数代码:
7、运行:
8、给出答案:
GptHidra.py> Running...
This is a library function written in the C programming language for allocating memory from the heap. It takes a parameter of type __uint64 (which typically represents an unsigned 8-byte integer) and then attempts to allocate that amount of memory from the heap. If the allocation is successful, the pointer to that memory is returned. If it fails, it calls the _callnewh internal function and checks the return value. If the _callnewh function fails, it calls either FUN_1400010e4 or FUN_14000edac depending on the value of the parameter, and then calls the swi function with an argument of 3 to determine what to do next.
GptHidra.py> Finished!