41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
import base64, re, sys, html
|
|
|
|
def rpp_params(path):
|
|
txt = open(path, encoding='utf8', errors='ignore').read()
|
|
lines = txt.split('\n')
|
|
for i, l in enumerate(lines):
|
|
if 'soothe2_x64.vst3' in l:
|
|
break
|
|
b = []
|
|
for l in lines[i + 1:]:
|
|
if l.strip() == '}':
|
|
break
|
|
b.append(l.strip())
|
|
raw = re.sub(r'[^A-Za-z0-9+/=]', '', ''.join(b))
|
|
raw = raw.rstrip('=')
|
|
# drop chars until b64 len divisible by 4 (the leading binary header causes odd)
|
|
while (len(raw) % 4) != 0:
|
|
raw = raw[:-1]
|
|
padded = raw + '=' * ((-len(raw)) % 4)
|
|
dec = base64.b64decode(padded, validate=False)
|
|
p = dec.find(b'<?xml')
|
|
xml = dec[p:].decode('utf8', 'ignore')
|
|
xml = html.unescape(xml)
|
|
params = dict(re.findall(r'<PARAM id="([^"]+)" value="([^"]+)"', xml))
|
|
# also decode processorStateData inner
|
|
proc = re.search(r'processorStateData="([^"]+)"', xml)
|
|
if proc:
|
|
inner = proc.group(1)
|
|
try:
|
|
inner_dec = base64.b64decode(re.sub(r'\s', '', inner))
|
|
print(' [processorStateData inner]', inner_dec.decode('utf8', 'ignore')[:400])
|
|
except Exception as e:
|
|
print(' proc inner err', e)
|
|
return params
|
|
|
|
for f in sys.argv[1:]:
|
|
p = rpp_params(f)
|
|
print('===', f.split('/')[-1])
|
|
for k in sorted(p):
|
|
print(f' {k:24s} = {p[k]}') |