Upload files to "/"
This commit is contained in:
@@ -53,7 +53,7 @@ def export_local_types_for_struct():
|
||||
type_name = get_numbered_type_name(i) # 获取类型名称
|
||||
if(type_name is None):return type_list
|
||||
type_data=get_numbered_type(None,i) #获取类型
|
||||
mylog("export_local_types_for_struct",type_name)
|
||||
#mylog("export_local_types_for_struct",type_name)
|
||||
if not type_data or type_data[1] is None :continue #[1]判断是否为普通类型,普通类型[1]为None
|
||||
tinfo = tinfo_t()
|
||||
# 调用 deserialize序列化
|
||||
@@ -71,14 +71,21 @@ def export_local_types_for_struct():
|
||||
mylog("export_local_types_for_struct",msg)
|
||||
|
||||
def export_local_types(save_file):
|
||||
save_file=save_file+"_Estruct.json"
|
||||
|
||||
struct_list=export_local_types_for_struct()#返回字典列表
|
||||
if(struct_list is None):return
|
||||
# 将结构体信息转换为 JSON 格式
|
||||
# # 将结构体信息转换为 JSON 格式
|
||||
json_output = json.dumps(struct_list, indent=4)
|
||||
#print(json_output)
|
||||
save_file=save_file+"_Estruct.json"
|
||||
with open(save_file,"w") as f:
|
||||
f.write(json_output)
|
||||
# 字符串存储
|
||||
# save_file=save_file+"_Estruct.txt"
|
||||
# with open(save_file,"w") as f:
|
||||
# for i in struct_list:
|
||||
# f.write(f"[{i['name']}:struct_size {i['size']} -> {i['info']}]\n")
|
||||
|
||||
#函数黑名单
|
||||
BLACK_LIST={
|
||||
"_start","_dl_relocate_static_pie",
|
||||
@@ -96,7 +103,9 @@ def main():
|
||||
if (os.path.exists(filepath) and os.path.isfile(filepath) ):
|
||||
with open(filepath,"r") as f:
|
||||
extractfile=f.read()
|
||||
extractfile=extractfile.split("/")[-1]
|
||||
extractfile=os.path.join(save_dir,extractfile)
|
||||
|
||||
export_func(extractfile)
|
||||
export_local_types(extractfile)
|
||||
|
||||
|
||||
6
test.py
6
test.py
@@ -20,7 +20,6 @@ def Extract_Functions(idat64_path,file): #提取伪代码
|
||||
f.write(file)
|
||||
|
||||
subprocess.run(cmd,shell=True,check=True,text=True,capture_output=True) #bash执行idat64命令
|
||||
|
||||
os.remove("tmp.txt")
|
||||
|
||||
new_time=time.time()
|
||||
@@ -31,7 +30,7 @@ def Extract_Functions(idat64_path,file): #提取伪代码
|
||||
except Exception as error:
|
||||
print(f"{RED}error-> {error}{RESET}")
|
||||
with open("my.log","a+") as f:
|
||||
f.write(f"Extract_Functions {file}-> {error}")
|
||||
f.write(f"Extract_Functions {file}-> {error}\n")
|
||||
exit(-1)
|
||||
def help():
|
||||
help_msg='''python test.py -e idat64_path file <Extract_Functions>
|
||||
@@ -53,8 +52,5 @@ def main():
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user