色々なプログラムで proxy を使えるようにする proxychains-ng を試す

proxychains-ng というものを見かけたので試してみます.ネットワーク関連の関数をフックして,SOCKS 4a, 5, HTTP proxy を利用できるようにします.
torsocks的な感じ.

とりあえずこんな感じで動きました

$ git clone https://github.com/rofl0r/proxychains-ng
$ cd proxychains-ng
$ ./configure && make

src/proxychains.confにtorの設定が書いてあるのでとりあえずそれで動かします.(tor daemon が動いている前提)
1回目はtimeoutに,2回目は成功.

$ ./proxychains4 -f src/proxychains.conf curl ifconfig.me/ip
  :
[proxychains] Strict chain  ...  127.0.0.1:9050  ...  ifconfig.me:80 <--socket error or timeout!
curl: (7) Couldn't connect to server
$ ./proxychains4 -f src/proxychains.conf curl ifconfig.me/ip
  :
[proxychains] Strict chain  ...  127.0.0.1:9050  ...  ifconfig.me:80  ...  OK
158.69.192.239

torsocksでは起動しないfirefox も起動した.

$ ./proxychains4 -f src/proxychains.conf firefox

Debian package にも proxychains4 という名前であった.こっちのほうが楽ですね.

$ apt show proxychains4
Package: proxychains4
Version: 4.13-4
Priority: optional
Section: net
Source: proxychains-ng
Maintainer: Boyuan Yang <byang@debian.org>
Installed-Size: 45.1 kB
Provides: proxychains, proxychains-ng
Depends: libproxychains4 (= 4.13-4), libc6 (>= 2.4)
Breaks: proxychains (<< 3.1-8)
Replaces: proxychains
Homepage: https://github.com/rofl0r/proxychains-ng
Download-Size: 14.1 kB
APT-Sources: http://ftp.jp.debian.org/debian sid/main amd64 Packages
Description: redirect connections through socks/http proxies (proxychains-ng)
 Proxychains is a UNIX program, that hooks network-related libc functions
 in dynamically linked programs via a preloaded DLL (dlsym(), LD_PRELOAD)
 and redirects the connections through SOCKS4a/5 or HTTP proxies.
 It supports TCP only (no UDP/ICMP etc).
 .
 This project, proxychains-ng, is the continuation of the unmaintained
 proxychains project (known as proxychains package in Debian).
$ sudo apt install proxychains4
$ $ proxychains4 curl ifconfig.me/ip
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] Strict chain  ...  127.0.0.1:9050  ...  ifconfig.me:80  ...  OK
94.230.208.147

環境

$ lsb_release -dr
Description:    Debian GNU/Linux 10 (buster)
Release:        10
$ uname -m
x86_64