hod24-ctf/calc/jail.py
2024-12-03 14:23:50 +01:00

14 lines
419 B
Python
Executable file

#!/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__)