pyinrail
pyinrail copied to clipboard
ReCaptcha bypass
This is a very nice wrapper, especially the fuzzy match. Recently irctc and Indian rail started using recaptcha which puts all such apis at halt. Any thougths on how we can get around recaptcha ?
URL in API_ENDPOINT present in utils.py is not working.
URL in API_ENDPOINT present in utils.py is not working.
Can you elaborate? The API seems fine.
Request:
GET /enquiry/CommonCaptcha?inputCaptcha=419&inputPnrNo=3333333333&inputPage=PNR&language=en HTTP/1.1
Host: www.indianrail.gov.in
Connection: keep-alive
Accept: */*
X-Requested-With: XMLHttpRequest
User-Agent: some valid UA
rcheck: 03AOLTBLQEjcVPk3C3RQKMmRau7Ws5uFmF2ZO8n-kR9tWW1etgqm5d22YRe4b5_BNbMKN1nLngSrKh_94cpndnqfqKDf65v8P08-2UWikyAeGow_gXdf2FUbPG5VB5fOWUw2lGibRU9ypWN-OYg5_rLoVOI7wwh_mX67vhploJTtt1nUtXnGvrs84g0vgms3pK1ORnoaAiFVgAM5H-t6am6jPJ7AnW4MczxJwxL1UZu36lJ-h_1ohEnw87x_6OIEIWlyFUuiI3r6d5ZNtIjA3jO2PTGEyUmc4k0skBoKHP6EVE8IB79ax9OX3KSJ-iCyP5f0_aojmS24hgEGVbc8nBEQTnsT7Fdd8hgz-E-42L1--uTlXzEgofkthHOVcDsJ0vOf3xadS7EXnZv4gt2DWDqECodH5o4DedyFCkgNDegbEoOKQCJ7DmiLzf8t8GOlToLiLlY2fd0aEA
Referer: http://www.indianrail.gov.in/enquiry/PNR/PnrEnquiry.html?locale=en
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: JSESSIONID=kc0LNgytQnR0fpB1_t7nQpmR8KxUOwGRUKsyYGmt.host6:server6-2; f5avrbbbbbbbb.......... a lot of them
Response:
{"errorMessage": "PNR No. is not valid","serverId": "appserver","generatedTimeStamp":{"year":2019,"month":9,"day":21,"hour":17,"minute":0,"second":4}}
N.B. See the rcheck header, That's the standard ReCaptcha token. If somehow there is a workaround , the rest of @nikhilkumarsingh 's code needs minimal modification.
URL in API_ENDPOINT present in utils.py is not working.
Can you elaborate? The API seems fine.
Request:
GET /enquiry/CommonCaptcha?inputCaptcha=419&inputPnrNo=3333333333&inputPage=PNR&language=en HTTP/1.1 Host: www.indianrail.gov.in Connection: keep-alive Accept: */* X-Requested-With: XMLHttpRequest User-Agent: some valid UA rcheck: 03AOLTBLQEjcVPk3C3RQKMmRau7Ws5uFmF2ZO8n-kR9tWW1etgqm5d22YRe4b5_BNbMKN1nLngSrKh_94cpndnqfqKDf65v8P08-2UWikyAeGow_gXdf2FUbPG5VB5fOWUw2lGibRU9ypWN-OYg5_rLoVOI7wwh_mX67vhploJTtt1nUtXnGvrs84g0vgms3pK1ORnoaAiFVgAM5H-t6am6jPJ7AnW4MczxJwxL1UZu36lJ-h_1ohEnw87x_6OIEIWlyFUuiI3r6d5ZNtIjA3jO2PTGEyUmc4k0skBoKHP6EVE8IB79ax9OX3KSJ-iCyP5f0_aojmS24hgEGVbc8nBEQTnsT7Fdd8hgz-E-42L1--uTlXzEgofkthHOVcDsJ0vOf3xadS7EXnZv4gt2DWDqECodH5o4DedyFCkgNDegbEoOKQCJ7DmiLzf8t8GOlToLiLlY2fd0aEA Referer: http://www.indianrail.gov.in/enquiry/PNR/PnrEnquiry.html?locale=en Accept-Encoding: gzip, deflate Accept-Language: en-GB,en-US;q=0.9,en;q=0.8 Cookie: JSESSIONID=kc0LNgytQnR0fpB1_t7nQpmR8KxUOwGRUKsyYGmt.host6:server6-2; f5avrbbbbbbbb.......... a lot of them
Response:
{"errorMessage": "PNR No. is not valid","serverId": "appserver","generatedTimeStamp":{"year":2019,"month":9,"day":21,"hour":17,"minute":0,"second":4}}
N.B. See the rcheck header, That's the standard ReCaptcha token. If somehow there is a workaround , the rest of @nikhilkumarsingh 's code needs minimal modification.
Actually I tried fetching trains between stations but when I run the code it gives Invalid Request. How can I solve this issue can you please tell.
remake everything