def keyit(self):
self.hm = pyHook.HookManager()
self.hm.KeyDown = self.OnKeyBoardEvent
self.hm.HookKeyboard()
pythoncom.PumpMessages()
python类PumpMessages()的实例源码
def serve(clsids):
infos = factory.RegisterClassFactories(clsids)
pythoncom.EnableQuitMessage(win32api.GetCurrentThreadId())
pythoncom.CoResumeClassObjects()
pythoncom.PumpMessages()
factory.RevokeClassFactories( infos )
pythoncom.CoUninitialize()
def serve(clsids):
infos = factory.RegisterClassFactories(clsids)
pythoncom.EnableQuitMessage(win32api.GetCurrentThreadId())
pythoncom.CoResumeClassObjects()
pythoncom.PumpMessages()
factory.RevokeClassFactories( infos )
pythoncom.CoUninitialize()
def keylogger(self):
obj = pyHook.HookManager()
obj.KeyDown = self.keydown
obj.HookKeyboard()
obj.HookMouse()
pythoncom.PumpMessages()
def init():
hm = pyHook.HookManager()
hm.KeyDown = on_event
hm.HookKeyboard()
pythoncom.PumpMessages()
def serve(clsids):
infos = factory.RegisterClassFactories(clsids)
pythoncom.EnableQuitMessage(win32api.GetCurrentThreadId())
pythoncom.CoResumeClassObjects()
pythoncom.PumpMessages()
factory.RevokeClassFactories( infos )
pythoncom.CoUninitialize()
def serve(clsids):
infos = factory.RegisterClassFactories(clsids)
pythoncom.EnableQuitMessage(win32api.GetCurrentThreadId())
pythoncom.CoResumeClassObjects()
pythoncom.PumpMessages()
factory.RevokeClassFactories( infos )
pythoncom.CoUninitialize()
def StartKeyCapture(self):
self.hookManager = pyHook.HookManager()
self.hookManager.KeyDown = self.OnKeypressCallback
self.hookManager.HookKeyboard()
pythoncom.PumpMessages()
def hookslaunch():
print '[*] Starting keylogger'
a = Keylogger()
hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = a.OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()
def main():
# ??
hm = pyHook.HookManager()
# ?¼
hm.KeyDown = onKeyboardEvent
# ü??
hm.HookKeyboard()
# ¼
hm.MouseAll = onMouseEvent
# ??
hm.HookMouse()
# ??????????
pythoncom.PumpMessages()
def start(self):
"""Start pyhk to check for hotkeys"""
pythoncom.PumpMessages()
RecordScript.py 文件源码
项目:Automation-Framework-for-devices
作者: tok-gogogo
项目源码
文件源码
阅读 16
收藏 0
点赞 0
评论 0
def main():
global g_Recoder_Flag
global g_sys_Debug
global g_sys_timeget
global g_file_object
global g_telnet_ip
global g_file_path
Get_SystemParam()
g_telnet_ip = raw_input("please input the SecureCRT session Ip:")
g_file_path = raw_input("please save the records script Name:")
if g_file_path.find(':')<0:
g_file_path= find_parentpath() +'\\tmp_result\\'+g_file_path
if file_exist(g_file_path)==True:
os.remove(g_file_path)
# ??
print '............Please run SecureCRT sendkeys.............'
print 'F9 -- start telnet module '
print 'F10 -- stop telnet module'
print 'F11 -- temporary pause '
print 'F12 -- temporary continue '
print 'F8 -- Record program exit'
hm = pyHook.HookManager()
# ?¼
hm.KeyDown = onKeyboardEvent
# ü??
hm.HookKeyboard()
# ¼
hm.MouseAll = onMouseEvent
# ??
hm.HookMouse()
# ??????????
pythoncom.PumpMessages()
def main():
# Set a hook manager
hm = pyHook.HookManager()
# Monitor all keyboard events
hm.KeyDown = onKeyboardEvent
# Set a keyboard hook
hm.HookKeyboard()
# Keep monitoring
pythoncom.PumpMessages()
def Keylog(k, LOG_TIME, LOG_FILENAME):
# only supported for Windows at the moment...
if os.name != 'nt': return "Not supported for this operating system.\n"
global LOG_TEXT, LOG_FILE, LOG_STATE, LOG_ACTIVE, main_thread_id
LOG_STATE = True # begin logging!
main_thread_id = win32api.GetCurrentThreadId()
# add timestamp when it starts...
LOG_TEXT += "\n===================================================\n"
LOG_DATE = datetime.datetime.now()
LOG_TEXT += ' ' + str(LOG_DATE) + ' >>> Logging started.. |\n'
LOG_TEXT += "===================================================\n\n"
# find out which window is currently active!
w = win32gui
LOG_ACTIVE = w.GetWindowText (w.GetForegroundWindow())
LOG_DATE = datetime.datetime.now()
LOG_TEXT += "[*] Window activated. [" + str(LOG_DATE) + "] \n"
LOG_TEXT += "=" * len(LOG_ACTIVE) + "===\n"
LOG_TEXT += " " + LOG_ACTIVE + " |\n"
LOG_TEXT += "=" * len(LOG_ACTIVE) + "===\n\n"
if LOG_TIME > 0:
t = Timer(LOG_TIME, stopKeylog) # Quit
t.start()
# open file to write
LOG_FILE = open(LOG_FILENAME, 'w')
LOG_FILE.write(LOG_TEXT)
LOG_FILE.close()
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
pythoncom.PumpMessages() # this is where all the magic happens! ;)
# after finished, we add the timestamps at the end.
LOG_FILE = open(LOG_FILENAME, 'a')
LOG_TEXT += "\n\n===================================================\n"
LOG_DATE = datetime.datetime.now()
LOG_TEXT += " " + str(LOG_DATE) + ' >>> Logging finished. |\n'
LOG_TEXT += "===================================================\n"
LOG_STATE = False
try:
LOG_FILE.write(LOG_TEXT)
LOG_FILE.close()
except:
LOG_FILE.close()
return True
# this function stops the keylogger...
# thank God for the StackOverflow thread! :D