Project Report

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Project Report on

OTP VALIDATION
Manoj Konda

Under esteemed guidance of

Ms. Ashwairya Saxena

(Mini Python Project)


INTRODUCTION

Security and Privacy are most important for an Individual in this Software domain. So, we
should give access to only the authorised individual. Authentication is necessary. That’s how
OTP(one time password) helps . It is a fixed length of random number generated and sent to
the individual for verification , he/she enters OTP for verification.

This Project describes a method of generating a 6 digit OTP and send it to the email for giving
access to authorised individuals. The proposed method guarantees that authenticating to
services, such as Online Banking, ATM Machines, Email verification, Account verifications.
The Proposed method involves :
1. OTP generation (6 digit)
2. Send OTP to respective emails
3. OTP validation (only 3 attempts )
4. Send Verification gmail
OBJECTIVE

OTP exists to prevent unauthorized access. Companies should ensure that unauthorized
access is not allowed and also authorized users cannot make unnecessary modifications. The
controls exist in a variety of forms, from Identification Badges and passwords to access
authentication protocols and security measures.

This project enables us to generate 6 digit otp for verification to prevent Unauthorised access.
BACKGROUND
HARDWARE AND SOFTWARE REQUIREMENTS

1) Software requirements:
● Python 3
● Any IDE

2) Libraries Used :
● smtplib - for sending email
● random - to generate 6digit random number
● MIMEtext
● MIMEMultipart

3) Hardware Requirements:
● A system with 4GB RAM, (any System which supports Python IDE )
CODING

import string
import random
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from getpass import getpass

# OTP Generation
OTP = "".join([random.choice(string.digits) for i in range(6)])

# creating mail content


sub = "OTP Validation "
body = """
This OTP is Sent as a part of small python project
Don't Worry
Enter This OTP
""" + OTP
msg = MIMEMultipart()
msg["Subject"] = sub
msg.attach(MIMEText(body, "plain"))
message = msg.as_string()

# sender email and password check


smtp_server = "smtp.gmail.com"
port = 587 # For starttls (security)
sender_email = "jackyspirrel@gmail.com" # This is my email enter your email here

password = "********" # Enter Your email password here

server = smtplib.SMTP(smtp_server, port)


server.starttls()
# login check of sender
server.login(sender_email, password)
receiver_email = input("Enter Your Email : ")
# sending email with OTP
server.sendmail(sender_email, receiver_email, message)

print("Otp Sent to your Email please Check your email")

# OTP validation
def authenticate():
i = input("\n\nEnter your Otp : ")
if i == OTP:
print("OTP verified Successfully")
else:
for k in range(3):
print("Invalid OTP\nYou have {} attempts left ".format(3 - k))
i = input("Enter your OTP again:")
if i == OTP:
print("OTP verified Successfully")
break
if k == 2 and i != OTP:
print("Reached Maximum Attempts")

authenticate()

# Content for another email


subb = "OTP Verified " + u'\u263A'
bod = """
OTP Verified Successfully
Thank You \u263A
"""
m = MIMEMultipart()
m["Subject"] = subb
m.attach(MIMEText(bod, "plain"))
mes = m.as_string()

server.sendmail(sender_email, receiver_email, mes)


OUTPUT SCREENSHOTS
1) This method asks user for his/her gmail address to send OTP via respective gmail.

2) This is how email is sent with OTP to the user.


3) User should enter OTP
If he enters the wrong OTP system gives you 3 chances . If the user fails to give the correct OTP program
terminates. If OTP entered is correct then it sends email with message that he/she is verified.
4) Email is sent again stating that the user is verified.

FUTURE SCOPE

Software Technologies are trending now. And I bet it will be trending forever. So, Many programs like Online
Banking system, Gmail Accounts, Netflix Accounts, E-commerce accounts, etc., will be having many and many
users . So User’s security is in trouble only he should be having access to his accounts . Passwords may
sometimes not be the perfect solution for unauthorized access. So, OTP validation will be giving access to
only Authorised persons. This will be included in every software to keep the User account and his details safe.

CONCLUSION

This Project prevents Unauthorised access. OTP validation system secures one's account for his privacy.

REFERENCES

● I referred to this website for sending Emails. (https://realpython.com/python-send-email/)

You might also like