Last active
November 9, 2023 19:31
-
-
Save mhaskar/d784a0a193e78a0f46b76924154887c7 to your computer and use it in GitHub Desktop.
Find DLL function address using python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!usr/bin/python | |
''' | |
Description : find any windows function address from any DLL | |
Author : Askar @mohammadaskar2 | |
''' | |
from ctypes import windll | |
import sys | |
if len(sys.argv) != 3: | |
print "Usage: ./find_address.py dll function" | |
sys.exit(0) | |
dll_file_name = sys.argv[1] | |
function_name = sys.argv[2] | |
kernel32 = windll.kernel32 | |
h_kernel32 = kernel32.GetModuleHandleA(dll_file_name) | |
load_address = kernel32.GetProcAddress(h_kernel32, function_name) | |
print "[+]Process Address of %s.%s is %s" % (dll_file_name, function_name, hex(load_address)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment