Skip to content

Instantly share code, notes, and snippets.

@ardinusawan
Created April 28, 2017 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ardinusawan/ae495b7801f89eec8e7cbd5a11665991 to your computer and use it in GitHub Desktop.
Save ardinusawan/ae495b7801f89eec8e7cbd5a11665991 to your computer and use it in GitHub Desktop.
Secret Key [Hackerrank CTF] - Medium
# 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