133 lines
4.0 KiB
Python
133 lines
4.0 KiB
Python
"""Wave dispatcher: register crowllm accounts across bank domains with proxy rotation.
|
|
|
|
Each round: pick a domain, run N workers in parallel (one proxy each), count keys.
|
|
Two consecutive rounds with zero keys on a domain -> move to the next domain.
|
|
"""
|
|
import json, os, subprocess, sys, time, collections
|
|
|
|
BANK = "C:/Users/User/tmp/crowllm/crowllm_bank.jsonl"
|
|
GMAIL = "C:/Users/User/tmp/coarena/gmail_bank.jsonl"
|
|
FAIL = "C:/Users/User/tmp/crowllm/crowllm_fail.jsonl"
|
|
PY = "C:/Users/User/AppData/Local/Programs/Python/Python311/python.exe"
|
|
REG = "C:/Users/User/tmp/crowllm/crowllm_reg.py"
|
|
LOG = "C:/Users/User/tmp/crowllm/wave_all.log.txt"
|
|
PROXIES = ["http://127.0.0.1:9431", "http://127.0.0.1:9432", "http://127.0.0.1:9433",
|
|
"http://127.0.0.1:9434", "http://127.0.0.1:9435", "http://127.0.0.1:8899", ""]
|
|
SKIP = {"goldenrod.netflows.us", "educomb.us", "raziia.com"}
|
|
ROUNDS_PER_DOMAIN = 3
|
|
MAX_MINUTES = 75
|
|
|
|
log = open(LOG, "a", encoding="utf-8")
|
|
|
|
|
|
def L(*a):
|
|
s = time.strftime("%H:%M:%S ") + " ".join(str(x) for x in a)
|
|
log.write(s + "\n"); log.flush()
|
|
print(s.encode("ascii", "replace").decode(), flush=True)
|
|
|
|
|
|
def used_emails():
|
|
s = set()
|
|
for f in (BANK, FAIL):
|
|
try:
|
|
for line in open(f, encoding="utf-8"):
|
|
line = line.strip()
|
|
if line:
|
|
try:
|
|
s.add(json.loads(line).get("email"))
|
|
except Exception:
|
|
pass
|
|
except FileNotFoundError:
|
|
pass
|
|
return s
|
|
|
|
|
|
def free_by_domain():
|
|
used = used_emails()
|
|
dom = collections.Counter()
|
|
for line in open(GMAIL, encoding="utf-8"):
|
|
line = line.strip()
|
|
if not line:
|
|
continue
|
|
try:
|
|
j = json.loads(line)
|
|
except Exception:
|
|
continue
|
|
e = j.get("email")
|
|
d = e.split("@")[-1] if e else None
|
|
if not e or e in used or d in SKIP:
|
|
continue
|
|
dom[d] += 1
|
|
return dom
|
|
|
|
|
|
def key_count():
|
|
try:
|
|
return sum(1 for line in open(BANK, encoding="utf-8") if line.strip())
|
|
except FileNotFoundError:
|
|
return 0
|
|
|
|
|
|
def run_round(domain, idx_base, workers=6):
|
|
procs = []
|
|
for i in range(workers):
|
|
px = PROXIES[i % len(PROXIES)]
|
|
env = dict(os.environ)
|
|
env["PYTHONUNBUFFERED"] = "1"
|
|
env["PYTHONIOENCODING"] = "utf-8"
|
|
env.pop("PYTHONPATH", None)
|
|
if px:
|
|
env["CROWL_PROXY"] = px
|
|
else:
|
|
env.pop("CROWL_PROXY", None)
|
|
tag = "wv%s_%d" % (idx_base, i)
|
|
f = open("C:/Users/User/tmp/crowllm/%s.log" % tag, "w")
|
|
p = subprocess.Popen([PY, "-u", REG, domain, tag], stdout=f, stderr=subprocess.STDOUT, env=env)
|
|
procs.append((p, f, tag))
|
|
time.sleep(2)
|
|
for p, f, tag in procs:
|
|
try:
|
|
p.wait(timeout=420)
|
|
except Exception:
|
|
p.kill()
|
|
f.close()
|
|
return len(procs)
|
|
|
|
|
|
def main():
|
|
start = time.time()
|
|
budget = MAX_MINUTES * 60
|
|
total_start = key_count()
|
|
L("=== wave start, keys:", total_start)
|
|
dom = free_by_domain()
|
|
order = [d for d, _ in dom.most_common()]
|
|
L("domains by free count:", dict(dom.most_common(10)))
|
|
idx = int(time.time()) % 10000
|
|
for d in order:
|
|
if time.time() - start > budget:
|
|
L("budget exhausted"); break
|
|
if dom[d] < 3:
|
|
continue
|
|
zero = 0
|
|
for rnd in range(ROUNDS_PER_DOMAIN):
|
|
if time.time() - start > budget:
|
|
break
|
|
before = key_count()
|
|
idx += 1
|
|
run_round(d, idx)
|
|
after = key_count()
|
|
got = after - before
|
|
L(f"domain={d} round={rnd} +{got} (total {after})")
|
|
if got == 0:
|
|
zero += 1
|
|
if zero >= 2:
|
|
L(f"domain={d} burned, next")
|
|
break
|
|
else:
|
|
zero = 0
|
|
time.sleep(5)
|
|
L("=== wave done, keys:", key_count(), "delta:", key_count() - total_start)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |