From cdce544995712aaed058c9fa446416c7f20e2edd Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 27 Mar 2024 16:10:31 +0300 Subject: [PATCH] add tool to hardcode files --- hardcfiles.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 hardcfiles.py diff --git a/hardcfiles.py b/hardcfiles.py new file mode 100644 index 0000000..82629a3 --- /dev/null +++ b/hardcfiles.py @@ -0,0 +1,21 @@ +import pickle +import base64 +import sys +import zlib + + +files = {} + +for name in sys.argv[1:]: + name = name.replace("\\", "/") + if name.startswith("./"): + name = name[2:] + + with open(name, "rb") as f: + data = f.read() + files[name] = data + +data = pickle.dumps(files) +compressed_data = zlib.compress(data, 9) + +print(base64.b85encode(compressed_data).decode("ascii"))