46 lines
1.7 KiB
Python
46 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
import base64, re, sys
|
|
|
|
def full_decode(path):
|
|
txt = open(path).read()
|
|
lines = txt.split('\n')
|
|
for i, l in enumerate(lines):
|
|
if 'soothe2_x64.vst3' in l:
|
|
b = []
|
|
j = i + 1
|
|
while j < len(lines):
|
|
t = lines[j].strip()
|
|
if t == '}':
|
|
break
|
|
b.append(t)
|
|
j += 1
|
|
raw = re.sub(r'\s', '', ''.join(b))
|
|
raw = raw.rstrip('=')
|
|
raw += '=' * ((-len(raw)) % 4)
|
|
dec = base64.b64decode(raw)
|
|
# print first bytes overview
|
|
print('decoded blob len', len(dec))
|
|
# Look for inner base64 chunked xml (soothe2 vst uses nested b64)
|
|
# search for PARAM tags in raw decoded bytes
|
|
tags = re.findall(rb'<PARAM id="([^"]+)" value="([^"]+)"', dec)
|
|
if tags:
|
|
for pid, val in tags:
|
|
print(f' {pid.decode():16s} = {val.decode()}')
|
|
else:
|
|
# try inner b64
|
|
inner = re.sub(rb'[^A-Za-z0-9+/=]', b'', dec)
|
|
inner = inner.rstrip(b'=')
|
|
inner += b'=' * ((-len(inner)) % 4)
|
|
try:
|
|
dec2 = base64.b64decode(inner)
|
|
tags = re.findall(rb'<PARAM id="([^"]+)" value="([^"]+)"', dec2)
|
|
for pid, val in tags:
|
|
print(f' {pid.decode():16s} = {val.decode()}')
|
|
except Exception as e:
|
|
print(' inner b64 fail:', e)
|
|
return
|
|
print('no soothe2_x64.vst3 found')
|
|
|
|
for f in sys.argv[1:]:
|
|
print('===', f.split('/')[-1])
|
|
full_decode(f) |