hod24-ctf/calc/jail.py

15 lines
419 B
Python
Raw Permalink Normal View History

2024-12-03 14:23:50 +01:00
#!/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__)