28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
import struct, subprocess, time, os, glob
|
|
def find_host():
|
|
for p in glob.glob('/proc/[0-9]*'):
|
|
pid=int(os.path.basename(p))
|
|
try:
|
|
cmd=open('/proc/%d/cmdline'%pid,'rb').read().replace(b'\0',b' ').decode('utf8','replace')
|
|
maps=open('/proc/%d/maps'%pid).read()
|
|
except Exception: continue
|
|
if 'soothe2' in maps and 'reaper' not in cmd: return pid
|
|
return None
|
|
subprocess.run("pkill -9 -x reaper; sleep 1; rm -rf /run/user/1000/yabridge-soothe2_x64-*",shell=True)
|
|
proc=subprocess.Popen(['/usr/bin/reaper','-nosplash','-ignoreerrors','-renderproject','/tmp/opencode/multi.rpp'],
|
|
stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
|
|
t0=time.time();host=None
|
|
while time.time()-t0<30 and not host: host=find_host();time.sleep(0.002)
|
|
print('host',host,flush=True)
|
|
fd=os.open('/proc/%d/mem'%host,os.O_RDONLY)
|
|
ctx=0x2370040
|
|
for k in range(40):
|
|
try:
|
|
b=os.pread(fd,8,ctx+0x540668)
|
|
v=struct.unpack('<Q',b)[0]
|
|
print('t=%.1f [ctx+540668]=%x' % (time.time()-t0,v), flush=True)
|
|
except OSError as e:
|
|
print('read fail',e)
|
|
time.sleep(0.3)
|