add legacy override
This commit is contained in:
parent
a03a9e1018
commit
92e0e2e405
14
hblink.py
14
hblink.py
@ -240,7 +240,7 @@ class HBSYSTEM(DatagramProtocol):
|
|||||||
#Change this to a config value
|
#Change this to a config value
|
||||||
user_man_url = self._CONFIG['USER_MANAGER']['URL']
|
user_man_url = self._CONFIG['USER_MANAGER']['URL']
|
||||||
shared_secret = self._CONFIG['USER_MANAGER']['SHARED_SECRET']
|
shared_secret = self._CONFIG['USER_MANAGER']['SHARED_SECRET']
|
||||||
print(int(str(int_id(_id))[:7]))
|
#print(int(str(int_id(_id))[:7]))
|
||||||
auth_check = {
|
auth_check = {
|
||||||
'id':int(str(int_id(_id))[:7]),
|
'id':int(str(int_id(_id))[:7]),
|
||||||
'secret':shared_secret
|
'secret':shared_secret
|
||||||
@ -493,6 +493,9 @@ class HBSYSTEM(DatagramProtocol):
|
|||||||
_this_peer['LAST_PING'] = time()
|
_this_peer['LAST_PING'] = time()
|
||||||
_sent_hash = _data[8:]
|
_sent_hash = _data[8:]
|
||||||
_salt_str = bytes_4(_this_peer['SALT'])
|
_salt_str = bytes_4(_this_peer['SALT'])
|
||||||
|
# Used to allow config passphrase AND calculated.
|
||||||
|
_ocalc_hash = bhex(sha256(_salt_str+self._config['PASSPHRASE']).hexdigest())
|
||||||
|
|
||||||
#print(self.ums_response)
|
#print(self.ums_response)
|
||||||
if self._config['USE_USER_MAN'] == True:
|
if self._config['USE_USER_MAN'] == True:
|
||||||
## print(self._CONFIG['USER_MANAGER']['SHORTEN_PASSPHRASE'])
|
## print(self._CONFIG['USER_MANAGER']['SHORTEN_PASSPHRASE'])
|
||||||
@ -503,7 +506,6 @@ class HBSYSTEM(DatagramProtocol):
|
|||||||
_calc_hash = bhex(sha256(_salt_str+str.encode(self.ums_response['value'])).hexdigest())
|
_calc_hash = bhex(sha256(_salt_str+str.encode(self.ums_response['value'])).hexdigest())
|
||||||
if self.ums_response['mode'] == 'normal':
|
if self.ums_response['mode'] == 'normal':
|
||||||
_new_peer_id = bytes_4(int(str(int_id(_peer_id))[:7]))
|
_new_peer_id = bytes_4(int(str(int_id(_peer_id))[:7]))
|
||||||
## print(int_id(_new_peer_id))
|
|
||||||
#print(self._CONFIG['USER_MANAGER']['APPEND_INT'])
|
#print(self._CONFIG['USER_MANAGER']['APPEND_INT'])
|
||||||
if self._CONFIG['USER_MANAGER']['SHORTEN_PASSPHRASE'] == True:
|
if self._CONFIG['USER_MANAGER']['SHORTEN_PASSPHRASE'] == True:
|
||||||
calc_passphrase = base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))
|
calc_passphrase = base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))
|
||||||
@ -514,8 +516,7 @@ class HBSYSTEM(DatagramProtocol):
|
|||||||
_calc_hash = bhex(sha256(_salt_str+calc_passphrase).hexdigest())
|
_calc_hash = bhex(sha256(_salt_str+calc_passphrase).hexdigest())
|
||||||
ums_down = False
|
ums_down = False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
## # If UMS down, default to base 64 auth
|
## # If UMS down, default to base 64 auth
|
||||||
## logger.info(e)
|
|
||||||
_new_peer_id = bytes_4(int(str(int_id(_peer_id))[:7]))
|
_new_peer_id = bytes_4(int(str(int_id(_peer_id))[:7]))
|
||||||
if self._CONFIG['USER_MANAGER']['SHORTEN_PASSPHRASE'] == True:
|
if self._CONFIG['USER_MANAGER']['SHORTEN_PASSPHRASE'] == True:
|
||||||
calc_passphrase = base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))
|
calc_passphrase = base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['USER_MANAGER']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))
|
||||||
@ -526,7 +527,10 @@ class HBSYSTEM(DatagramProtocol):
|
|||||||
ums_down = True
|
ums_down = True
|
||||||
if self._config['USE_USER_MAN'] == False:
|
if self._config['USE_USER_MAN'] == False:
|
||||||
_calc_hash = bhex(sha256(_salt_str+self._config['PASSPHRASE']).hexdigest())
|
_calc_hash = bhex(sha256(_salt_str+self._config['PASSPHRASE']).hexdigest())
|
||||||
if _sent_hash == _calc_hash or (ums_down == True and _sent_hash == _calc_hash):
|
|
||||||
|
## if _sent_hash == _calc_hash or (ums_down == True and _sent_hash == _calc_hash):
|
||||||
|
|
||||||
|
if _sent_hash == _calc_hash or (ums_down == True and _sent_hash == _calc_hash) or (ums_down == False and _sent_hash == _ocalc_hash):
|
||||||
_this_peer['CONNECTION'] = 'WAITING_CONFIG'
|
_this_peer['CONNECTION'] = 'WAITING_CONFIG'
|
||||||
self.send_peer(_peer_id, b''.join([RPTACK, _peer_id]))
|
self.send_peer(_peer_id, b''.join([RPTACK, _peer_id]))
|
||||||
logger.info('(%s) Peer %s has completed the login exchange successfully', self._system, _this_peer['RADIO_ID'])
|
logger.info('(%s) Peer %s has completed the login exchange successfully', self._system, _this_peer['RADIO_ID'])
|
||||||
|
Loading…
Reference in New Issue
Block a user