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) # 获取类型名称
|
type_name = get_numbered_type_name(i) # 获取类型名称
|
||||||
if(type_name is None):return type_list
|
if(type_name is None):return type_list
|
||||||
type_data=get_numbered_type(None,i) #获取类型
|
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
|
if not type_data or type_data[1] is None :continue #[1]判断是否为普通类型,普通类型[1]为None
|
||||||
tinfo = tinfo_t()
|
tinfo = tinfo_t()
|
||||||
# 调用 deserialize序列化
|
# 调用 deserialize序列化
|
||||||
@@ -71,14 +71,21 @@ def export_local_types_for_struct():
|
|||||||
mylog("export_local_types_for_struct",msg)
|
mylog("export_local_types_for_struct",msg)
|
||||||
|
|
||||||
def export_local_types(save_file):
|
def export_local_types(save_file):
|
||||||
save_file=save_file+"_Estruct.json"
|
|
||||||
struct_list=export_local_types_for_struct()#返回字典列表
|
struct_list=export_local_types_for_struct()#返回字典列表
|
||||||
if(struct_list is None):return
|
if(struct_list is None):return
|
||||||
# 将结构体信息转换为 JSON 格式
|
# # 将结构体信息转换为 JSON 格式
|
||||||
json_output = json.dumps(struct_list, indent=4)
|
json_output = json.dumps(struct_list, indent=4)
|
||||||
#print(json_output)
|
#print(json_output)
|
||||||
|
save_file=save_file+"_Estruct.json"
|
||||||
with open(save_file,"w") as f:
|
with open(save_file,"w") as f:
|
||||||
f.write(json_output)
|
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={
|
BLACK_LIST={
|
||||||
"_start","_dl_relocate_static_pie",
|
"_start","_dl_relocate_static_pie",
|
||||||
@@ -95,8 +102,10 @@ def main():
|
|||||||
filepath="tmp.txt"
|
filepath="tmp.txt"
|
||||||
if (os.path.exists(filepath) and os.path.isfile(filepath) ):
|
if (os.path.exists(filepath) and os.path.isfile(filepath) ):
|
||||||
with open(filepath,"r") as f:
|
with open(filepath,"r") as f:
|
||||||
extractfile=f.read()
|
extractfile=f.read()
|
||||||
|
extractfile=extractfile.split("/")[-1]
|
||||||
extractfile=os.path.join(save_dir,extractfile)
|
extractfile=os.path.join(save_dir,extractfile)
|
||||||
|
|
||||||
export_func(extractfile)
|
export_func(extractfile)
|
||||||
export_local_types(extractfile)
|
export_local_types(extractfile)
|
||||||
|
|
||||||
@@ -107,4 +116,4 @@ if __name__ == "__main__":
|
|||||||
main()
|
main()
|
||||||
except AssertionError as msg:
|
except AssertionError as msg:
|
||||||
mylog("__main__",msg)
|
mylog("__main__",msg)
|
||||||
qexit(0)
|
qexit(0)
|
||||||
|
|||||||
10
test.py
10
test.py
@@ -20,9 +20,8 @@ def Extract_Functions(idat64_path,file): #提取伪代码
|
|||||||
f.write(file)
|
f.write(file)
|
||||||
|
|
||||||
subprocess.run(cmd,shell=True,check=True,text=True,capture_output=True) #bash执行idat64命令
|
subprocess.run(cmd,shell=True,check=True,text=True,capture_output=True) #bash执行idat64命令
|
||||||
|
|
||||||
os.remove("tmp.txt")
|
os.remove("tmp.txt")
|
||||||
|
|
||||||
new_time=time.time()
|
new_time=time.time()
|
||||||
run_tim=new_time-old_time
|
run_tim=new_time-old_time
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ def Extract_Functions(idat64_path,file): #提取伪代码
|
|||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(f"{RED}error-> {error}{RESET}")
|
print(f"{RED}error-> {error}{RESET}")
|
||||||
with open("my.log","a+") as f:
|
with open("my.log","a+") as f:
|
||||||
f.write(f"Extract_Functions {file}-> {error}")
|
f.write(f"Extract_Functions {file}-> {error}\n")
|
||||||
exit(-1)
|
exit(-1)
|
||||||
def help():
|
def help():
|
||||||
help_msg='''python test.py -e idat64_path file <Extract_Functions>
|
help_msg='''python test.py -e idat64_path file <Extract_Functions>
|
||||||
@@ -50,10 +49,7 @@ def main():
|
|||||||
idat64_path=sys.argv[2]
|
idat64_path=sys.argv[2]
|
||||||
file=sys.argv[3]
|
file=sys.argv[3]
|
||||||
Extract_Functions(idat64_path,file)
|
Extract_Functions(idat64_path,file)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user