@@ -94,19 +94,19 @@ def parse_relro(parsed_obj):
94
94
now = False
95
95
try :
96
96
parsed_obj .get (lief .ELF .SEGMENT_TYPES .GNU_RELRO )
97
- except lief .not_found :
97
+ except lief .lief_errors . not_found :
98
98
return "no"
99
99
try :
100
100
dynamic_tags = parsed_obj .get (lief .ELF .DYNAMIC_TAGS .FLAGS )
101
101
if dynamic_tags :
102
102
bind_now = lief .ELF .DYNAMIC_FLAGS .BIND_NOW in dynamic_tags
103
- except lief .not_found :
103
+ except lief .lief_errors . not_found :
104
104
pass
105
105
try :
106
106
dynamic_tags = parsed_obj .get (lief .ELF .DYNAMIC_TAGS .FLAGS_1 )
107
107
if dynamic_tags :
108
108
now = lief .ELF .DYNAMIC_FLAGS_1 .NOW in dynamic_tags
109
- except lief .not_found :
109
+ except lief .lief_errors . not_found :
110
110
pass
111
111
if bind_now or now :
112
112
return "full"
@@ -597,19 +597,19 @@ def parse(exe_file):
597
597
if parsed_obj .get_symbol (section ):
598
598
metadata ["has_canary" ] = True
599
599
break
600
- except lief .not_found :
600
+ except lief .lief_errors . not_found :
601
601
metadata ["has_canary" ] = False
602
602
# rpath check
603
603
try :
604
604
if parsed_obj .get (lief .ELF .DYNAMIC_TAGS .RPATH ):
605
605
metadata ["has_rpath" ] = True
606
- except lief .not_found :
606
+ except lief .lief_errors . not_found :
607
607
metadata ["has_rpath" ] = False
608
608
# runpath check
609
609
try :
610
610
if parsed_obj .get (lief .ELF .DYNAMIC_TAGS .RUNPATH ):
611
611
metadata ["has_runpath" ] = True
612
- except lief .not_found :
612
+ except lief .lief_errors . not_found :
613
613
metadata ["has_runpath" ] = False
614
614
static_symbols = parsed_obj .static_symbols
615
615
if len (static_symbols ):
@@ -762,9 +762,7 @@ def parse(exe_file):
762
762
metadata ["subsystem" ] = str (optional_header .subsystem ).rsplit (
763
763
"." , maxsplit = 1
764
764
)[- 1 ]
765
- metadata ["is_gui" ] = (
766
- True if metadata ["subsystem" ] == "WINDOWS_GUI" else False
767
- )
765
+ metadata ["is_gui" ] = metadata ["subsystem" ] == "WINDOWS_GUI"
768
766
metadata ["exe_type" ] = (
769
767
"PE32"
770
768
if optional_header .magic == PE .PE_TYPE .PE32
@@ -1038,7 +1036,7 @@ def parse(exe_file):
1038
1036
metadata ["has_main_command" ] = True
1039
1037
if parsed_obj .thread_command :
1040
1038
metadata ["has_thread_command" ] = True
1041
- except lief .not_found :
1039
+ except lief .lief_errors . not_found :
1042
1040
metadata ["has_main" ] = False
1043
1041
metadata ["has_thread_command" ] = False
1044
1042
try :
@@ -1116,12 +1114,12 @@ def parse_dex(dex_file):
1116
1114
dexfile_obj = DEX .parse (dex_file )
1117
1115
metadata ["version" ] = dexfile_obj .version
1118
1116
metadata ["header" ] = dexfile_obj .header
1119
- metadata ["classes" ] = dexfile_obj .classes
1120
- metadata ["fields" ] = dexfile_obj .fields
1121
- metadata ["methods" ] = dexfile_obj .methods
1122
- metadata ["strings" ] = dexfile_obj .strings
1123
- metadata ["types" ] = dexfile_obj .types
1124
- metadata ["prototypes" ] = dexfile_obj .prototypes
1117
+ metadata ["classes" ] = [ cls for cls in dexfile_obj .classes ]
1118
+ metadata ["fields" ] = [ f for f in dexfile_obj .fields ]
1119
+ metadata ["methods" ] = [ m for m in dexfile_obj .methods ]
1120
+ metadata ["strings" ] = list ( dexfile_obj .strings )
1121
+ metadata ["types" ] = [ t for t in dexfile_obj .types ]
1122
+ metadata ["prototypes" ] = [ p for p in dexfile_obj .prototypes ]
1125
1123
metadata ["map" ] = dexfile_obj .map
1126
1124
except Exception as e :
1127
1125
LOG .exception (e )
0 commit comments