Skip to content

Instantly share code, notes, and snippets.

@artemlos
Created February 25, 2019 12:40
Show Gist options
  • Save artemlos/0c1e8059ea69d5a2514c09150a5cd2fb to your computer and use it in GitHub Desktop.
Save artemlos/0c1e8059ea69d5a2514c09150a5cd2fb to your computer and use it in GitHub Desktop.
Get all keys in a product and write the to key.txt
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 25 13:34:54 2019
@author: Artem Los
"""
import urllib.request
import json
# from https://github.com/Cryptolens/cryptolens-python
server_address = "https://app.cryptolens.io/api/"
def send_request(method, params):
return urllib.request.urlopen(server_address + method, \
urllib.parse.urlencode(params)\
.encode("utf-8")).read().decode("utf-8")
res = list(map(lambda x: x["key"] , json.loads(send_request("Product/GetKeys", \
{"token":"access token",\
"productId":"3843",\
"page": "1"}))["licenseKeys"]))
print(res)
with open("keys.txt", 'w') as f:
for key in res:
f.write(key + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment