S
S
sswwssww2019-09-27 10:43:56
Python
sswwssww, 2019-09-27 10:43:56

How to log in to a site with certificate verification, bypassing the certificate selection window?

There is a personal account of Rosfinmonitoring, in which a personal certificate is used to enter. I want to know what other ways there are to transfer / accept this certificate, in addition to brute-force pressing the accept button using some kind of Pyautogui. 5d8dbb3deb45d194500382.png .
Any method that does not require key/mouse emulation will do. Is it possible to pass it as a parameter to get/post? If yes, how to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-09-27
@sswwssww

import json
import requests

clientCrt = "cc.crt"
clientKey = "ck.key"
url = "https://example.com/api"
payload = { "someId": "myID" }
certServer = 'cs.crt'
headers = {'content-type': 'application/json'}
r = requests.post(url, data=json.dumps(payload), verify=certServer, headers=headers, cert=(clientCrt, clientKey))
print(r.status_code)
print(r.json())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question