【问题标题】:Request new identify from tor in javascript在javascript中从tor请求新的身份
【发布时间】:2012-07-20 19:19:50
【问题描述】:

在 PHP 中你会做这样的事情:

function tor_new_identity($tor_ip='127.0.0.1', $control_port='9051', $auth_code='')
{
    $fp = @fsockopen($tor_ip, $control_port, $errno, $errstr, 30);
    if(!$fp)
    {
        return false; //can't connect to the control port
    }

    fputs($fp, "AUTHENTICATE $auth_code\r\n");
    $response = fread($fp, 1024);
    list($code, $text) = explode(' ', $response, 2);
    if ($code != '250') return false; //authentication failed

    //send the request to for new identity
    fputs($fp, "signal NEWNYM\r\n");
    $response = fread($fp, 1024);
    list($code, $text) = explode(' ', $response, 2);
    if ($code != '250') return false; //signal failed

    fclose($fp);
    return true;
}

是否有可能在 javascript 中实现相同的功能?

【问题讨论】:

    标签: javascript tor


    【解决方案1】:

    您无法在 JavaScript 中打开套接字。您可以向服务器发送 AJAX 请求,服务器会为您执行此操作并返回结果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-03
      • 2015-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-20
      • 1970-01-01
      相关资源
      最近更新 更多