bombardier-gif / covid-vaccine-booking

This very basic script can be used to automate COVID-19 vaccination slot booking on India's Co-WIN Platform.
375 stars 216 forks source link

Need automatic filling of captcha #51

Closed sumit919 closed 3 years ago

sumit919 commented 3 years ago

We save the image received from response, but we should apply some technique so that the captcha automatically gets filled as well; because maybe this process is making it slow; by the time I fill the captcha the slots becomes unavailable/ completely booked. Here is a link: https://medium.com/@ageitgey/how-to-break-a-captcha-system-in-15-minutes-with-machine-learning-dbebb035a710

Here is a test run which is not able to book even if the slot is there:

Centers available in Pune from 11-05-2021 as of 2021-05-11 13:15:16: 102
===================================================================================
Centers available in Pune from 11-05-2021 as of 2021-05-11 13:15:31: 102
===================================================================================
Centers available in Pune from 11-05-2021 as of 2021-05-11 13:15:48: 103
+-------+------------------------------+------------+-----------+-------------+------------+---------------------+
|   idx | name                         | district   |   pincode |   available | date       | slots               |
+=======+==============================+============+===========+=============+============+=====================+
|     1 | Talegaon D PHC 18 To 44 Only | Pune       |    410507 |          37 | 11-05-2021 | ['01:30PM-03:30PM'] |
+-------+------------------------------+------------+-----------+-------------+------------+---------------------+
Random Rows.Column:1.1
============> Got Choice: Center #1, Slot #1
Booking with info: {'beneficiaries': ['74425393520140'], 'dose': 1, 'center_id': 670838, 'session_id': '0ed623bf-5153-4987-946f-7fe01263e091', 'slot': '01:30PM-03:30PM'}
================================= GETTING CAPTCHA ==================================================
Captcha Response Code: 200
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
colinear!
colinear!
colinear!
colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
colinear!
colinear!
x_order_2: colinear!
x_order_2: colinear!
colinear!
colinear!
colinear!
colinear!
colinear!
colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
x_order_2: colinear!
ret value= EM64T
================================= ATTEMPTING BOOKING ==================================================
Booking Response Code: 409
Booking Response : {"errorCode":"APPOIN0040","error":"This vaccination center is completely booked for the selected date."}
Response: 409 : {"errorCode":"APPOIN0040","error":"This vaccination center is completely booked for the selected date."}
===================================================================================
Centers available in Pune from 11-05-2021 as of 2021-05-11 13:18:57: 103
bombardier-gif commented 3 years ago

Then we would go into the illegal territory. At this moment this script user inputs all the things which a non-script user does. At this moment we are not bypassing any step.

jishnu-gv commented 3 years ago

I am facing same issue from Yesterday . By the time we get chance 1 or 2 times and ending up with this and the slot are getting over .

bombardier-gif commented 3 years ago

I am open for solutions to make the captcha more robust.

ithihasmadala commented 3 years ago

I used the 2captcha api and modified the code. It worked. 1 slot was open, and the bot managed to book it by itself!

sumit919 commented 3 years ago

@ithihasmadala would you like to raise a Pull request with your update ?

jishnu-gv commented 3 years ago

@ithihasmadala - Can you help to raise Pull request with your update as we are not successful in doing a manual update?.

ithihasmadala commented 3 years ago

I think it's risky, it's just a few lines changed in the captcha.py file. You can find the code for 2captcha on GitHub elsewhere. Do it at ur own risk without sharing it to anyone. Also, there are more APIs that help in cracking these captchas, you can find them on RapidAPI.

srmk1 commented 3 years ago

@ithihasmadala why do you say its risky??

mayur-who commented 3 years ago

@ithihasmadala can you please help me out with the code? I would like to test it out myself

ithihasmadala commented 3 years ago

@bombardier-gif said it would enter illegal territory, that's why I said risky

bombardier-gif commented 3 years ago

See here is the background:

  1. The original script writer had not been anonymous and started facing the wrong kind of attention, so he stopped progress on the script: https://github.com/pallupz/covid-vaccine-booking
  2. Though I am anonymous, lot of people in this thread are not.
  3. Captcha is buggy but still works. I would rather request work on making it more robust.

Lastly: You are welcome to fork a repo and implement captcha reading if you still want it.

sumit919 commented 3 years ago

@ithihasmadala If you use ML techniques for automatic solving it maybe illegal. But if you are using 2captcha services to solve the Captcha; It shouldn't be illegal as human employees are solving that and on 2captcha account you actually pay for getting the captcha solved right @ithihasmadala ? does solving work on free account as well ? it also shouldn;t be a problem as still some firm's human employees are solving captcha.

bombardier-gif commented 3 years ago

At @sumit919 you can proceed this way

  1. implement 2captcha support, in a way such that if someone has the account, they can paste the key and it uses 2captcha
  2. For others the usual captcha will be popup

There are practical problems of captcha too. The response is late sometimes, and by that time the slot goes away. I personally feel that we are faster than the service.