about summary refs log tree commit diff stats
path: root/example/loader/get_exports.py
blob: 78b78f6f710d48ffcae9eb9395e8028424187e04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from argparse import ArgumentParser
from miasm.analysis.binary import Container
from miasm.core.locationdb import LocationDB
from miasm.jitter.loader.pe import get_export_name_addr_list


parser = ArgumentParser(description="Retrieve exported functions of a DLL")
parser.add_argument("filename",
                    help="DLL filename")
args = parser.parse_args()


fdesc = open(args.filename, 'rb')
loc_db = LocationDB()
cont = Container.from_stream(fdesc, loc_db)

exported_funcs = get_export_name_addr_list(cont.executable)

for name_or_ordinal, address in exported_funcs:
    print(name_or_ordinal, hex(address))