Wed, 03 Jul 2019 22:29:26 ERROR HWID "AD" is invalid. Hex string is too short.
Wed, 03 Jul 2019 22:29:26 INFO TCP server listening at 0.0.0.0 on port 1688.
Wed, 03 Jul 2019 22:29:26 INFO HWID: AD
Wed, 03 Jul 2019 22:30:09 INFO Connection accepted: 127.0.0.1:55218
# Sanitize HWID.
try:
srv_config['hwid'] = binascii.a2b_hex(re.sub(r'[^0-9a-fA-F]', '', srv_config['hwid'].strip('0x')))
if len(binascii.b2a_hex(srv_config['hwid'])) < 16:
loggersrv.error("HWID \"%s\" is invalid. Hex string is too short." % deco(binascii.b2a_hex(srv_config['hwid']), 'utf-8').upper())
return
elif len(binascii.b2a_hex(srv_config['hwid'])) > 16:
loggersrv.error("HWID \"%s\" is invalid. Hex string is too long." % deco(binascii.b2a_hex(srv_config['hwid']), 'utf-8').upper())
return
except TypeError:
loggersrv.error("HWID \"%s\" is invalid. Odd-length hex string." % deco(binascii.b2a_hex(srv_config['hwid']), 'utf-8').upper())
return
Not return but sys.exit(). Then need optimization error cases (even short, even long, odd) and add another error when user input not hex chars (see re.sub()).
using for example with -w ATYZD
Not
return
butsys.exit()
. Then need optimization error cases (even short, even long, odd) and add another error when user input not hex chars (see re.sub()).