0

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

3
  • This might help: stackoverflow.com/questions/8284765/… Commented Jul 21, 2020 at 21:02
  • If you are using Selenium, you can refer to this one: stackoverflow.com/questions/14088541/… Commented Jul 21, 2020 at 21:04
  • There isn't nearly enough information in this question to answer it. Remember, we aren't looking at the web page in question, so we don't know what the RSA class is or does. Commented Jul 22, 2020 at 11:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.