【问题标题】:curl an .onion url over an http proxy does not return expected source通过 http 代理卷曲 .onion url 不返回预期的源
【发布时间】:2013-08-09 12:08:25
【问题描述】:

问题

我正在测试一个包装 SOCKS 代理 (TOR) 的 HTTP 代理。它适用于普通 URL,但我得到一些 .onion 地址的奇怪结果。

在本例中,我指的是“隐藏的 wiki”。输出看起来像垃圾:

$ curl --proxy localhost:8118 http://kpvz7ki2v5agwt35.onion/

m�AO�@�����ۑp��ĖPbj

背景

使用火炬隐藏服务可以:

$ curl --proxy localhost:8118 http://xmh57jrzrnw6insl.onion/

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TORCH: Tor Search!</title>...

同样,正常的 URL 似乎没问题:

$ curl --proxy localhost:8118 https://check.torproject.org/ | grep Congratulations

<img alt="Congratulations. Your browser is configured to use Tor." src="/images/tor-on.png">
Congratulations. Your browser is configured to use Tor.<br>

使用 polipo 创建代理,配置如下:

proxyName = "localhost"
proxyAddress = "127.0.0.1"
proxyPort = 8118

allowedClients = 127.0.0.1
allowedPorts = 1-65535

cacheIsShared = false
chunkHighMark = 67108864

socksParentProxy = "localhost:9050"
socksProxyType = socks5


diskCacheRoot = ""
localDocumentRoot = ""

disableLocalInterface = true
disableConfiguration = true
disableVia = true

dnsUseGethostbyname = yes

maxConnectionAge = 5m
maxConnectionRequests = 120

serverMaxSlots = 8
serverSlots = 2

tunnelAllowedPorts = 1-65535

可能的原因

我对可能原因的看法:

  1. 服务器以垃圾响应作为某种反网络爬虫 测量。
  2. 我的处理方式有问题 回应。
  3. Polipo 搞砸了。
  4. 别的东西...

想法?

【问题讨论】:

  • 因为这不是一个编程问题,所以它并不适合 StackOverflow。也就是说,如果我使用您的配置在我的系统上设置 Polipo,它似乎工作得很好。

标签: curl proxy tor polipo


【解决方案1】:

有几个问题。首先,您需要确保 ntp 正在运行并已同步。如果没有,你就会遇到这个问题。

如果我可能会问,您为什么不直接调用 Tor 项目提供的 9050 上的 socks 端口?

另外,为什么不精确地指定您感兴趣的协议,socks 4、4a 或 5?使用 curl,您甚至可以指定 dns 是通过 Tor 完成的。如果您不这样做,那么您的 DNS 解析器当然不会知道隐藏服务的位置。将此行放入您的 .curlrc 文件中

代理 = socks5h://127.0.0.1:9050

然后

curl -v http://xmh57jrzrnw6insl.onion/

将正确返回页面,前提是 Tor 网络没有过载。检查 Tor 浏览器以确保隐藏服务已启动。

【讨论】:

    猜你喜欢
    • 2011-06-15
    • 1970-01-01
    • 2015-09-02
    • 2016-12-18
    • 1970-01-01
    • 1970-01-01
    • 2017-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多