#!/bin/sh # NEWNYM separates new requests from old dirty circuits, but is rate-limited. response=$(printf 'AUTHENTICATE\r\nSIGNAL NEWNYM\r\nQUIT\r\n' | nc -w 5 127.0.0.1 9051) if [ "$(printf '%s\n' "$response" | tr -d '\r' | grep -c '^250 OK$')" -ne 2 ]; then printf 'Control command failed:\n%s\n' "$response" >&2 exit 1 fi printf 'NEWNYM accepted. Wait at least 10 seconds before another NEWNYM.\n' printf 'Run request again. A different path is not guaranteed.\n'