Upload files to "/"
This commit is contained in:
@@ -70,21 +70,23 @@ def export_local_types_for_struct():
|
||||
except Exception as msg:
|
||||
mylog("export_local_types_for_struct",msg)
|
||||
|
||||
def export_local_types(save_file):
|
||||
def export_local_types(save_file,flags):
|
||||
|
||||
struct_list=export_local_types_for_struct()#返回字典列表
|
||||
if(struct_list is None):return
|
||||
if flags==0:
|
||||
# # 将结构体信息转换为 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:
|
||||
filepath=save_file+"_Estruct.json"
|
||||
with open(filepath,"w") as f:
|
||||
f.write(json_output)
|
||||
else :
|
||||
# 字符串存储
|
||||
# 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")
|
||||
filepath=save_file+"_Estruct.txt"
|
||||
with open(filepath,"w") as f:
|
||||
for i in struct_list:
|
||||
f.write(f"[{i['name']}:struct_size {i['size']} -> {i['info']}]\n")
|
||||
|
||||
#函数黑名单
|
||||
BLACK_LIST={
|
||||
@@ -97,9 +99,11 @@ STRUCT_BACKLIST={
|
||||
"Elf64_Sym","Elf64_Rela","Elf64_Dyn","Elf64_Verneed","Elf64_Vernaux"
|
||||
}
|
||||
def main():
|
||||
save_dir="result"
|
||||
extractfile="extract.c"
|
||||
save_dir="../input"
|
||||
extractfile="extractelf"
|
||||
filepath="tmp.txt"
|
||||
try:
|
||||
if(not os.path.exists(save_dir)):os.makedirs(save_dir)
|
||||
if (os.path.exists(filepath) and os.path.isfile(filepath) ):
|
||||
with open(filepath,"r") as f:
|
||||
extractfile=f.read()
|
||||
@@ -107,7 +111,9 @@ def main():
|
||||
extractfile=os.path.join(save_dir,extractfile)
|
||||
|
||||
export_func(extractfile)
|
||||
export_local_types(extractfile)
|
||||
export_local_types(extractfile,0)
|
||||
except Exception as msg:
|
||||
mylog("main",msg)
|
||||
|
||||
if __name__ == "__main__":
|
||||
try :
|
||||
|
||||
Reference in New Issue
Block a user