├── .gitignore
├── MANIFEST
├── MANIFEST.SKIP
├── Makefile.PL
├── README
├── LICENSE
├── example
└── fastcgi.pl
└── lib
└── Captcha
└── NocaptchaMailru.pm
/.gitignore:
--------------------------------------------------------------------------------
1 | *.tar.gz
2 | *.bak
3 | *.old
4 | /Makefile
5 | /blib
6 | /pm_to_blib
7 | /MYMETA.json
8 | /MYMETA.yml
9 |
--------------------------------------------------------------------------------
/MANIFEST:
--------------------------------------------------------------------------------
1 | lib/Captcha/NocaptchaMailru.pm
2 | LICENSE
3 | Makefile.PL
4 | MANIFEST This list of files
5 | README
6 |
--------------------------------------------------------------------------------
/MANIFEST.SKIP:
--------------------------------------------------------------------------------
1 | ^blib/
2 | .tar.gz$
3 | ^Makefile$
4 | ^Makefile.old$
5 | ^MYMETA.*
6 | ^pm_to_blib$
7 | ^\.git
8 | ^example/
9 | .bak$
10 | ^MANIFEST.SKIP$
11 |
--------------------------------------------------------------------------------
/Makefile.PL:
--------------------------------------------------------------------------------
1 | use 5.010001;
2 | use ExtUtils::MakeMaker;
3 | WriteMakefile(
4 | NAME => 'Captcha::NocaptchaMailru',
5 | VERSION_FROM => 'lib/Captcha/NocaptchaMailru.pm',
6 | PREREQ_PM => {
7 | LWP::UserAgent => 5,
8 | JSON => 2,
9 | URI::Escape => 3,
10 | },
11 | LICENSE => 'mit',
12 | ($] >= 5.005 ? ## Add these new keywords supported since 5.005
13 | (ABSTRACT_FROM => 'lib/Captcha/NocaptchaMailru.pm', # retrieve abstract from module
14 | AUTHOR => 'Oleg Kovalev ') : ()),
15 | );
16 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | Captcha-Nocaptcha
2 | =================
3 |
4 | Nocaptcha is an intelligent CAPTCHA service that can deliver a majority of real
5 | users from solving a CAPTCHA riddle with the same protection level from spam
6 | scripts. The service has been successfully used in our internal projects and on
7 | sites unrelated to Mail.Ru.
8 |
9 | This module is Perl implementation of Nocaptcha Mail.Ru service API.
10 |
11 | INSTALLATION
12 |
13 | To install this module type the following:
14 |
15 | perl Makefile.PL
16 | make
17 | make install
18 |
19 | SUPPORT AND DOCUMENTATION
20 |
21 | After installing, you can find documentation for this module with the
22 | perldoc command.
23 |
24 | perldoc Captcha::Nocaptcha
25 |
26 | You can also look for information at:
27 |
28 | Official site
29 | https://nocaptcha.mail.ru
30 |
31 | Documentation
32 | https://nocaptcha.mail.ru/docs
33 |
34 | PHP module
35 | https://github.com/mailru/nocaptcha-php
36 |
37 | Python module
38 | https://github.com/mailru/nocaptcha-python
39 |
40 | Use this email for feedback: nocaptcha@corp.mail.ru
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Mail.Ru
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/example/fastcgi.pl:
--------------------------------------------------------------------------------
1 | use Captcha::Nocaptcha;
2 | use FCGI;
3 | use Data::Dumper;
4 | use URI::Escape;
5 |
6 | use constant PUBLIC_KEY => 'e5238532bf56e4c24bd5489d463ac2a0';
7 | use constant PRIVATE_KEY => '3cf11185476394b85bcec3fbf16c69a4';
8 |
9 | sub unpack_params {
10 | my ($buf, %params);
11 | read(STDIN, $buf, $ENV{'CONTENT_LENGTH'});
12 | my @pairs = split(/&/, $buf);
13 | foreach my $pair (@pairs) {
14 | my ($key, $val) = split(/=/, $pair);
15 | $key = uri_unescape($key);
16 | $val = uri_unescape($val);
17 | $params{$key} = $val;
18 | }
19 | return \%params;
20 | }
21 |
22 | my $sock = FCGI::OpenSocket(":9000", 5);
23 | my $req = FCGI::Request(\*STDIN, \*STDOUT, \*STDOUT, \%ENV, $sock);
24 |
25 | while ($req->Accept() >= 0) {
26 | if ($ENV{REQUEST_METHOD} eq "POST") {
27 | my $params = unpack_params();
28 | my $res = Dumper(nocaptcha_check_detailed(PRIVATE_KEY, $params->{captcha_id}, $params->{captcha_value}));
29 | print("Content-Type: text/html\r\n\r\n");
30 | print <<" END";
31 |
32 |
33 |
34 |