diff --git a/diawi-cli b/diawi-cli index 3398a7a..7c5781d 100755 --- a/diawi-cli +++ b/diawi-cli @@ -8,6 +8,7 @@ import random import string import urllib import urllib2 +import sys handler=urllib2.HTTPHandler(debuglevel=1) opener = urllib2.build_opener(handler) @@ -23,6 +24,14 @@ from httplib import HTTPConnection, HTTPS_PORT import ssl import socket +def is_supported_version(): + try: + ssl.PROTOCOL_TLSv1_2 + except AttributeError: + return False + else: + return True + class HTTPSConnection(HTTPConnection): "This class allows communication via SSL." default_port = HTTPS_PORT @@ -74,6 +83,12 @@ def response_to_json(response): return json.loads(responseStr) +if not is_supported_version(): + print "ERROR: This script requires a Python interpreter with TLS v1.2 support, which was added in Python 2.7.9. Please \ +upgrade your Python interpreter, or recompile with TLS v1.2 support. Note that version of Python shipped with Mac OS \ +X El Capitan is nominally 2.7.10, but is missing TLS v1.2 support. Exiting." + exit(1) + parser = argparse.ArgumentParser() parser.add_argument("filename", help="The .ipa file to deploy.") parser.add_argument("-c", "--comment", help="Comment to display to the installer")