Python ctypes.wintypes.LPCVOID Examples
The following are 4
code examples of ctypes.wintypes.LPCVOID().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ctypes.wintypes
, or try the search function
.
Example #1
Source File: driverlib.py From win_driver_plugin with BSD 3-Clause "New" or "Revised" License | 6 votes |
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
Example #2
Source File: win.py From gd.py with MIT License | 5 votes |
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
Example #3
Source File: win.py From gd.py with MIT License | 5 votes |
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
Example #4
Source File: shellDev.py From shellDev.py with GNU General Public License v3.0 | 5 votes |
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.') # -------------------------------------------------- #