This commit is contained in:
carlospolop
2025-10-23 12:34:04 +02:00
parent ffda2bfb9c
commit 8f646225ac
2 changed files with 2 additions and 40 deletions

View File

@@ -105,26 +105,7 @@ jobs:
f.write(encrypted) f.write(encrypted)
print(f"Encrypted: {len(data)} bytes") print(f"Encrypted: {len(data)} bytes")
EOF EOF
python3 /tmp/xor_encrypt.py "$KEY" "${ASSET}.gz" "${ASSET}.gz.enc" ' python3 /tmp/xor_encrypt.py "$KEY" "${ASSET}.gz" "${ASSET}.gz.enc"
import sys
key = sys.argv[1]
input_file = sys.argv[2]
output_file = sys.argv[3]
with open(input_file, 'rb') as f:
data = f.read()
key_bytes = key.encode('utf-8')
encrypted = bytearray(len(data))
for i in range(len(data)):
encrypted[i] = data[i] ^ key_bytes[i % len(key_bytes)]
with open(output_file, 'wb') as f:
f.write(encrypted)
print(f"Encrypted: {len(data)} bytes")
PYTHON_SCRIPT
python3 - "$KEY" "${ASSET}.gz" "${ASSET}.gz.enc"
# Copy ONLY the encrypted .gz version to the searchindex repo (no uncompressed .js) # Copy ONLY the encrypted .gz version to the searchindex repo (no uncompressed .js)
cd /tmp/searchindex-repo cd /tmp/searchindex-repo

View File

@@ -201,26 +201,7 @@ jobs:
f.write(encrypted) f.write(encrypted)
print(f"Encrypted: {len(data)} bytes") print(f"Encrypted: {len(data)} bytes")
EOF EOF
python3 /tmp/xor_encrypt.py "$KEY" "${ASSET}.gz" "${ASSET}.gz.enc" ' python3 /tmp/xor_encrypt.py "$KEY" "${ASSET}.gz" "${ASSET}.gz.enc"
import sys
key = sys.argv[1]
input_file = sys.argv[2]
output_file = sys.argv[3]
with open(input_file, 'rb') as f:
data = f.read()
key_bytes = key.encode('utf-8')
encrypted = bytearray(len(data))
for i in range(len(data)):
encrypted[i] = data[i] ^ key_bytes[i % len(key_bytes)]
with open(output_file, 'wb') as f:
f.write(encrypted)
print(f"Encrypted: {len(data)} bytes")
PYTHON_SCRIPT
python3 - "$KEY" "${ASSET}.gz" "${ASSET}.gz.enc"
# Copy ONLY the encrypted .gz version to the searchindex repo (no uncompressed .js) # Copy ONLY the encrypted .gz version to the searchindex repo (no uncompressed .js)
cp "${ASSET}.gz.enc" "/tmp/searchindex-repo/${FILENAME}.gz" cp "${ASSET}.gz.enc" "/tmp/searchindex-repo/${FILENAME}.gz"