프로그래밍/Python
Python GetProcAddress
즉흥
2017. 2. 23. 18:37
728x90
반응형
1 2 3 4 5 6 7 8 9 10 11 12 13 | import sys from ctypes import * import ctypes def usage(): print "\n Usage : %s [dll] [proc]" % sys.argv[0] sys.exit() target_dll = "kernel32.dll" target_function = "WinExec" dll = windll.LoadLibrary(target_dll) kernel32 = windll.LoadLibrary("kernel32.dll") function = kernel32.GetProcAddress(c_ulonglong(dll._handle), b"WinExec") print "[##] Find Address : %s(%s) : 0x%08x" % (target_dll, target_function, function) | cs |
책 보고 공부중인데 Python 64bit에서 dll.GetProcAddress() 함수를 Python 32bit 처럼 사용하지 못한다.
아래의 링크를 참고하여 c_ulonglong() 함수를 사용하니 성공.
http://www.sysnet.pe.kr/Default.aspx?mode=2&sub=0&detail=1&pageno=0&wid=1345&rssMode=1&wtype=0
728x90
반응형