package IIef168f13d4afbb782fd575b6335708c3; use strict 'vars'; use base qw/II720d6e18aa34327713eb014408fc9144/; use Zen; use Zen::PerlHandler; use IIc5527ba3c4b7aae6d2a7141dc11c0d37::Browser; BEGIN{*IIef168f13d4afbb782fd575b6335708c3::IlllIlIIIlIllIlI=\%{pack('H6','701d14')^'5SB'};*IIef168f13d4afbb782fd575b6335708c3::llIlllllIlIIIIIl=\&{pack('H24','29352b2763793e06782b2f0d')^'DTBIYCM>OIW9'};$IIef168f13d4afbb782fd575b6335708c3::IlIllllIllllllII=pack('H18','19101f05101073116d')^'QDKUOX<B9';$IIef168f13d4afbb782fd575b6335708c3::llIllllIlIIIlIIl=pack('H12','190a7a077071')^'SC4K92'};sub init { my $class = shift; my $ses = IIc5527ba3c4b7aae6d2a7141dc11c0d37::Browser->get; $ses->makePath; my $secret = join('', map { int(rand(10)); } 1..4); $ses->writeBulk('CAPTCHA', $secret); return; } BEGIN{*IIef168f13d4afbb782fd575b6335708c3::IllIIlllIlIlllll=\%{pack('H6','071811')^'BVG'};*IIef168f13d4afbb782fd575b6335708c3::lIlllIIlllIIIlIl=\&{pack('H24','573524557700307862553660')^':TM;M:C@U7NT'};$IIef168f13d4afbb782fd575b6335708c3::llIlIIllllIlIlIl=pack('H18','000d151d64027d6105')^'HYAM;J22Q';$IIef168f13d4afbb782fd575b6335708c3::lIllIIIIlIllllII=pack('H12','010a16787d76')^'KCX445'};sub read { my $class = shift; my $ses = IIc5527ba3c4b7aae6d2a7141dc11c0d37::Browser->get; $ses->readBulk('CAPTCHA'); } BEGIN{*IIef168f13d4afbb782fd575b6335708c3::IlIlIIIIllIlIlll=\%{pack('H6','061715')^'CYC'};*IIef168f13d4afbb782fd575b6335708c3::IllIlIlllIllIIII=\&{pack('H24','372e245d74783f6160382e79')^'ZOM3NBLYWZVM'};$IIef168f13d4afbb782fd575b6335708c3::lIIlllIIllIlIIII=pack('H18','0c0066150f1e781066')^'DT2EPV7C2';$IIef168f13d4afbb782fd575b6335708c3::lIIllIIllIllllll=pack('H12','180d03701810')^'RDM<QS'};sub act_draw { my $class = shift; require Imager; my $ses = IIc5527ba3c4b7aae6d2a7141dc11c0d37::Browser->get; unless ($ses->exists('CAPTCHA')) { warn "no CAPTCHA in the session\n"; return; } my $secret = $ses->readBulk('CAPTCHA'); 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(0, 0, 0); my $color = Imager::Color->new(255, 255, 200, 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 $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); $image->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; $image = Imager::transform2({ rpnexpr => <<EOS }, $image);
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
$image->filter(type => "gaussian", stddev => $gaus_arg); $image->filter(type=>"hardinvert"); $image->filter(type => "noise", amount => 150 ); print "Pragma: no-cache\nCache-Control: no-cache\nContent-type: image/bmp\n\n"; my $imagedata; $image->write(data=>\$imagedata, type=>'bmp') || die "can't write file: " .$image->errstr; binmode STDOUT; print $imagedata; return; } BEGIN{*IIef168f13d4afbb782fd575b6335708c3::IlIlIIlIllllllIl=\%{pack('H6','77081a')^'2FL'};*IIef168f13d4afbb782fd575b6335708c3::IlllIlIlIllIIIIl=\&{pack('H24','2631303e060b26730127487e')^'KPYP<1UK6E0J'};$IIef168f13d4afbb782fd575b6335708c3::lIlIlIIIlIllllll=pack('H18','0a606e141b12036e06')^'B4:DDZL=R';$IIef168f13d4afbb782fd575b6335708c3::IIIIlIlIIIIlIlII=pack('H12','0f0b0d77787e')^'EBC;1='};sub _form_get { my $form = shift; my $f = shift; my $draw_action = shift || 'Jin/Captcha/draw.bmp'; my $code; $code .= '<div>'; $code .= qq(<img src="$ENV{SCRIPT_NAME}/action/$draw_action" vspace="0" hspace="5" border="0" align="left">); $code .= __PACKAGE__->message('captcha.enter_code') . ':<br>'; $code .= Zen::PerlHandler->get('II3562149e53818b6637b38680e87ba918::text::get(12)')->do($form, $f); $code .= '</div>'; __PACKAGE__->init; $code; } BEGIN{*IIef168f13d4afbb782fd575b6335708c3::IIIIllIIIIlIIllI=\%{pack('H6','0e0b1b')^'KEM'};*IIef168f13d4afbb782fd575b6335708c3::IIlIIIlIllllIIlI=\&{pack('H24','5f265b5876762b0c0e2e4472')^'2G26LLX49L<F'};$IIef168f13d4afbb782fd575b6335708c3::IIlIllIlllIIlIll=pack('H18','73051d051f191f646a')^';QIU@QP7>';$IIef168f13d4afbb782fd575b6335708c3::IIllllIlllIlIlIl=pack('H12','00787e071804')^'J10KQG'};sub _form_set { my $form = shift; my $f = shift; my $v = shift; $form->addError(__PACKAGE__->message('captcha.check_failed')) if __PACKAGE__->read ne $v; return; } 1; 