Untitled
unknown
plain_text
3 years ago
1.3 kB
8
Indexable
import json
import jwt
import base64
import random
keyIds = []
StatickKeyId = "7459975d-b2f8-48ed-a325-56e4f34d19c7"
keyIds.append(StatickKeyId)
tokenCount = 2
randGuidCount = 3
tokens = []
for x in range(0, tokenCount):
guidNums = []
for i in range(0, randGuidCount):
guidNums.append(random.randint(0, tokenCount))
with open("guids.json") as f:
data = json.load(f)
for k in guidNums:
keyIds.append(data[k]["id"])
print(keyIds)
communicationKeyId = "69e54088-e9e0-4530-8c1a-1eb6dcd0d14e"
communicationKeyAsBase64 = "SGEpLQJ+JpeRCTMn5izu/b6kiaTH5aSXTMkEuED9fA8="
entitlementMessage = {
"type": "entitlement_message",
"version": 2,
"content_keys_source": {
"inline": keyIds
}
}
licenseServiceMessage = {
"version": 1,
"com_key_id": communicationKeyId,
"message": entitlementMessage
}
communicationKey = base64.b64decode(communicationKeyAsBase64)
jwtAsString = jwt.encode(payload=licenseServiceMessage, key=communicationKey, algorithm='HS256')
tokens.append(jwtAsString)
f = open('tokens.csv', 'w')
for token in tokens:
print(token)
f.write(token+'\n')
f.close()
Editor is loading...