Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl -k "https://192.168.2.1/api/login?username=admin&password=admin"
- buffer = BytesIO()
- c = pycurl.Curl()
- c.setopt(c.URL, 'https://192.168.2.1/api/login?username=admin&password=admin')
- c.setopt(c.WRITEDATA, buffer)
- c.perform()
- c.close()
- body = buffer.getvalue()
- # Body is a byte string.
- # We have to know the encoding in order to print it to a text file
- # such as standard output.
- print(body.decode("iso-8859-1"))
- pycurl.error, (60, 'server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none')
- urllib.error.URLError, <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)>
- import urllib2
- f = urllib2.urlopen("https://ya.ru")
- print f.read()
- import urllib.request
- f = urllib.request.urlopen('https://192.168.2.1/api/login?username=admin&password=admin')
- print (f.read())
- import pycurl
- c = pycurl.Curl()
- c.setopt(c.URL, 'https://ya.ru')
- c.perform()
- $ openssl s_client -prexit -servername $host -connect $host:443 </dev/null | openssl x509 >server.crt
- $ curl --cacert server.crt https://$host/path?query
- import pycurl
- c = pycurl.Curl()
- c.setopt(c.URL, url)
- c.setopt(c.CAINFO, 'server.crt')
- c.perform()
- import requests
- r = requests.get(url, verify='server.crt')
- print(r.text)
- import ssl
- import urllib.request
- context = ssl.create_default_context(cafile='server.crt')
- with urllib.request.urlopen(url, context=context) as r:
- print(r.read().decode(r.headers.get_content_charset('utf-8')))
- c.setopt(c.SSL_VERIFYPEER, 0) # default 1
- c.setopt(c.SSL_VERIFYHOST, 0) # default 2
Add Comment
Please, Sign In to add comment