I am trying to create a scraper in Python which sends json.load requests and pull the required data.
The webpage I'm trying to scrape has a search box which passes the json data after encrypting the input value. I'm able to achieve that, but I had to manually pass the encrypted input value to the request.
After some paying around with the developer options, I was able to find the javascript code that is encrypting the input value
function EncryptionCode(value){
var wrenchK = RSA.enc.Utf8.bufferParse(Base64.decode(Const.wrench));
var response = RSA.SYMM.encrypt(RSA.enc.Utf8.parse(value), wrenchK,
{
keySize: 128 / 8,
iv: wrenchK,
mode: RSA.mode.CBC,
padding: RSA.pad.Pkcs7
});
return response;
This code encrypts a given string as follows: Example String: Cipla Ltd. Encrypted string passed to JSON:
7Tx7+WkQdeTJogipi8RK4TNQ7O23RQ39AVCv0Lc/3KMqpGGL2UTLgMzrKZKiSF9FomOPOYOBlTmBYgnI1t7uT3mcRsd04lJlwpeKs0GZJH1LMLBJGqUxV1hvPzrA3A4W8gNAUjRVpj1K4OvWAWwwog==
Kindly suggest how can I make this encryption directly in Python so that I don't have to hardcode the encrypted input value for every query.
Thanks