Skip to content

Commit

Permalink
Use ReleaseDate instead of MinDate
Browse files Browse the repository at this point in the history
Made InvalidWinBuild/NCountPolicy optional

Signed-off-by: simonmicro <[email protected]>
  • Loading branch information
simonmicro committed May 28, 2024
1 parent a639486 commit 6249163
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion py-kms/pykms_Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def client_update():
if sName == name + 'Enterprise' or \
sName == name[:6] + 'ProfessionalPlus' + name[6:]:
clt_config['KMSClientSkuID'] = skuitem['Id']
clt_config['RequiredClientCount'] = int(kmsitem['NCountPolicy'])
clt_config['RequiredClientCount'] = int(kmsitem.get('NCountPolicy', 25)) # if not given default to 25
clt_config['KMSProtocolMajorVersion'] = int(float(kmsitem['DefaultKmsProtocol']))
clt_config['KMSProtocolMinorVersion'] = 0
clt_config['KMSClientLicenseStatus'] = 2
Expand Down
9 changes: 5 additions & 4 deletions py-kms/pykms_PidGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def epidGenerator(kmsId, version, lcid):
for csvlkitem in csvlkitems:
try:
if kmsId in [ uuid.UUID(kmsitem) for kmsitem in csvlkitem['Activate'] ]:
pkeys.append( (csvlkitem['GroupId'], csvlkitem['MinKeyId'], csvlkitem['MaxKeyId'], csvlkitem['InvalidWinBuild']) )
pkeys.append( (csvlkitem['GroupId'], csvlkitem['MinKeyId'], csvlkitem['MaxKeyId'], csvlkitem.get('InvalidWinBuild', '[]')) )
else:
# fallback to Windows Server 2019 parameters.
pkeys.append( ('206', '551000000', '570999999', '[0,1,2]') )
Expand All @@ -40,10 +40,11 @@ def epidGenerator(kmsId, version, lcid):
hosts.append(winbuild)
except KeyError:
# fallback to Windows Server 2019 parameters.
hosts.append( {'BuildNumber':'17763', 'PlatformId':'3612', 'MinDate':'02/10/2018'} )
hosts.append( {'BuildNumber':'17763', 'PlatformId':'3612', 'ReleaseDate':'2018-02-10T00:00:00Z'} )

host = random.choice(hosts)
BuildNumber, PlatformId, MinDate = host['BuildNumber'], host['PlatformId'], host['MinDate']

BuildNumber, PlatformId, ReleaseDate = host['BuildNumber'], host['PlatformId'], host['ReleaseDate']

# Generate Part 3 and Part 4: Product Key ID
productKeyID = random.randint(MinKeyId, MaxKeyId)
Expand All @@ -55,7 +56,7 @@ def epidGenerator(kmsId, version, lcid):
languageCode = lcid # (C# CultureInfo.InstalledUICulture.LCID)

# Generate Part 8: KMS Host Activation Date
d = datetime.datetime.strptime(MinDate, "%d/%m/%Y")
d = datetime.datetime.fromisoformat(ReleaseDate)
minTime = datetime.date(d.year, d.month, d.day)

# Generate Year and Day Number
Expand Down

0 comments on commit 6249163

Please sign in to comment.