-
Notifications
You must be signed in to change notification settings - Fork 18
/
model.py
31 lines (27 loc) · 3.31 KB
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import json
# from datetime import datetime, timezone
REDEEM_TEMPLATE = '{"status":"ok","installation":{"license_key":"","entitlement":{"term_ends_on":"9999-09-09T23:59:59.000+00:00","term_starts_on":null,"renewed_on":null,"term_type":"subscription","volume_purchased":1,"volume_status":"legal_usage","term_length":90,"volume_used":1,"status":"active","enabled":true,"abused":false,"auto_renew":"no","enforce_volume":true,"features":"grandfathered=false","products":[{"id":33,"name":"Malwarebytes Premium","customer_type":"consumer","active":true,"code":"MBHS-C","two_char_code":"HS","grace_multiplier":1.1,"grace_term_days":30,"is_trial_allowed":false,"trial_duration":0,"trial_max_volume":1,"default_key_type":"keystone","parent_id":null,"allow_grace":true,"enforce_volume":true,"sellable":true,"real_product_codes":["MBAM-C","MBMA-C","MMAC-C"],"featurable_features":[],"created_at":"2017-07-17T18:08:24Z","updated_at":"2017-07-27T19:11:35Z"}],"key":{"license_key":"","status":"active","transaction_source":"on_demand","transaction_id":"Lifetime_giveaway_offer_friends_exacttarget_5","source":"keystone","referral_key":"","subscription_id":"","subscription_secret":""},"pids":[],"running_number":null},"product":{"id":1,"name":"Malwarebytes 3 Premium","customer_type":"consumer","active":true,"code":"MBAM-C","two_char_code":"MC","grace_multiplier":3.0,"grace_term_days":30,"is_trial_allowed":true,"trial_duration":14,"trial_max_volume":0,"default_key_type":"keystone","parent_id":null,"allow_grace":true,"enforce_volume":true,"sellable":true,"real_product_codes":null,"featurable_features":[],"created_at":"2015-02-06T18:32:37Z","updated_at":"2019-07-11T16:24:36Z"},"installation_token":"","trial_status":"trial_unavailable","trial_max_volume":0,"trial_starts_on":null,"trial_ends_on":null,"machine_id":"","product_id":1,"notes":null,"product_version":"4.1.0","product_build":"consumer","ip_address":"127.0.0.1","volume_used":1,"machine_name":null,"friendly_name":null,"type":"dynamo","messageable":null,"browser_extension_trial_given":null,"last_contacted_at":"2020-03-05T06:09:07.560+00:00","registered_at":"2020-02-29T16:37:32.000+00:00","redeemed_at":"2020-03-05T06:09:07.612+00:00"}}'
class Keystone(object):
"""docstring for Keystone"""
def __init__(self):
super(Keystone, self).__init__()
self.installation_token = ""
self.license_key = "what is the license key?"
self._license_key = "what is the license key?"
self.sku = ""
self.machine_id = ""
self.name = ""
self.product_build = ""
self.product_version = ""
def getLicenseConfig(self):
redeem_json = json.loads(REDEEM_TEMPLATE)
redeem_json["installation"]["license_key"] = self.license_key
redeem_json["installation"]["entitlement"]["term_ends_on"] = "9999-09-09T23:59:59.000+00:00"
redeem_json["installation"]["entitlement"]["key"]["license_key"] = self.license_key
redeem_json["installation"]["installation_token"] = self.installation_token
redeem_json["installation"]["machine_id"] = self.machine_id
redeem_json["installation"]["friendly_name"] = self.name
redeem_json["installation"]["product_version"] = self.product_version
redeem_json["installation"]["product_build"] = self.product_build
return json.dumps(redeem_json)
keystone = Keystone()