本文整理汇总了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.')
# -------------------------------------------------- #