Created
April 28, 2017 14:21
-
-
Save ardinusawan/ae495b7801f89eec8e7cbd5a11665991 to your computer and use it in GitHub Desktop.
Secret Key [Hackerrank CTF] - Medium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.hackerrank.com/contests/capture-the-flag/challenges/secret-key/copy-from/1301466914 | |
from urllib import urlopen | |
import json | |
import ast | |
url = urlopen('https://cdn.hackerrank.com/hackerrank/static/contests/capture-the-flag/secret/key.json').read().decode('utf8') | |
result = json.dumps(json.loads(url)) | |
result = ast.literal_eval(result) | |
i = 0 | |
data = list() | |
for x in result.keys(): | |
url = "https://cdn.hackerrank.com/hackerrank/static/contests/capture-the-flag/secret/secret_json/" | |
url = url + x + ".json" | |
url = urlopen(url).read().decode('utf8') | |
result = json.dumps(json.loads(url)) | |
result = ast.literal_eval(result) | |
data.append(result["news_title"]) | |
print(result) | |
i += 1 | |
print("data :", i) | |
data = sorted(data) | |
for x in data: | |
print(str(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment