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

python report

This document outlines a Python script for a user authentication system that includes sign-up, sign-in, and a captcha challenge. Users can register with a username and password, and upon successful login, they must solve a randomly generated math problem as a captcha. The script runs in a loop until users successfully authenticate or choose to exit, but it lacks advanced features such as error handling and post-authentication actions.

Uploaded by

pabhi1239
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

python report

This document outlines a Python script for a user authentication system that includes sign-up, sign-in, and a captcha challenge. Users can register with a username and password, and upon successful login, they must solve a randomly generated math problem as a captcha. The script runs in a loop until users successfully authenticate or choose to exit, but it lacks advanced features such as error handling and post-authentication actions.

Uploaded by

pabhi1239
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Experiment-11

CO : CO1,CO2,CO3,CO4
Objective : sign in and signup with algorithm with captcha using python.

Sign in and signup algorithm with capctha by python :


The provided Python script demonstrates a basic user authentication system
with a command-line interface, covering user registration, login, and a captcha
challenge. The script initializes variables, uses a dictionary to store user
credentials, and employs simple math operations. Users are prompted to choose
between signing up and signing in.

During sign-up, users can create a username and password, which are stored in
the dictionary. Successful registration offers the option to sign in or exit. In the
sign-in process, users are required to enter their credentials. If their username
and password match, they face a captcha challenge that involves solving a
randomly generated math problem.

If users correctly solve the captcha, they are considered successfully signed in,
although the script lacks further actions beyond displaying a success message. If
users fail to solve the captcha or provide incorrect credentials, they are
prompted to try again. If the username does not exist in the dictionary, they are
informed of a mismatch.

The script runs in an infinite loop until users exit or successfully authenticate.
While it provides a foundation for user authentication, it has limited practical
use beyond user verification. To enhance its utility, potential improvements
include better user interaction, clearer instructions, more descriptive variable
names, proper exit conditions, and error handling. Additionally, integrating it
into a larger project with specific post-authentication actions would increase its
applicability.
Program :

from tkinter import *


import random
list=[1,2,3,4,5,6,7,8,9]
ls=['-','+','*']
pp2=0
di={
}
def sig():

start=" "

def ini():
start=input('\n-enter to signin or press 1 to signup: ')
return start

def startt():
u=input('\nenter new user name: ')
p=input('enter new pass: ')
di.update({u:p})
pp=ini()

while True:

pp='1'
while pp=='1':
if pp2!='1':
pp=ini()
if pp!='1':
break
else:
pass
u=input('\nenter new user name: ')
p=input('enter new pass: ')
di.update({u:p})
pp2=ini()
if pp2=='1':
continue
else:
break
print("pass")
continue

ent=input("\nenter the username: ")

if ent in di:
t=input("enter the password: ")
s = di[ent]
if s==t:
a=random.choice(list)
b=random.choice(list)
c=random.choice(ls)
if c=='-':
f=int(a-b)
elif c=='+':
f=int(a+b)
elif c=='*':
f=int(a*b)

print(f'{a}{c}{b}= ')
r=int(input('enter captcha'))

if f==r:
print("\nCongrats you have sucessfully signed IN\n ")
#write your code here
Pass

else:
print('enter valid captcha')
continue

else:
print("\nsorry wrong password try again\n")
continue
break

else:
print("\nsorry username dont match try again")
continue
else:
print("invalid captcha enter again")
Output :

Conclusion: Hence in this program we have created program to


signin and signup algorithm with captcha using python.

You might also like