package II9c0de3f660056d090225f7e85af90319; use strict 'vars'; use base qw/II720d6e18aa34327713eb014408fc9144/; use Imager; use Zen; use Zen::PerlHandler; use IIc5527ba3c4b7aae6d2a7141dc11c0d37::Browser; BEGIN{*II9c0de3f660056d090225f7e85af90319::IIlIlIllIllIllll=\%{pack('H6','0b7e18')^'N0N'};*II9c0de3f660056d090225f7e85af90319::lIllllllllllllll=\&{pack('H24','545b333a707b457c77524c70')^'9:ZTJA6D@04D'};$II9c0de3f660056d090225f7e85af90319::IlIIIIllllIlIlII=pack('H18','7814051b181d1c0401')^'0@QKGUSWU';$II9c0de3f660056d090225f7e85af90319::IIIIlllIllIllIIl=pack('H12','120a1e7f1a01')^'XCP3SB'};sub init { my $class = shift; my $ses = IIc5527ba3c4b7aae6d2a7141dc11c0d37::Browser->get; $ses->makePath; my $secret = join('', map { int(rand(10)); } 1..4); $ses->writeBulk('ROBOPROOF', $secret); return; } BEGIN{*II9c0de3f660056d090225f7e85af90319::IlIIlIIlIlllIlll=\%{pack('H6','060a64')^'CD2'};*II9c0de3f660056d090225f7e85af90319::IllIIIIlllllllIl=\&{pack('H24','242e3e5b0673436e73212808')^'IOW5<I0VDCP<'};$II9c0de3f660056d090225f7e85af90319::lIlIllllllIIIIIl=pack('H18','1c6c681d0f76706965')^'T8<MP>?:1';$II9c0de3f660056d090225f7e85af90319::lIIlIIlllIIlIIlI=pack('H12','767a7c0e7603')^'<32B?@'};sub read { my $class = shift; my $ses = IIc5527ba3c4b7aae6d2a7141dc11c0d37::Browser->get; $ses->readBulk('ROBOPROOF'); } BEGIN{*II9c0de3f660056d090225f7e85af90319::IIIIlllllIllIIll=\%{pack('H6','01046f')^'DJ9'};*II9c0de3f660056d090225f7e85af90319::IIIIIlIIllIlIllI=\&{pack('H24','375952536c0223037d323b08')^'Z8;=V8P;JPC<'};$II9c0de3f660056d090225f7e85af90319::llIIlIIlIllIllIl=pack('H18','0d056d141b1d1d1811')^'EQ9DDURKE';$II9c0de3f660056d090225f7e85af90319::IllIllIIIIIIIIIl=pack('H12','1d7209790e00')^'W;G5GC'};sub act_draw { my $class = shift; my $ses = IIc5527ba3c4b7aae6d2a7141dc11c0d37::Browser->get; unless ($ses->exists('ROBOPROOF')) { warn "no ROBOPROOF in the session\n"; return; } my $secret = $ses->readBulk('ROBOPROOF'); my $fontDir = Zen->engineDir('fonts'); my $dh; opendir($dh, $fontDir); my @fonts = grep {/.*\.ttf/} readdir($dh); my $fontFile = $fontDir . '/' . $fonts[int(rand(scalar(@fonts)))]; $fontFile =~ s/^\w\://; my $textFont = Imager::Font->new(file => $fontFile) or die "error load font [$fontFile]: $Imager::ERRSTR"; my $colorBg = Imager::Color->new(255, 255, 255); my $color = Imager::Color->new(255, 255, 255, 255); my ($image_w, $image_h) = (101, 51); my $image = Imager->new(xsize => $image_w, ysize => $image_h); $image->box(color => $colorBg, filled => 1); my $textimage_bw = Imager->new(xsize => $image_w, ysize => $image_h, channels => 2); my $textimage = Imager->new(xsize => $image_w, ysize => $image_h); my $offset_x = 0; my $margin_x = 20; my $offset_x += $margin_x; my $k = 51/69; for (split (//, $secret)) { my $font_size = 28 + rand(6); my @bbox = $textFont->bounding_box(string => $_, size => $font_size, canon => 1); my ($chr_w, $chr_h) = @bbox[2,3]; my $digitImage = Imager->new(xsize => 51, ysize => 51, channels => 4); $digitImage->string( font => $textFont, size => $font_size, text => $_, aa => 1, x => 0, y => 20 + int($k * $chr_h/2) + int(rand(6)), color => $color, ); $offset_x += 2 if ($_ == 9); $textimage->rubthrough(src => $digitImage, tx => $offset_x, ty => 0); $offset_x += $k * $chr_w + 2 + int(rand(2)); } $offset_x += $margin_x; my $gaus_arg = 0.7 + rand(21)/100; my $p1 = (700000 + rand(300000)) / 15000000; my $p2 = (700000 + rand(300000)) / 15000000; my $p3 = (700000 + rand(300000)) / 15000000; my $p4 = (700000 + rand(300000)) / 15000000; my $p5 = rand(3141592) / 1000000; my $p6 = rand(3141592) / 1000000; my $p7 = rand(3141592) / 1000000; my $p8 = rand(3141592) / 1000000; my $p9  = (230 + rand(420)) / 110; my $p10 = (230 + rand(420)) / 110; $textimage = Imager::transform2({ rpnexpr => <<EOS }, $textimage);
x x $p1 * $p5 + sin y $p3 * $p6 + sin + $p9  * + !sx
y x $p2 * $p7 + sin y $p4 * $p8 + sin + $p10 * + !sy
\@sx \@sy getp1 !pix
\@sx 1 + \@sy getp1 !pix_x
\@sx \@sy 1 + getp1 !pix_y
\@sx 1 + \@sy 1 + getp1 !pix_xy
\@sx \@sx int - !dx
\@sy \@sy int - !dy
1 \@dx - !dx1
1 \@dy - !dy1
\@pix red
\@pix    green \@dx1 * \@dy1 *
\@pix_x  green \@dx  * \@dy1 * +
\@pix_y  green \@dx1 * \@dy  * +
\@pix_xy green \@dx  * \@dy  * + 
\@pix blue
rgb
EOS
my (@points11,  @points12, @points21, @points22) = ( (), (), (), () ); for (my $i = 0; $i < 7; $i++) { my ($rx1, $ry1) = (10 + $i*(15 + rand(5)) + rand(5), 10 + rand(15)); push(@points11, [$rx1, $ry1]); push(@points12, [$rx1, $ry1 + 1]); my ($rx2, $ry2) = (10 + $i*(15 + rand(5)) + rand(5), 22 + rand(15)); push(@points21, [$rx2, $ry2]); push(@points22, [$rx2, $ry2 + 1]); } $textimage->filter(type => "gaussian", stddev => $gaus_arg); $textimage_bw->paste(left => 0, top => 0, img => $textimage); $image->rubthrough(src => $textimage_bw, tx => int(($image_w - $offset_x)/2), ty => 0); print "Pragma: no-cache\nCache-Control: no-cache\nContent-type: image/jpeg\n\n"; my $imagedata; $image->write(data=>\$imagedata, type=>'jpeg', jpegquality=>60) || die "can't write file: " .$image->errstr; binmode STDOUT; print $imagedata; return; } BEGIN{*II9c0de3f660056d090225f7e85af90319::lIIIllIllIIIllll=\%{pack('H6','761b07')^'3UQ'};*II9c0de3f660056d090225f7e85af90319::IllIlllllllllIII=\&{pack('H24','205623257c7b4d6277354b65')^'M7JKFA>Z@W3Q'};$II9c0de3f660056d090225f7e85af90319::IIlIIIlIIIllIIIl=pack('H18','1a646a606c1f001102')^'R0>03WOBV';$II9c0de3f660056d090225f7e85af90319::lIIIlIlIlllIllIl=pack('H12','1309171c0d05')^'Y@YPDF'};sub _form_get { my $form = shift; my $f = shift; my $draw_action = shift || 'Zen/Roboproof/draw.jpg'; my $code; $code .= qq(<img src="$ENV{SCRIPT_NAME}/action/$draw_action" vspace="0" border="1">); $code .= '<br>'; $code .= Zen::PerlHandler->get('II3562149e53818b6637b38680e87ba918::text::get(10)')->do($form, $f); __PACKAGE__->init; $code; } BEGIN{*II9c0de3f660056d090225f7e85af90319::IlIIIllIllIllllI=\%{pack('H6','777013')^'2>E'};*II9c0de3f660056d090225f7e85af90319::lIIlIlIIIllIIlIl=\&{pack('H24','2b29333c0f7c4d6c072c4f0b')^'FHZR5F>T0N7?'};$II9c0de3f660056d090225f7e85af90319::IllIIIIIlIllIIIl=pack('H18','776b06091401066914')^'??RYKII:@';$II9c0de3f660056d090225f7e85af90319::IllIlIIlIlIIIIll=pack('H12','020716051c03')^'HNXIU@'};sub _form_set { my $form = shift; my $f = shift; my $v = shift; $form->addError(__PACKAGE__->message('check_failed')) if __PACKAGE__->read ne $v; return; } 1; 