{"id":21909009,"url":"https://github.com/jayhawk24/247ctf","last_synced_at":"2026-05-15T23:03:12.717Z","repository":{"id":130218499,"uuid":"297860976","full_name":"jayhawk24/247CTF","owner":"jayhawk24","description":"Writeups From 247 CTF https://247ctf.com/dashboard","archived":false,"fork":false,"pushed_at":"2020-09-24T13:30:43.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-27T08:11:43.455Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jayhawk24.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-23T05:20:34.000Z","updated_at":"2021-10-26T22:15:13.000Z","dependencies_parsed_at":"2023-03-14T20:15:45.145Z","dependency_job_id":null,"html_url":"https://github.com/jayhawk24/247CTF","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayhawk24%2F247CTF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayhawk24%2F247CTF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayhawk24%2F247CTF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayhawk24%2F247CTF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jayhawk24","download_url":"https://codeload.github.com/jayhawk24/247CTF/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244924767,"owners_count":20532874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T17:14:54.145Z","updated_at":"2026-05-15T23:03:12.643Z","avatar_url":"https://github.com/jayhawk24.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Writeups of 247/CTF\n\n## Beginner challenges\n\n### tips and tricks  \n`  \n\n\timport socket  \n\timport re  \n\n\tHOST = 'a2befdcc18c9fdd3.247ctf.com'  \n\tPORT = 50441  \n\ttemplist = ['247', '500']  \n\tregexp = r'\\d{1,4}'  \n  \n\tcon = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  \n\tcon.connect((HOST, PORT))  \n\n\twhile True:  \n    \ttotal = 0  \n    \tdata = con.recv(1024)  \n    \t match = re.findall(regexp, repr(data))  \n    \n    \tfor num in match:  \n        \tif num not in templist:  \n            \t\ttotal += int(num)  \n    \t\tprint(repr(data))  \n    \t\tprint(\"Sending %d\" % total)  \n    \t\tbt = bytes(total)  \n    \t\tcon.sendall(bt)  \n\n`\n## Web\n\n### Secured Session\nVisiting the website shows this code.\n`\n\n    import os\n    from flask import Flask, request, session\n    from flag import flag\n    \n    app = Flask(__name__)\n    app.config['SECRET_KEY'] = os.urandom(24)\n    \n    \n    def secret_key_to_int(s):\n        try:\n            secret_key = int(s)\n        except ValueError:\n            secret_key = 0\n        return secret_key\n    \n    \n    @app.route(\"/flag\")\n    def index():\n        secret_key = secret_key_to_int(\n            request.args['secret_key']) if 'secret_key' in request.args else None\n        session['flag'] = flag\n        if secret_key == app.config['SECRET_KEY']:\n            return session['flag']\n        else:\n            return \"Incorrect secret key!\"\n    \n    \n    @app.route('/')\n    def source():\n        return \"\n    \n    \n    %s\n    \n    \" % open(__file__).read()\n    \n    if __name__ == \"__main__\":\n        app.run()\n    \n`\nSo a session is created always with this line.\n`\n\tsession['flag'] = flag\n`\n  \nWe can set our session by adding a get parameter called secret_key which will set our session and we will get our flag.  \nso goto b12fa redacted .247ctf.com/flag?secret_key  \nand you will get a cookie called   \n\nsession=eyJmbGFnIjp7Ii redacted ptPn6ECgKW2vT09o\n\ndecrypt it twice with base 64.\n  \n{\"flag\":{\" b\":\"247CTF{da807 redacted 807b9a91}\"fX0._lU-Q.LGd_\u0013µ4´~i´ùú\u0010(\n[kÓ09o\n\n### Trusted Client\nLook into the source code and you will find a javascript function which runs on submiting.  \nIt is written in js fu*k so decrypt on this website https://enkhee-osiris.github.io/Decoder-JSFuck/ it get find the flag. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayhawk24%2F247ctf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjayhawk24%2F247ctf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayhawk24%2F247ctf/lists"}