#!/usr/bin/env python import sys def parseExports(name): # dumpbin a.dll /exports B_started = False B_stopped = False with open(name, "r") as f: for line in f.readlines(): if not B_started: if line.strip().startswith("ordinal hint"): B_started = True elif line.strip() == "Summary": B_stopped = True else: if not B_stopped: if line.find("[NONAME]") > -1: continue if (line.find("(forwarded to ") != -1): line = line.split("(forwarded to ", 2)[0] parts = line.strip().split("=")[0].strip().replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").split(" ") name = parts[-1] if name != "[NONAME]" and name.strip() != "": yield name # of MSVC dumpbin /exports for name in parseExports(sys.argv[1]): print(name)