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:
@@ -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.")
|
||||
|
||||
@@ -12,7 +12,7 @@ from structure import Structure
|
||||
# sqlite3 is optional
|
||||
try:
|
||||
import sqlite3
|
||||
except:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
appIds = {
|
||||
|
||||
Reference in New Issue
Block a user