Browse the Tor Network with Claude (curl + socks5h)

• Networking, Tools

What you get

Claude can “browse the Tor Network" by running curl through your local Tor proxy. Both DNS and HTTP(S) stay inside Tor, so .onion works. With Ahmia, Claude can act like a simple search engine for onions: find candidates, fetch headers, skim first lines, and report back fast.

  • Proxy: 127.0.0.1:9050 (Tor SOCKS)
  • Mode: socks5h (Tor resolves hostnames)

Quick start (Fedora)

sudo dnf install tor
sudo systemctl enable --now tor
sudo ss -ltn | grep ':9050'   # expect 127.0.0.1:9050

Use with curl

One‑off:

curl --socks5-hostname 127.0.0.1:9050 http://exampleonion.onion/

Or set an env var for the session:

export ALL_PROXY=socks5h://127.0.0.1:9050
curl http://exampleonion.onion/

Important: use socks5h (or --socks5-hostname) so Tor does the DNS resolution. Plain socks5 won’t resolve .onion.

Verify it works

curl -sS --socks5-hostname 127.0.0.1:9050 https://check.torproject.org/api/ip
# Expect: {"IsTor": true, ...}

Claude Code profile (copy‑paste)

Drop this into your Claude project as CLAUDE.md. It tells Claude to use the Bash tool with curl over Tor and how to search/skim onions via Ahmia.

# Claude Code: Tor browsing via curl (.onion ready)

Purpose
- Use curl through your local Tor SOCKS proxy from the Bash tool. Don't proxy Claude itself. WebFetch doesn't use SOCKS proxies, so it won't reach .onion. Using socks5h keeps DNS + HTTP inside Tor.

Assumptions
- Tor running locally with SOCKS on 127.0.0.1:9050
- Bash tool available in Claude Code

Rules
- Use Bash + curl instead of WebFetch for .onion
- Route curl via Tor:
- Per command: --socks5-hostname 127.0.0.1:9050
- Or session-wide: export ALL_PROXY=socks5h://127.0.0.1:9050
- Use -sS to show errors without the progress bar

Sanity check (clearnet via Tor)
curl -sS --socks5-hostname 127.0.0.1:9050 https://check.torproject.org/api/ip
# Expect: {"IsTor": true, ...}

Ahmia basics
BASE='http://juhanurmihxlp77nkq76byazcldy2hlmovfu2epvl5ankdibsot4csyd.onion'

1) Headers (reachability)
curl -sS -I --socks5-hostname 127.0.0.1:9050 "$BASE/"

2) Search and extract v3 onion candidates (dedup)
QUERY='marketplace'
curl -sS --socks5-hostname 127.0.0.1:9050 "$BASE/search/?q=${QUERY}" | \
grep -Eo 'https?://[a-z2-7]{56}\.onion' | sort -u | head -n 10

3) Probe one host, then fetch a snippet
HOST='EXAMPLE.onion'
curl -sS -I --socks5-hostname 127.0.0.1:9050 "http://$HOST/" | sed -n '1,12p'
curl -sS    --socks5-hostname 127.0.0.1:9050 "http://$HOST/" | head -n 20

Notes
- .onion needs DNS inside Tor (RFC 7686). curl must use socks5h: --socks5-hostname or ALL_PROXY=socks5h://...
- WebFetch won't use a SOCKS proxy; use Bash + curl
- Sites are intermittent; small timeouts and retries help

Ask Claude like a search engine

Prompt Claude in plain English, it will run the Ahmia query via curl over Tor and list candidate onions:

"find me academic research repository onions"

● Bash(QUERY='research+papers' curl -sS --socks5-hostname 127.0.0.1:9050 …)
⎿  2222f2ikw4c6x4sljqbtalrqz5ngfoizmw3uyvont3tqkehdpmtdayqd.onion
2gzyxa5i5ayvgbqn6r7r37fzapdf5fp6vxtxqymxoa6cocwemjgs5nyd.onion
2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid.onion
… +12 lines (ctrl+r to expand)

● Bash(QUERY='thesis+dissertation' curl -sS --socks5-hostname 127.0.0.1:9050 …)
⎿  Running…

● Bash(QUERY='digital+library' curl -sS --socks5-hostname 127.0.0.1:9050 …)
⎿  Waiting…
ctrl+b to run in background

Under the hood, it’s just Ahmia plus a small filter for v3 onion hostnames:

QUERY='research+papers'
BASE='http://juhanurmihxlp77nkq76byazcldy2hlmovfu2epvl5ankdibsot4csyd.onion'
curl -sS --socks5-hostname 127.0.0.1:9050 "$BASE/search/?q=${QUERY}" | \
grep -Eo 'https?://[a-z2-7]{56}\.onion' | sort -u | head -n 20

To skim content quickly, fetch headers or the first lines from each host:

curl -sS -I --socks5-hostname 127.0.0.1:9050 http://EXAMPLE.onion/
curl -sS    --socks5-hostname 127.0.0.1:9050 http://EXAMPLE.onion/ | head -n 20

Troubleshooting

  • Tor not running: systemctl status tor
  • No .onion resolution: curl needs socks5h; plain curl won't resolve .onion (RFC 7686). Use --socks5-hostname or ALL_PROXY=socks5h://....
  • WebFetch: doesn't use a SOCKS proxy, so it won't reach .onion. Use Bash + curl with socks5h.

See also