Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea-www.harvard.edu/~fine/Tech/nph-webcampush-cgi.txt
Дата изменения: Wed Jul 2 21:21:21 2003
Дата индексирования: Tue Oct 2 02:42:17 2012
Кодировка:

Поисковые слова: п п п п п п п п п п п п
#!/usr/bin/perl

$|=1;

#$file="/home/fine/www/webcam.jpg";
$file="/var/tmp/finewebcam.jpg";

print "HTTP/1.1 200 OK\n";
print "Content-type: multipart/x-mixed-replace;boundary=spyonmeyoufuckingpervert\n";
print "Connection: Keep-Alive\n";
print "\n";
print "--spyonmeyoufuckingpervert\n";
while (1) {
$done=0;
while(! $done) {
@foo=stat($file);
if ($foo[9] != $mtime) {
$mtime=$foo[9];
$size=$foo[7];
$done=1;
} else {
#check to see if camera is offline
if ((time-$foo[9]) > 120) {
system("/soft/netpbm/bin/pbmtext -font /home/fine/fonts/bigpalm-bold.bdf 'Camera is OFFLINE!' | /soft/netpbm/bin/pnmcrop | /soft/netpbm/bin/pnmpad -white -l1 -r1 -t1 -b1 | /soft/netpbm/bin/ppmchange black red > /tmp/webcamoffline.ppm 2> /dev/null");
system("/usr/local/bin/djpeg $file | /soft/netpbm/bin/pnmpaste /tmp/webcamoffline.ppm 271 0 | /usr/local/bin/cjpeg -quality 80 > /tmp/offline.jpg");
print "Content-type: image/jpeg\n";
print "Content-length: $size\n";
print "\n";
open(JPG,"/tmp/offline.jpg");
while(read(JPG,$buf,8192)>0) {
print $buf;
}
close(JPG);
#don't print separator, that makes netscape expect a new file
exit(0);
}
sleep(5);
}
}
print "Content-type: image/jpeg\n";
print "Content-length: $size\n";
print "\n";
open(JPG,$file);
while(read(JPG,$buf,8192)>0) {
print $buf;
}
close(JPG);
print "\n--spyonmeyoufuckingpervert\n";
}