Created
July 9, 2021 20:50
-
-
Save vesche/e9e0e07221e463e63d1bad67542d483c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import marshal, types | |
# >>> def x(): | |
# ... return eval | |
# ... | |
# >>> x()('2+2') | |
# 4 | |
# >>> import marshal | |
# >>> marshal.dumps(x.__code__) | |
# ... | |
result = types.FunctionType(marshal.loads( | |
b'\xe3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00C\x00\x00\x00s\x04\x00\x00\x00t\x00S\x00)\x01N)\x01\xda\x04eval\xa9\x00r\x02\x00\x00\x00r\x02\x00\x00\x00\xfa\x07<stdin>\xda\x01x\x01\x00\x00\x00\xf3\x00\x00\x00\x00' | |
), locals())()('2+2') | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment