![Tor를 사용하여 HTTPTunnelPort를 사용하여 터미널 명령을 리디렉션](https://linux55.com/image/157294/Tor%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20HTTPTunnelPort%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%ED%84%B0%EB%AF%B8%EB%84%90%20%EB%AA%85%EB%A0%B9%EC%9D%84%20%EB%A6%AC%EB%94%94%EB%A0%89%EC%85%98.png)
Tor를 통해 터미널 명령을 리디렉션하려고 합니다. 그런데 공인 IP 주소를 확인하려고 하면 다음과 같은 오류가 발생합니다.
$ curl https://ipinfo.io/ip
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:9051
이 명령을 사용하여 터미널에 대한 프록시를 설정했습니다.
$ export http_proxy='http://127.0.0.1:9051'
$ export https_proxy='https://127.0.0.1:9051'
/etc/tor/torrc에 "HTTPTunnelPort 9051"을 추가하고 Tor 서비스를 다시 시작했습니다.
또한 포트 9051이 열려 있고 수신 대기 중인지 확인했습니다.
$ sudo lsof -i -P -n | grep LISTEN
tor 10757 debian-tor 6u IPv4 120224 0t0 TCP 127.0.0.1:9050 (LISTEN)
tor 10757 debian-tor 7u IPv4 120225 0t0 TCP 127.0.0.1:9051 (LISTEN)
답변1
Curl은 ocks5와 호환됩니다. Tor를 통해 Curl을 사용하여 다운로드하는 데 사용하는 Bash 스크립트는 다음과 같습니다.
~/bin/torrific-curl
#!/usr/bin/env bash
_address="${1:?No address supplied}"
_location="${2}"
_socks5_port='9050'
_cmd=('curl' '--socks5' "localhost:${_socks5_port}" '--socks5-hostname' "localhost:${_socks5_port}" '-s' "${_address}")
((${#_location})) && {
${_cmd[@]} -o "${_location}"
} || {
${_cmd[@]}
}
설정
chmod u+x ~/bin/torrific-curl
용법
torrific-curl 'https://ipinfo.io/ip'
## Or with output file...
torrific-curl\
'https://ipinfo.io/ip'\
"/tmp/torrific-ip_$(date +'%Y-%m_%d-%T').txt"
……좀 그렇네히트 & 미스어떤 응용 프로그램이 Tor와 잘 작동하는지에 대해서는 HTTPTunnelPort
자세한 내용이 제공되면 이 답변을 다시 편집할 의향이 있습니다.