import os, sys, time, subprocess for k, p in enumerate(range(16970, 16978), 1): sdir = "/opt/ani_rs/data_" + str(p) os.makedirs(sdir, mode=0o700, exist_ok=True) os.chmod(sdir, 0o700) chk = subprocess.check_output("ss -tln 2>/dev/null | grep -c ':" + str(p) + " ' || true", shell=True).decode().strip() if chk == "0": btype = "macos" if (p % 2 == 0) else "windows" env = os.environ.copy() px_p = 10810 + (k % 4) env["HTTPS_PROXY"] = "http://127.0.0.1:" + str(px_p) env["HTTP_PROXY"] = "http://127.0.0.1:" + str(px_p) lf = open("/opt/ani_rs/ani_" + str(p) + ".log", "ab") subprocess.Popen( ["/opt/ani_rs/lib/ld-linux-x86-64.so.2", "--library-path", "/opt/ani_rs/lib", "/opt/ani_rs/anisette-server", "--backend", btype, "--listen", "127.0.0.1:" + str(p), "--state-dir", sdir], stdin=subprocess.DEVNULL, stdout=lf, stderr=subprocess.STDOUT, env=env, close_fds=True, start_new_session=True ) time.sleep(1.5 + (198 % 12) * 0.4) sys.path.insert(0, '/root') try: import check try: os.remove('/tmp/jc_desktop_ani_refresh.lock') except Exception: pass if os.path.isfile('/dev/shm/jc_desktop_ani_pool.json'): os.utime('/dev/shm/jc_desktop_ani_pool.json', (0, 0)) check._refresh_desktop_ani_shm_once() except Exception: pass subprocess.call("pkill -f '[p]ython3 -u (/root/)?check\.py' 2>/dev/null || true", shell=True)