0% found this document useful (0 votes)
98 views

MSBTE CAMPUS Python Micro Project Report

The document describes a Python project to create a CAPTCHA generator. It generates random strings to display as images and tests user input against the string. The program uses modules like string, random, tkinter, PIL and captcha to generate random strings as images and verify user input against the string.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views

MSBTE CAMPUS Python Micro Project Report

The document describes a Python project to create a CAPTCHA generator. It generates random strings to display as images and tests user input against the string. The program uses modules like string, random, tkinter, PIL and captcha to generate random strings as images and verify user input against the string.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

CAPTCHA GENRATOR

PYTHON PROJECT REPORT

Submitted by
1.Vishnu Kubal 2. Om Shirodkar 3. Suryapratap Singh 4. Abhishek Sonkawade

In partial fulfilment for the award of the degree of University

of Mumbai

For the degree of Bachelor of


Engineering

CSE(IOT)

Under the guidance of


PROF. RISHIKESH YADAV
CERTIFICATE

Certified that the mini-project work entitled “CAPTCHA GENRATOR” is a bona-


fide work carried out by

1)Vishnu Kubal (31)


2)Om Shirodkar (58)
3)Suryapratap Singh (62)
4)Abhishek Sonkawade(63)

The report has been approved as it satisfies the academic requirements in


respect of mini-project work prescribed for the course.

PROF.RISHIKESH YADAV PROF.RISHIKESH YADAV


Mini-Project Coordinator Mini-Project Guide

PROF.SONALI DESHPANDE
Head of the Department
Aim - To create a CAPTCHA GENRATOR.

Problem statement - In order to make DDoS attacks less harmfull CAPTCHA is


used as legitimate users are able to pass it, while attacking computers cannot.

Concept - This project makes use of modules like String,Random which genrate a
Ramdom string this genrated string displyed in GUI as a image and then the user
is demanded to put an input, the input is then crossverified with the String.If the
user input maches with the genrated string Statment "CORRECT" is displayed if
not then "INCORRECT" is displayed.

Software used - VS code / pycharm, python3.9


PROGRAM:

import random
import string
from tkinter import Tk, Label, Entry, Button, END
from PIL import ImageTk, Image
from captcha.image import ImageCaptcha
def createImage(flag=0):
global random_string
global image_label
global image_display
global entry
global verify_label
if flag == 1:
verify_label.grid_forget()
entry.delete(0, END)
random_string = ''.join(random.choices(string.ascii_letters + string.digits, k=6))
image_captcha = ImageCaptcha(width=250, height=125)
image_generated = image_captcha.generate(random_string)
image_display = ImageTk.PhotoImage(Image.open(image_generated))
image_label.grid_forget()
image_label = Label(root, image=image_display)
image_label.grid(row=1, column=0, columnspan=2,
padx=10)
def check(x, y):
global verify_label
verify_label.grid_forget()
if x.lower() == y.lower():
verify_label = Label(master=root,
text="Correct",
font="Arial 15",
bg='#00ff00',
fg="#ffffff"
)
verify_label.grid(row=0, column=0, columnspan=2, pady=10)
else:
verify_label = Label(master=root,
text="Incorrect!",
font="Arial 15",
bg='#ff0000',
fg="#ffffff"
)
verify_label.grid(row=0, column=0, columnspan=2, pady=10)
createImage()
if __name__ == "__main__":
root = Tk()
root.title('Simple Captcha Generator')
verify_label = Label(root)
image_label = Label(root)
entry = Entry(root, width=10, borderwidth=5,
font="Arial 15", justify="center")
entry.grid(row=2, column=0)
createImage()
reload_button = Button(text="Refresh", command=lambda: createImage(1))
reload_button.grid(row=2, column=1, pady=10)
submit_button = Button(root, text="Submit", font="Arial 10", command=lambda:
check(entry.get(), random_string))
submit_button.grid(row=3, column=0, columnspan=2, pady=10)
root.bind('<Return>', func=lambda Event: check(entry.get(), random_string)
root.mainloop()

OUTPUT:
Conclusion - We have successfully created a CAPTCHA GENTRATOR using python.

You might also like