Skip to content

Instantly share code, notes, and snippets.

@nqxcode
Last active October 4, 2022 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nqxcode/d322488d74a9b85c0774987e4bc06b79 to your computer and use it in GitHub Desktop.
Save nqxcode/d322488d74a9b85c0774987e4bc06b79 to your computer and use it in GitHub Desktop.
Tor Control
#!/bin/sh
command="${*}"
printf "Initialized REPL for '%s'\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "%s> " "$command"
read -r input
done
root@OpenWrt ~/bin/tor-0.4.4.8 # opkg info tor
Package: tor
Version: 0.4.4.8-1
Depends: libc, libevent2-7, libopenssl1.1, libpthread, librt, zlib, libcap
Status: install user installed
Section: net
Architecture: mips_24kc
Size: 1282620
Filename: tor_0.4.4.8-1_mips_24kc.ipk
Conffiles:
/etc/tor/torrc 59defd5c911184a2bbab5d9e6f149ae06b4bf5ff7bca3f7f1dbadd82d9e99b6e
/etc/config/tor 8646141d901bcfad17a08e90b18c770637c690252f2f87b684c32a57d601d089
Description: Tor is a toolset for a wide range of organizations and people that want to
improve their safety and security on the Internet. Using Tor can help you
anonymize web browsing and publishing, instant messaging, IRC, SSH, and
more. Tor also provides a platform on which software developers can build
new applications with built-in anonymity, safety, and privacy features.
This package contains the tor daemon.
Installed-Time: 1618053193
#!/bin/bash
CMD=${*}
PORT=${PORT-9051}
ADDRESS=${ADDRESS-127.0.0.1}
if [ -z "${CMD}" ]; then
echo 'Please, specify command...'
exit 1
fi
CMD_WITH_AUTH="AUTHENTICATE\r\n${CMD}\r\nQUIT"
echo -e $CMD_WITH_AUTH | nc $ADDRESS $PORT

Tor Control

Статьи о настройках:

https://iphelix.medium.com/hacking-the-tor-control-protocol-fb844db6a606

https://openwrt.org/docs/guide-user/services/tor/client

https://wiki.archlinux.org/title/Tor_(Русский)

Статус цепочек

watch -n 0.5 torcontrol getinfo circuit-status

REPL для выполнения команд

replify torcontroll

Set tor config for fast one hop circuits:

setconf __DisablePredictedCircuits=1 
setconf MaxOnionsPending=0
setconf newcircuitperiod=999999999
setconf maxcircuitdirtiness=999999999
setconf FastFirstHop=0 
setconf EnforceDistinctSubnets=0 
setconf UseBridges=0
setconf UseEntryGuards=0
setconf __LeaveStreamsUnattached=1

Close circuit:

closecircuit 54

Create circuit:

One hop
extendcircuit 0 AlekseyNKrylov
extendcircuit 0 Alnitak
extendcircuit 0 ATZv5
extendcircuit 0 CryptoHouse
extendcircuit 0 Fission08
extendcircuit 0 nodvrelay21
extendcircuit 0 Ragnarok
extendcircuit 0 TOL6
extendcircuit 0 TORKeFFORG9
extendcircuit 0 x23tor75
extendcircuit 0 x55378008
extendcircuit 0 ZombCompTorBridge05
extendcircuit 0 tirz
extendcircuit 0 CalyxInstitute04
extendcircuit 0 Unnamed
extendcircuit 0 MrTerence
More than one hop

extendcircuit 0 ZombCompTorBridge05,Unnamed,MrTerence

for 5 or more circuits

setconf circuitbuildtimeout=300

Set events to track

setevents circ stream orconn addrmap status_general status_client guard

Existed nodes

AlekseyNKrylov
Alnitak
ATZv5
CryptoHouse
Fission08
nodvrelay21
Ragnarok
TOL6
TORKeFFORG9
x23tor75
x55378008
ZombCompTorBridge05
User $TOR_UID
DataDirectory /var/lib/tor
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsOnResolve 1
AutomapHostsSuffixes .exit,.onion
TransPort 127.0.0.1:$TOR_PORT IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestPort IsolateDestAddr
SocksPort 127.0.0.1:9050 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestPort IsolateDestAddr
ControlPort 9051
HashedControlPassword 16:FDE8ED505C45C8BA602385E2CA5B3250ED00AC0920FEC1230813A1F86F
DNSPort 127.0.0.1:$TOR_DNS
# Sandbox 1 - tor package is not built with --enable-seccomp required to use this option.
HardwareAccel 1
TestSocks 1
AllowNonRFC953Hostnames 0
WarnPlaintextPorts 23,109,110,143,80
ClientRejectInternalAddresses 1
NewCircuitPeriod 40
MaxCircuitDirtiness 600
MaxClientCircuitsPending 48
UseEntryGuards 1
EnforceDistinctSubnets 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment