这个和那个神人反编译出来的函数gpio_button_register的参数很像,应该有希望。
网上查了下ida需要有基地址才能识别字符串,所谓基地址,就是把固件加载到内存里的地址,也就是这个固件的地址0对应的内存里的地址,于是查到了这个工具拿来爆破基地址(https://github.com/sgayou/rbasefind)
0x: 220 0x: 167 0x: 112 0x: 85 0x24a30000: 72 0x: 55 0x8f: 45 0x8f: 42 0x8f95e000: 42 0x: 37

联想到elf结构里面符号表symtab和字符串表strtab的关系,strtab往往在elf的末尾段,symtab在中间,而且里面是一个表格,里面是一个结构体记录了函数地址和符号在strtab里面的偏移。
按照这个思路写idapython脚本重命名函数就可以了:
start_address=0x80144B2C while True: a=get_bytes(start_address,1) if a== b'\x80': print("good") create_dword(start_address) create_word(start_address-2) else: print("bad") print(hex(start_address)) break start_address=start_address-0x10 string_address=0x46158+0x-0x3744 #0x80142a14 table_start=0x80142A5C table_end=0x80144B2C while True: func_addr=int.from_bytes(get_bytes(table_start,4),"big") idx=int.from_bytes(get_bytes(table_start+14,2),"big")+string_address func_name=get_strlit_contents(idx) print(get_name(func_addr)+" "+func_name.decode()) set_name(func_addr,func_name.decode()) if table_start ==table_end: break table_start=table_start+0x10
参考文章:
- [分享]一次嵌入式固件逆向实践 看雪论坛 https://bbs.pediy.com/thread-266803.html
- IoT漏洞研究(一)固件基础 freebuf
https://www.freebuf.com/articles/endpoint/254257.html
- https://paper.seebug.org/613/
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/218835.html原文链接:https://javaforall.net
