Skip to content

Commit

Permalink
improve too broad expetions
Browse files Browse the repository at this point in the history
  • Loading branch information
ThunderEX committed May 18, 2017
1 parent 4130ac4 commit 97d8138
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion kmsBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# sqlite3 is optional
try:
import sqlite3
except:
except ImportError:
pass

appIds = {
Expand Down

0 comments on commit 97d8138

Please sign in to comment.