Skip to main content

Python Keylogger: Spy Program Made Easy!




Ever wanted to spy on your friend's laptop/computer? Want to get hold of that Netflix password? You are in luck buddy! We present to you, the mighty Keylogger program using Python

You may be wondering: What is a Keylogger? And how can I use it to spy on my friends? Here's all you need to know: The Keylogger is a program that runs in the background without interrupting your work, and monitors your keyboard, recording each key stroke (that is, every time you press a key) in a logfile. By accessing this Logfile, you would hit the Jackpot.

With this program running on someone's laptop/computer, you can get hold of usernames and passwords that they enter, with the user unaware that the information is being recorded.

Beware! Data Theft is a serious offence. We will not take responsibility for any mishap that can be caused by this program. This program is shared solely for the purpose of entertainment.





So what are we waiting for? Let's jump right in! And don't forget to get the source code from the download link given at the end!

Required Libraries

We will require pynput library, which you can install using pip. We will be working specifically with the Listener method of the pynput.keyboard module, which will detect all interactions with the keyboard. We need the logging library to log the keys in the file. Apart from these, we also require os to get the directory for storing logfile, and datetime for logging the time at which a key is pressed.

The Code

As always, importing our libraries before we get on with the actual coding:


Getting the directory and setting the configuration (directory, mode, format) for the logfile:


We then define our own function key_handler(key) with key as the parameter. Here, key is the pressed key which will be detected by Listener. This function then records the information along with the time from datetime to the logfile:


We now initiate the Listener module, with its parameter on_press calling our defined function key_handler(key),  and finally joining this entire instance (of recording a single key) to the main thread, as follows:


With this, our Keylogger program is ready to enter service! As you can see, the entire program is just a couple of lines, but it serves the purpose full and square.

The Working

On running the program, you may minimize the IDLE window, and type anything anywhere, like for example, on chrome.

After you type to your heart's wish, go to the same directory, where this python program is stored, and you will see the text document mylog (the name is set using the logging.basicConfig(), discussed in the previous section.

This is how the logfile looks:


Additionally, we can also make a program to simplify the information by grouping the information to form sentences across different time intervals. That's up to you!

And there you have it! All you have to do now is to start this program in the system you want to spy on. You could do that manually or by sending the executable program via email as .exe file (which is highly unlikely to work, as windows and anti-viruses usually block these).

Here's the promised download link for the source code: Download Python File

Credits to Mihir Trivedi for Source code of this project.


Comments

Popular posts from this blog

Simple Omegle Bot Using Selenium With Python

Omegle is an online text-based and video-based chatting platform, which allows users from around the world to talk to complete strangers anonymously, for free! The text-based Omegle has a simple concept: Complete a Captcha  verification, connect automatically to a stranger, and after chatting get on to the next stranger. Apart from having a chit-chat with a stranger from the far side of the globe, Omegle poses as the perfect platform for other uses as well. At Omegle, you  can advertise your content, website, products and more for free. With access to about 40,000 strangers using Omegle at any given time, you can benefit if your ideas/advertisement is seen by potential customers. But of course, we can't advertise to each guy we meet again and again. I mean, come on, that's a lot of hard work, even if your message consists of a few words. But worry not, since that's where our Omegle Bot  comes in play. This bot works on a pre-determined set of messages that are to be conveye

Predicting Stock Prices using Machine Learning (XGBoost)

  Today, I'll show you how to create a machine learning program to predict stock prices. Machine learning is used in a variety of fields, and we can utilize its ability to learn and predict from data to predict useful variables, with minimal error. Therefore in theory, we can apply the same on stocks to predict the next closing price, so that we can make a killing gain. However, stock markets are highly unstable. Their price movement often depends on decisions taken by the company, favor and reaction of investors, social impact, human emotions, and price movements of some other related stocks. These types of data cannot be made available to a program. The prediction can be close only if the market remains relatively stable. You don't actually need to learn machine learning using python to understand how this program works, if not minimal. I'll describe each machine learning process. And don't forget to download the source code of this program, link provided at the end.

English Dictionary With Python And Tkinter!

English Dictionary on Python Have you ever tried to read from the small Oxford Dictionaries? Those small yet bulky books have thousands of words cramped on a page the length of your finger! And on top of that, not to forget the hassle of flipping across the pages, searching for your word, God knows where is hiding on which page! Nowadays though, hardly does anyone ever use the classic dictionaries. With the access of technology on our fingertips, one tap on Google, and you would be on with your way.  But how about making a program of your own which can do the same for you? Sounds interesting? Such a program can enable you to run it and keep it opened, while you are reading a book, so that you can search the definition of a new word you encountered. What if you are writing a book, perhaps a report? You know what you are supposed to write, but you choose to get a word for it, so that you sound professional. So you just search for a short definition and the program find the word with matc