{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport matplotlib.pyplot as plt\n\nfrom PIL import Image, ImageOps\n\nimport requests\nimport json\nimport base64\n\nfrom scipy.linalg import dft","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-09-11T23:55:05.701865Z","iopub.execute_input":"2022-09-11T23:55:05.702782Z","iopub.status.idle":"2022-09-11T23:55:05.926043Z","shell.execute_reply.started":"2022-09-11T23:55:05.702689Z","shell.execute_reply":"2022-09-11T23:55:05.924985Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"with Image.open(\"../input/ai-village-ctf/secret.sloth/secret-sloth.png\") as img:\n    secret = np.array(img)[:,:,0:3]/255\n\nplt.imshow(secret)\nplt.rcParams[\"figure.figsize\"] = (10,10)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-09-11T23:55:05.927708Z","iopub.execute_input":"2022-09-11T23:55:05.928004Z","iopub.status.idle":"2022-09-11T23:55:06.220229Z","shell.execute_reply.started":"2022-09-11T23:55:05.927976Z","shell.execute_reply":"2022-09-11T23:55:06.218877Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"m = dft(500)\nx = m @ secret\nplt.imshow(x.real)","metadata":{"execution":{"iopub.status.busy":"2022-09-11T23:55:06.221380Z","iopub.execute_input":"2022-09-11T23:55:06.221772Z","iopub.status.idle":"2022-09-11T23:55:06.753864Z","shell.execute_reply.started":"2022-09-11T23:55:06.221732Z","shell.execute_reply":"2022-09-11T23:55:06.753069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Submission Helper\n\ntry:\n    r = requests.post(\"http://flags.fly.dev:5000/score\", json=json.dumps({\"challenge_id\": \"sloth\", \"submission\": \"FLAG{SPECTRAL}\"}))\n    print(r.text)\nexcept requests.exceptions.ConnectionError:\n    print(\"Connection problems. Contact the CTF organizers.\")","metadata":{"execution":{"iopub.status.busy":"2022-09-11T23:55:06.755627Z","iopub.execute_input":"2022-09-11T23:55:06.756459Z","iopub.status.idle":"2022-09-11T23:55:06.908375Z","shell.execute_reply.started":"2022-09-11T23:55:06.756423Z","shell.execute_reply":"2022-09-11T23:55:06.907078Z"},"trusted":true},"execution_count":null,"outputs":[]}]}