【问题标题】:Change IP address using tor c#使用tor c#更改IP地址
【发布时间】:2015-01-10 04:13:24
【问题描述】:

我想在 Windows 平台中使用 TOR 和 c# 以 x 时间间隔更改 ip 有人可以帮我解决这个问题吗??

TIA。

我试过这个代码

public string Refresh()
{
    TcpClient client = new TcpClient("localhost", 9051);
    string response = string.Empty;
    string authenticate = MakeTcpRequest("AUTHENTICATE\r\n", client);
    if (authenticate.Equals("250"))
    {
        response = MakeTcpRequest("SIGNAL NEWNYM\r\n", client);
    }
    client.Close();
    return response;
}

public string MakeTcpRequest(string message, TcpClient client)
{
    client.ReceiveTimeout = 20000;
    client.SendTimeout = 20000;
    string proxyResponse = string.Empty;

    try
    {
        // Send message
        StreamWriter streamWriter = new StreamWriter(client.GetStream());
        streamWriter.Write(message);
        streamWriter.Flush();

        // Read response
        StreamReader streamReader = new StreamReader(client.GetStream());
        proxyResponse = streamReader.ReadToEnd();
    }
    catch (Exception ex)
    {
        // Ignore
    }

    return proxyResponse;
}

我得到 514 authentication required 错误

【问题讨论】:

标签: c# windows tor


【解决方案1】:

你的torrc是什么?没有它,很难帮助你。有关身份验证的示例,请参阅...

https://stem.torproject.org/faq.html#can-i-interact-with-tors-controller-interface-directly

更一般地说,如果您只是想以特定间隔循环电路,那么 MaxCircuitDirtiness torrc 选项就是这样做的......

https://www.torproject.org/docs/tor-manual.html.en#MaxCircuitDirtiness

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-09
    • 2018-01-18
    • 2019-01-31
    • 2014-05-06
    • 1970-01-01
    • 2013-01-26
    相关资源
    最近更新 更多