#!/usr/bin/env python
import lief

libadd = lief.ELF.parse("./libadd.so")
binadd = lief.ELF.parse("./binadd.bin")

libadd_dynsym = libadd.dynamic_symbols
binadd_dynsym = binadd.dynamic_symbols

# Change add in the libary
for sym in libadd_dynsym:
    if sym.name == "add":
        sym.name = "abc"

# Change "add" in the binary
for sym in binadd_dynsym:
    if sym.name == "add":
        sym.name = "abc"


# change library name in the binary
for entry in binadd.dynamic_entries:
    if entry.tag == lief.ELF.NEEDED and entry.name == "libadd.so":
        entry.name = "libabc.so"


libadd.write("libabc.so");
binadd.write("binadd_obf.bin")



af42bdf2024d7c99c20399836b11fb22912e0257
<mask token>

<mask token>
for sym in libadd_dynsym:
    if sym.name == 'add':
        sym.name = 'abc'
for sym in binadd_dynsym:
    if sym.name == 'add':
        sym.name = 'abc'
for entry in binadd.dynamic_entries:
    if entry.tag == lief.ELF.NEEDED and entry.name == 'libadd.so':
        entry.name = 'libabc.so'
libadd.write('libabc.so')
binadd.write('binadd_obf.bin')

<mask token>
libadd = lief.ELF.parse('./libadd.so')
binadd = lief.ELF.parse('./binadd.bin')
libadd_dynsym = libadd.dynamic_symbols
binadd_dynsym = binadd.dynamic_symbols
for sym in libadd_dynsym:
    if sym.name == 'add':
        sym.name = 'abc'
for sym in binadd_dynsym:
    if sym.name == 'add':
        sym.name = 'abc'
for entry in binadd.dynamic_entries:
    if entry.tag == lief.ELF.NEEDED and entry.name == 'libadd.so':
        entry.name = 'libabc.so'
libadd.write('libabc.so')
binadd.write('binadd_obf.bin')

import lief
libadd = lief.ELF.parse('./libadd.so')
binadd = lief.ELF.parse('./binadd.bin')
libadd_dynsym = libadd.dynamic_symbols
binadd_dynsym = binadd.dynamic_symbols
for sym in libadd_dynsym:
    if sym.name == 'add':
        sym.name = 'abc'
for sym in binadd_dynsym:
    if sym.name == 'add':
        sym.name = 'abc'
for entry in binadd.dynamic_entries:
    if entry.tag == lief.ELF.NEEDED and entry.name == 'libadd.so':
        entry.name = 'libabc.so'
libadd.write('libabc.so')
binadd.write('binadd_obf.bin')

#!/usr/bin/env python
import lief

libadd = lief.ELF.parse("./libadd.so")
binadd = lief.ELF.parse("./binadd.bin")

libadd_dynsym = libadd.dynamic_symbols
binadd_dynsym = binadd.dynamic_symbols

# Change add in the libary
for sym in libadd_dynsym:
    if sym.name == "add":
        sym.name = "abc"

# Change "add" in the binary
for sym in binadd_dynsym:
    if sym.name == "add":
        sym.name = "abc"


# change library name in the binary
for entry in binadd.dynamic_entries:
    if entry.tag == lief.ELF.NEEDED and entry.name == "libadd.so":
        entry.name = "libabc.so"


libadd.write("libabc.so");
binadd.write("binadd_obf.bin")


