Transcript slides

Web Programming
Week 11
Old Dominion University
Department of Computer Science
CS 418/518 Fall 2010
Martin Klein <[email protected]>
11/09/10
Image Resizing
• PHP functions:
– GetImageSize()
list($width,$height,$type,$attr) = GetImageSize($srcfile);
– ImageCreateTrueColor()
$dst = ImageCreateTrueColor($new_width, $new_height);
– ImageCreateFromJpeg()
$src = ImageCreateFromJpeg($srcfile);
– ImageCopyResized()
ImageCopyResized($dst, $src, 0, 0, 0, 0, $new_width, new_height,
$width, $height);
• Examples: http://mln-web.cs.odu.edu/~mklein/code/code/ch11/resize.html
• Also see: http://us2.php.net/getimagesize
CAPTCHA
• Completely Automated Public Turing test to tell
Computers and Humans Apart
• Challenge – response test provided by server
• User solves problem and is (by server) considered
human (and not a machine)
• Goal:
– Ensure that interaction is with user
– Prevent spam of all kinds e.g. mass account creation,
posts, etc.
CAPTCHA
How to?
• Distorted text
– Make it hard for Optical Character Recognition
(OCR)
– Difficult to distinguish between background and text
(color, shape)
– Character overlap
– Out of alignment
CAPTCHA
How to?
• Distorted images
– Provide array of images and have user select a few
(airplane, boat, bird)
– Have user point to “top” or “bottom” of image
• Difficult for machines to determine if no indicators (sky,
water, horizon) given
– “Chose the item that does not fit here!”
• Somewhat hybrid:
– trivial (math) problems to solve
picture taken from: http://en.wikipedia.org/wiki/Captcha
CAPTCHA
Problem solved?
• Vulnerable to relay attacks
– Relay captcha to human when encountered
• Capture and re-use successful session ID
• Dictionary attacks
• “Iron out” images and use ORC, dictionaries
CAPTCHA
Problem solved?
• How about accessibility?
– Blind users?
• possible solution: audio stream
• Voice recognition software!
– Deaf-blind users?
• ???
reCAPTCHA
• Originates from CMU, bought by Google in 2009
• Help needed to digitize books (using OCR)
• “Wisdom of the Crowds” (can be used against us)
– Captcha contains
• 1 term not recognized by OCR
• 1 term well known
– Assumption: if user gets known term right, she also
gets unknown term right
– To be confirmed by 2, 3, … others
• Digitization project benefits!!!
reCAPTCHA
Examples
• http://www.google.com/addurl/
• https://www.blogger.com/comment.g?blogID=25215770&postID=5
975815412653416464
• http://www.johnmwillis.com/other/top-10-worst-captchas/
Implementation:
• http://captchas.net/
– http://mln-web.cs.odu.edu/~mklein/php/recaptcha/query.php
• http://www.google.com/recaptcha
– http://mln-web.cs.odu.edu/~mklein/php/recaptcha/one.php