むっちゃ汚いけどこんな感じか?
#coding: UTF-8
import glob
import struct
masks = (
b'\x49',b'\x6E',b'\x70',b'\x75',b'\x74',b'\x4F',b'\x72',b'\x69',
b'\x67',b'\x69',b'\x6E',b'\x61',b'\x6C',b'\x4B',b'\x65',b'\x79')
files = glob.glob('*.utage')
for fn1 in files:
fn2 = fn1.replace('.utage', '')
with open(fn1, "rb") as fh1:
with open(fn2, "wb") as fh2:
i = 0
while True:
v = fh1.read(1)
if (len(v) == 0):
print('できた?')
exit()
if (v != b'\x00'):
m = masks[i % len(masks)]
v = ord(v) ^ ord(m)
fh2.write(v.to_bytes(1, 'little'))
else:
fh2.write(v)
i += 1