Advertisement
opexxx

dll_exports.py

Jun 13th, 2014
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. # grab the exports of a given dll
  4.  
  5. import pefile
  6. import sys
  7. import argparse
  8.  
  9.  
  10. def parse_dll(arg_dll):
  11.  
  12.     dll = pefile.PE(arg_dll)
  13.     for exp in dll.DIRECTORY_ENTRY_EXPORT.symbols:
  14.         print hex(dll.OPTIONAL_HEADER.ImageBase + exp.address), exp.name, exp.ordinal
  15.  
  16.  
  17. def __main__():
  18.  
  19.     parser = argparse.ArgumentParser(description='check the exports of a given dll', usage='%(prog)s -f file')
  20.     parser.add_argument('--file', '-f', dest='dll', help='dll to examine')
  21.     parser.add_argument('--version', '-v', action='version', version='%(prog)s 0.1')
  22.     args = parser.parse_args()
  23.     arg_dll = args.dll
  24.  
  25.     if not args.dll:
  26.         sys.exit(parser.print_help())
  27.  
  28.     try:
  29.         parse_dll(arg_dll)
  30.     except:
  31.         print "Error!! Something is wrong...call the police"
  32.  
  33. if __name__ == '__main__':
  34.     __main__()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement