import os,time,json,sys
seen=set();out=[]
end=time.time()+8
while time.time()<end:
 for f in os.listdir('/proc'):
  if not f.isdigit():continue
  try:
   cmd=open('/proc/'+f+'/cmdline','rb').read().replace(b'\0',b' ').decode(errors='replace')
   if cmd.startswith('/bin/sh /usr/bin/xdg-open https://github.com/') and f not in seen:
    seen.add(f);out.append({'action':'xdg-open','url':cmd.split()[-1]})
  except OSError:pass
 time.sleep(.005)
print(json.dumps(out))
