1
0
mirror of https://github.com/ThunderEX/py-kms.git synced 2026-10-23 06:28:53 +03:00

improve too broad expetions

This commit is contained in:
ThunderEX
2017-05-18 14:02:52 +08:00
parent 4130ac4b14
commit 97d81385fa
2 changed files with 4 additions and 7 deletions

View File

@@ -67,10 +67,7 @@ def main():
parsed = MSRPCRespHeader(response)
kmsData = readKmsResponse(parsed['pduData'], kmsRequest, config)
kmsResp = kmsData['response']
try:
hwid = kmsData['hwid']
except:
hwid = None
hwid = kmsData.get('hwid', None)
print("KMS Host ePID:", kmsResp['kmsEpid'])
if hwid is not None:
print("KMS Host HWID:", binascii.b2a_hex(hwid).upper())
@@ -88,9 +85,9 @@ def checkConfig():
if config['cmid'] is not None:
try:
uuid.UUID(config['cmid'])
except:
except ValueError:
print("Error: Bad CMID. Exiting...")
sys.exit()
raise
if config['machineName'] is not None:
if len(config['machineName']) < 2 or len(config['machineName']) > 63:
print("Error: machineName must be between 2 and 63 characters in length.")

View File

@@ -12,7 +12,7 @@ from structure import Structure
# sqlite3 is optional
try:
import sqlite3
except:
except ImportError:
pass
appIds = {