Always verify the certificate - anticapum - Handle Università Politecnica delle Marche captive portal
(HTM) hg clone https://bitbucket.org/iamleot/anticapum
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) changeset b052cbc9a697af7f8e94b3afccaef896a7050074
(DIR) parent 1d4d154788e334e7a8bf1deee3292bf973fe410b
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Mon, 25 Feb 2019 10:05:27
Always verify the certificate
Diffstat:
anticapum.py | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
---
diff -r 1d4d154788e3 -r b052cbc9a697 anticapum.py
--- a/anticapum.py Mon Feb 25 09:58:07 2019 +0100
+++ b/anticapum.py Mon Feb 25 10:05:27 2019 +0100
@@ -29,7 +29,6 @@
import getpass
-import ssl
from netrc import netrc
from html.parser import HTMLParser
from urllib import parse, request
@@ -88,10 +87,7 @@
})
auth = auth.encode('utf-8')
- # TODO: Find a way to verify the cert!
- sc = ssl.SSLContext()
- sc.verify_mode = ssl.CERT_NONE
- with request.urlopen(ANTICAPUM_URL_LOGIN, data=auth, context=sc) as f:
+ with request.urlopen(ANTICAPUM_URL_LOGIN, data=auth) as f:
p = CaptiveResponseParser()
p.feed(f.read().decode())
return {
@@ -112,10 +108,7 @@
auth = parse.urlencode(data)
auth = auth.encode('utf-8')
- # TODO: Find a way to verify the cert!
- sc = ssl.SSLContext()
- sc.verify_mode = ssl.CERT_NONE
- with request.urlopen(ANTICAPUM_URL_RENEW, data=auth, context=sc) as f:
+ with request.urlopen(ANTICAPUM_URL_RENEW, data=auth) as f:
pass