---
title: "Tori CLI — Parth Kapoor"
description: "A SOCKS4 client in C that tunnels TCP connections through Tor"
canonical: "https://parthkapoor.me/builds/tori-cli"
---

# Tori CLI

> A SOCKS4 client in C that tunnels TCP connections through Tor

Tori CLI is a small command-line tool that opens a TCP connection to a destination host and port by speaking the SOCKS4 protocol directly to a local Tor proxy at 127.0.0.1:9050. It's aimed at people who want to see the raw mechanics of a SOCKS handshake rather than use a library for it.

The client hand-builds the SOCKS4 request struct (version, command, destination port/IP, user id) in a single header file, sends it over a POSIX socket, and reads back the proxy's reply to check the connect code before reporting success or failure.

- Status: shipped
- Language: C
- Started: Sep 2024
- Source: https://github.com/parthkapoor-dev/tori-cli

## Highlights

- Implements the SOCKS4 handshake by hand: builds proxy_request/proxy_response structs over a raw POSIX socket
- Takes host and port as CLI args; reports whether the Tor proxy bridged the connection (reply code 90)
- Single C file plus a header, built with a one-line Makefile (gcc tori.c -o tori)

## Stack

- **Language**: C
- **Networking**: POSIX sockets, SOCKS4 protocol, Tor

All builds: [https://parthkapoor.me/builds](https://parthkapoor.me/builds.md)
