I recently set up Visual Studio Code and Python on my new laptop. Initially, I tried installing them on a separate external drive, but I ran into issues where VS Code couldn’t detect the installed Python version. After troubleshooting and consulting ChatGPT about potential complications with external installations, I decided to uninstall everything and reinstall them on the default internal drive for a smoother setup.
Conclusion:
This Python script uses the pynput
library to capture and log keyboard inputs to a file named keyfile.txt
. The keyPressed
function processes each key press, writing regular characters directly to the file and handling special keys like space and Enter with appropriate symbols. Non-character keys are logged within brackets. The script runs continuously, maintaining an active keyboard listener through listener.join()
, which keeps it responsive to user input until manually stopped. Error handling is included to manage potential issues with file operations or key processing. Overall, this setup provides a straightforward and effective method for monitoring and recording keyboard activity.
References:
A big shoutout to Shaun Halverson for the insightful video and commentary that guided me through building the keylogger. His detailed explanation was perfect. Additionally, I want to express my gratitude to the open-source communities and websites that helped me resolve issues with VS Code and Python installations. These resources played a big role in my setup process. I also appreciate the AI tools available today that make problem-solving and understanding technical challenges so much easier. Their support has been instrumental in navigating and mastering the complexities of coding and cybersecurity. Thank you to everyone who contributes to these resources and technologies!