What are Captchas and how to bypass them on your browser? | Complete guide with code
What are Captchas and how to bypass them on your browser |
Today we are going to talk to you about what Captcha and
reCaptcha is and what the differences are between the
two. Google has presented the third version of its reCaptcha
technology that will further limit the need to interact with the web to show
that we are human, a propitious moment to establish the difference between the
two terms.
In general terms, we can say that reCaptcha is an
evolution of Captcha , which was the original test with which it began to
try to differentiate the human user from spambot at the beginning of the first decade of the year 2000. We are going to start by telling you what Captcha is,
to continue explaining what reCaptcha is, how they differ, and what is new
about the new reCaptcha v3.
What is a captcha?
When it comes to captcha, it refers to an instrument to
protect against spam that aims to defend interactive web pages from abuses
by filtering automatically generated entries. Its name is actually an
acronym for "Completely automated public Turing Test to tell computers and
humans apart", which could be translated into Spanish as "Public and
fully automated Turing test to differentiate humans from computers."
As early as 1950, the computer scientist Alan
Turing proposed a procedure to test the reasoning of artificial
intelligence. According to the computer pioneer, a machine would be able
to imitate the human intellect if it managed to converse digitally with people
without them being able to detect that their interlocutor is actually a
computer.
The Turing Test found its place in the history of
artificial intelligence research ever since and was only surpassed in 2014,
when the supercomputer Eugene Goostman managed to “fool” more than 30 percent
of an independent jury for at least five minutes. , making him believe they
were chatting with a Ukrainian teenager with a fondness for guinea pigs and the
politically incorrect texts of rapper Eminem.
This, which might sound like science fiction, is today one
of the central problems of the Internet. For interactive web pages, it is
crucial to be able to differentiate users who visit the web from computer
programs in a verification process ( human verification ) in which
increasingly refined captchas have to help stop automatic entries and requests
for information. spam and click bots commonly referred to as bots.
Captcha, what are those annoying codes for?
Many users ask us what these annoying codes that appear on
the pages they visit every day are for.
When we want to enter a comment, sign up for a service or
make a request, we are almost always inside the form, a section in which we
must write the characters that we see in a distorted image and that is not
always easy to understand. If it really adds a difficulty, why have they
put them?
The answer is that they are there to verify that the form in
question has been completed by a person and not by a machine.
Let's see an example:
A company has a website from which it displays its
products. Visitors can comment on the articles. A malicious user can
create an automated system that leaves advertising (spam). The website
owner can find that in a matter of seconds 1,000 advertising comments have
appeared on his website. You will have to review and eliminate them with
the waste of time and resources that this implies.
To avoid this, a sequence is introduced that is difficult
for a machine to interpret, but is readable for a human. When a legitimate
user visits the web and wants to contribute his opinions, he will fill in the
data, interpret the "captcha" and send it. The web will compare
the entered values with the ones it has stored and if they coincide, the
information will be allowed to be sent.
What is the purpose of captchas?
The most common field of action of captchas is that of web
applications that request data from users. Imagine the case of an
electronic store that allows its customers to evaluate their purchases with
comments. The store's priority is probably ensuring that the entries have
actually been written by their customers, or at least human
users. However, often what is found is the opposite, automatically
generated comments that in the worst case include a link to a competitor's
store.
This could be avoided by protecting online forms with a
captcha that forces users to verify their human nature before submitting
their comment. These captchas are found today in almost all areas in which
it is necessary to differentiate people from bots, including registration forms
for email services, newsletters, forums and social networks, but also online
surveys or web search engine services .
Throughout all this time, various methods have been
developed with which to carry out this human verification. However, it is
considered accepted that no procedure guarantees absolute security against
spam and that, in any case, it is usability that comes out the worst.
Sometimes difficult to interpret
The problem is that spambots are achieving higher detection
rates, which is why captcha developers use more and more complex
codes, sometimes too difficult, also difficult for the user to solve. This
causes a lot of annoyances since these captchas are very difficult to read and
the user cannot continue with the activity they started. The alternatives
are called PlayThru and are, instead of character strings, small games that the
user must solve and, furthermore, much more entertaining than the usual
captchas.
Main problems user faces
·
They prevent access to
people with visual disabilities. The captchas can be seen or heard, but
the only thing that would allow the blind to solve them would be images that
include the "alt" attribute of the tag. But of course, with this
the machines could also decipher the captchas. In short, if a blind user
came to your website, they could not fill out your form and you would lose a
potential client.
·
They clearly decrease
the conversion rate because, in most cases, they cause users to give
up the idea of filling out your forms.
·
It’s sometimes really
complicated to resolve captachas it takes time and shows again and again.
·
Waste of time even 0.30
second takes a captha takes from one user and think wisely how much time will
it take for your users in daily basis and again think how much time they waste
in monthly basis to resolve captachas?
·
You even know your
employees are not bots they are humans and their work is slowing down by just
providing they are not bot they are humans? It’s really stupid thing when you
just prove you are human and waste your time when you can utilize it on your work
and grow of your business.
The solution for the companies to not
waste their times in solving captchas?
2Captcha provides solution to their customers a best
solution on this problem to work consistently without delaying of your time and
facing the problem of solving captachas. It is best for the agencies where employees
work in an environment where they are using websites or software which uses
captachas.
How 2Captcha works?
2Captcha
actually resolve the problem of your company captacha by providing solution with
providing solution to solving many captachas and their different styles with
most of the times 2 API end points. The 1st request conveys the data required
for the CAPTCHA to be resolved and returns a request ID. In the case of an
image-based CAPTCHA, the data would be a base64-ed image of the CAPTCHA that
one.
What are Captchas and how to bypass them on your browser |
For recaptcha process is the same and you just have to send
strike key which can be found on containing <div>.
For recaptcha it can take 15-30 seconds only
See this video to understand better
For just taking practice here is the code for Reddit signup
page.
Using Puppeteer
$ npm install puppeteer
const
puppeteer = require('puppeteer');const chromeOptions = {
headless:false,
defaultViewport: null};(async function
main() {
const browser = await
puppeteer.launch(chromeOptions);
const page = await browser.newPage();
await
page.goto('https://old.reddit.com/login');
})()
Shortcut:
F12 ( for windows)
Shortcut:
⌘+Shift+C on Mac and Ctrl+Shift+C on Windows
Passing the
.type() method.
await
page.type('#user_reg', 'some_username');
await page.type('#passwd_reg',
'SuperStrongP@ssw0rd');
await page.type('#passwd2_reg', 'SuperStrongP@ssw0rd');
Delay
with Puppeteer’s browser launch options with “SlowMo”
const chromeOptions = {
headless:false,
defaultViewport: null,
slowMo:10,
};
2Captcha’s API works via a 2 step process
const formData = {
method: 'userrecaptcha',
key: apiKey, // your 2Captcha API Key
googlekey: '6LeTnxkTAAAAAN9QEuDZRpn90WwKk_R1TRW_g-JC',
pageurl: 'https://old.reddit.com/login',
json: 1
};const response = await request.post('http://2captcha.com/in.php', {form: formData});const requestId = JSON.parse(response).request;
Get a request ID back
`http://2captcha.com/res.php?key=${apiKey}&action=get&id=${reqId}`;
For reCAPTCHA v2 the way out times can vary a bit — normally
from 15 seconds and as long as 45 seconds
async function pollForRequestResults(
key,
id,
retries = 30,
interval = 1500,
delay = 15000
) {
await timeout(delay);
return poll({
taskFn: requestCaptchaResults(key, id),
interval,
retries
});
}function requestCaptchaResults(apiKey, requestId) {
const url = `http://2captcha.com/res.php?key=${apiKey}&action=get&id=${requestId}&json=1`; return async function() {
return new Promise(async function(resolve, reject){
const rawResponse = await request.get(url);
const resp = JSON.parse(rawResponse);
if (resp.status === 0) return reject(resp.request);
resolve(resp.request);
});
}
}const timeout = millis => new Promise(resolve => setTimeout(resolve, millis))
After
get the response we need this code
const response = await pollForRequestResults(apiKey, requestId);
const js = `document.getElementById("g-recaptcha-response").innerHTML="${response}";`await page.evaluate(js);
The full script is given under
for the purpose if you want to try with Puppeteer and/or 2Captcha.
const puppeteer = require('puppeteer'); |
|
const request = require('request-promise-native'); |
|
const poll = require('promise-poller').default; |
|
const siteDetails = { |
|
sitekey: '6LeTnxkTAAAAAN9QEuDZRpn90WwKk_R1TRW_g-JC', |
|
pageurl: 'https://old.reddit.com/login' |
|
} |
|
const getUsername = require('./get-username'); |
|
const getPassword = require('./get-password'); |
|
const apiKey = require('./api-key'); |
|
const chromeOptions = { |
|
executablePath:'/Applications/Google
Chrome.app/Contents/MacOS/Google Chrome', |
|
headless:false, |
|
slowMo:10, |
|
defaultViewport: null |
|
}; |
|
(async function main() { |
|
const browser = await puppeteer.launch(chromeOptions); |
|
const page = await browser.newPage(); |
|
await page.goto('https://old.reddit.com/login'); |
|
const requestId = await initiateCaptchaRequest(apiKey); |
|
await page.type('#user_reg', getUsername()); |
|
const password = getPassword(); |
|
await page.type('#passwd_reg', password); |
|
await page.type('#passwd2_reg', password); |
|
const response = await pollForRequestResults(apiKey, requestId); |
|
|
|
await page.evaluate(`document.getElementById("g-recaptcha-response").innerHTML="${response}";`); |
|
page.click('#register-form button[type=submit]'); |
|
})() |
|
async function initiateCaptchaRequest(apiKey) { |
|
const formData = { |
|
method: 'userrecaptcha', |
|
googlekey: siteDetails.sitekey, |
|
key: apiKey, |
|
pageurl: siteDetails.pageurl, |
|
json: 1 |
|
}; |
|
const response = await request.post('http://2captcha.com/in.php', {form: formData}); |
|
return JSON.parse(response).request; |
|
} |
|
async function pollForRequestResults(key, id, retries = 30, interval = 1500, delay = 15000) { |
|
await timeout(delay); |
|
return poll({ |
|
taskFn: requestCaptchaResults(key, id), |
|
interval, |
|
retries |
|
}); |
|
} |
|
function requestCaptchaResults(apiKey, requestId) { |
|
const url = `http://2captcha.com/res.php?key=${apiKey}&action=get&id=${requestId}&json=1`; |
|
return async function() { |
|
return new Promise(async function(resolve, reject){ |
|
const rawResponse = await request.get(url); |
|
const resp = JSON.parse(rawResponse); |
|
if (resp.status === 0) return reject(resp.request); |
|
resolve(resp.request); |
|
}); |
|
} |
|
} |
|
const timeout = millis => new Promise(resolve => setTimeout(resolve, millis)) |
Note:
this code is taken from Github Here
is link of the code
Conclusion
At the end of this article I will strongly suggest you to take 2captcha service and save your time because time is money and its really great way they providing srvices because you can visit their website to understand better because they are not using bots to solve your captchas they are hiring real humans they are working for you to provide solutions so what are you waiting for?
No comments
Note: Only a member of this blog may post a comment.