When using LIEF to modify ELF format files, I successfully added another sample library using the add_library function. However, after using build or directly write, the resulting new file does not contain this library. Why is that?
random_library = random.choice(benign_libraries)
print(random_library)
print(target_binary.libraries)
lowerlibname = random_library.lower()
lib = None
for im in target_binary.libraries:
if im == lowerlibname:
lib = im
break
if lib is None:
# add a new library
target_binary.add_library(random_library)
print(target_binary.libraries)
builder = lief.ELF.Builder(target_binary)
builder.build() # perform the build process
# return bytestring
return array.array('B', builder.get_build()).tobytes()
When using LIEF to modify ELF format files, I successfully added another sample library using the add_library function. However, after using build or directly write, the resulting new file does not contain this library. Why is that?
version: 0.12.3 and 0.14.1