CAPTCHA: Telling Humans and Computers Apart Automatically
A CAPTCHA is a program that protects websites against bots by generating and grading tests that humans can pass but current computer programs cannot. For example, humans can read distorted text as the one shown below, but current computer programs can't:
The term CAPTCHA (for Completely Automated Public Turing Test To Tell Computers and Humans Apart) was coined in 2000 by Luis von Ahn, Manuel Blum, Nicholas Hopper and John Langford of Carnegie Mellon University.
Get a Free CAPTCHA For Your Site
A free, secure and accessible CAPTCHA implementation is available from the reCAPTCHA project. Easy to install plugins and controls are available for WordPress, MediaWiki, PHP, ASP.NET, Perl, Python, Java, and many other environments. reCAPTCHA also comes with an audio test to ensure that blind users can freely navigate your site. reCAPTCHA is our officially recommended CAPTCHA implementation.
Test Drive a CAPTCHA
- reCAPTCHA. Stop spam and help digitize books at the same time! The words shown come directly from old books that are being digitized.
- SQUIGL-PIX. Our newest CAPTCHA!
- ESP-PIX. A CAPTCHA script that's close to our hearts. Instead of typing letters, you authenticate yourself as a human by recognizing what object is common in a set of images. This was the first example of a CAPTCHA based on image recognition.
Below is an example for Embedding a sample Captcha in a CGi FIle.
#!/usr/bin/env python
######### don't change the following three lines: ###########
import cgi
import cgitb;cgitb.enable()
import time
from recaptcha.client import captcha
publickey = "<publickey>"
privatekey = "<privatekey>"
print "Content-Type: text/html\n\n"
print '''
<html>
<head>
<title>NO BOTS</title>
</head>
<body>
<form action="<ur cgi validator>" method="post">
<h2>Prove you are not a BOT</h2>
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=''' + publickey + '''"></script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=''' + publickey + '''" height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge">
</noscript>
<input type = "submit" value = "Go">
</form>
</body>
</html>
'''
Below is an example for validating a Captcha in a CGi FIle.
#!/usr/bin/env python
######### don't change the following three lines: ###########
import cgi
import cgitb;cgitb.enable()
import time
from recaptcha.client import captcha
publickey = "<publickey>"
privatekey = "<privatekey>"
print "Content-Type: text/html\n\n"
form = cgi.FieldStorage()
response = captcha.submit(
form.getvalue("recaptcha_challenge_field"),
form.getvalue('recaptcha_response_field'),
privatekey,
"192.168.20.68",
)
if not response.is_valid:
print '''
<html>
<head>
<title>U BOTS</title>
</head>
<body>
<form action="<cgi captcha validator>" method="post">
<h2>YOU ARE A BOT!!!!!!!!!!!!!!</h2>
<h3>Else Try Again</h3>
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=''' + publickey + '''"></script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=''' + publickey + '''" height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge">
</noscript>
<input type = "submit" value = "Go">
</form>
</body>
</html>
'''
else:
print '''
<html>
<head>
<title>Hurray ur not a BOT </title>
</head>
<body>
<form action="<cgi captcha validator>" method="post">
<h2>Hurray!!!!!!!!!!!!!!<br> :) you are A Human ;-)</h2>
<h3>You can Try Again Human</h3>
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=''' + publickey + '''"></script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=''' + publickey + '''" height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge">
</noscript>
<input type = "submit" value = "Go">
</form>
</body>
</html>
'''
No comments:
Post a Comment