Typos, extra imports and similar
- pointed out by landscape.io - also updated dev/ssltest.py to work the same way as the main program
This commit is contained in:
parent
689d697a40
commit
5ca8a52662
|
@ -22,6 +22,12 @@ def sslProtocolVersion():
|
||||||
# "TLSv1.2" in < 2.7.9
|
# "TLSv1.2" in < 2.7.9
|
||||||
return ssl.PROTOCOL_TLSv1
|
return ssl.PROTOCOL_TLSv1
|
||||||
|
|
||||||
|
def sslProtocolCiphers():
|
||||||
|
if ssl.OPENSSL_VERSION_NUMBER >= 0x10100000:
|
||||||
|
return "AECDH-AES256-SHA@SECLEVEL=0"
|
||||||
|
else:
|
||||||
|
return "AECDH-AES256-SHA"
|
||||||
|
|
||||||
def connect():
|
def connect():
|
||||||
sock = socket.create_connection((HOST, PORT))
|
sock = socket.create_connection((HOST, PORT))
|
||||||
return sock
|
return sock
|
||||||
|
@ -36,14 +42,14 @@ def listen():
|
||||||
def sslHandshake(sock, server=False):
|
def sslHandshake(sock, server=False):
|
||||||
if sys.version_info >= (2,7,9):
|
if sys.version_info >= (2,7,9):
|
||||||
context = ssl.SSLContext(sslProtocolVersion())
|
context = ssl.SSLContext(sslProtocolVersion())
|
||||||
context.set_ciphers("AECDH-AES256-SHA")
|
context.set_ciphers(sslProtocolCiphers())
|
||||||
context.set_ecdh_curve("secp256k1")
|
context.set_ecdh_curve("secp256k1")
|
||||||
context.check_hostname = False
|
context.check_hostname = False
|
||||||
context.verify_mode = ssl.CERT_NONE
|
context.verify_mode = ssl.CERT_NONE
|
||||||
context.options = ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_SINGLE_ECDH_USE | ssl.OP_CIPHER_SERVER_PREFERENCE
|
context.options = ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_SINGLE_ECDH_USE | ssl.OP_CIPHER_SERVER_PREFERENCE
|
||||||
sslSock = context.wrap_socket(sock, server_side = server, do_handshake_on_connect=False)
|
sslSock = context.wrap_socket(sock, server_side = server, do_handshake_on_connect=False)
|
||||||
else:
|
else:
|
||||||
sslSock = ssl.wrap_socket(self.sock, keyfile = os.path.join('src', 'sslkeys', 'key.pem'), certfile = os.path.join('src', 'sslkeys', 'cert.pem'), server_side = server, ssl_version=sslProtocolVersion(), do_handshake_on_connect=False, ciphers='AECDH-AES256-SHA')
|
sslSock = ssl.wrap_socket(sock, keyfile = os.path.join('src', 'sslkeys', 'key.pem'), certfile = os.path.join('src', 'sslkeys', 'cert.pem'), server_side = server, ssl_version=sslProtocolVersion(), do_handshake_on_connect=False, ciphers='AECDH-AES256-SHA')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -51,11 +57,11 @@ def sslHandshake(sock, server=False):
|
||||||
break
|
break
|
||||||
except ssl.SSLWantReadError:
|
except ssl.SSLWantReadError:
|
||||||
print "Waiting for SSL socket handhake read"
|
print "Waiting for SSL socket handhake read"
|
||||||
select.select([self.sslSock], [], [], 10)
|
select.select([sslSock], [], [], 10)
|
||||||
except ssl.SSLWantWriteError:
|
except ssl.SSLWantWriteError:
|
||||||
print "Waiting for SSL socket handhake write"
|
print "Waiting for SSL socket handhake write"
|
||||||
select.select([], [self.sslSock], [], 10)
|
select.select([], [sslSock], [], 10)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
print "SSL socket handhake failed, shutting down connection"
|
print "SSL socket handhake failed, shutting down connection"
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return
|
return
|
||||||
|
|
|
@ -33,7 +33,6 @@ from struct import pack
|
||||||
from helper_sql import sqlQuery,sqlExecute,SqlBulkExecute,sqlStoredProcedure
|
from helper_sql import sqlQuery,sqlExecute,SqlBulkExecute,sqlStoredProcedure
|
||||||
from debug import logger
|
from debug import logger
|
||||||
from inventory import Inventory
|
from inventory import Inventory
|
||||||
import state
|
|
||||||
from version import softwareVersion
|
from version import softwareVersion
|
||||||
|
|
||||||
# Helper Functions
|
# Helper Functions
|
||||||
|
|
|
@ -2392,8 +2392,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
except:
|
except:
|
||||||
QMessageBox.about(self, _translate("MainWindow", "Number needed"), _translate(
|
QMessageBox.about(self, _translate("MainWindow", "Number needed"), _translate(
|
||||||
"MainWindow", "Your maximum download and upload rate must be numbers. Ignoring what you typed."))
|
"MainWindow", "Your maximum download and upload rate must be numbers. Ignoring what you typed."))
|
||||||
throttle.SendThrottle.resetLimit()
|
throttle.SendThrottle().resetLimit()
|
||||||
throttle.ReceiveThrottle.resetLimit()
|
throttle.ReceiveThrottle().resetLimit()
|
||||||
|
|
||||||
BMConfigParser().set('bitmessagesettings', 'namecoinrpctype',
|
BMConfigParser().set('bitmessagesettings', 'namecoinrpctype',
|
||||||
self.settingsDialogInstance.getNamecoinType())
|
self.settingsDialogInstance.getNamecoinType())
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import errno
|
import errno
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
import shared
|
|
||||||
import Queue
|
import Queue
|
||||||
from struct import unpack, pack
|
from struct import unpack, pack
|
||||||
import hashlib
|
import hashlib
|
||||||
|
@ -9,7 +8,6 @@ import random
|
||||||
import sys
|
import sys
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
from configparser import BMConfigParser
|
|
||||||
from helper_generic import addDataPadding
|
from helper_generic import addDataPadding
|
||||||
from class_objectHashHolder import *
|
from class_objectHashHolder import *
|
||||||
from addresses import *
|
from addresses import *
|
||||||
|
|
Reference in New Issue
Block a user