【发布时间】:2017-06-08 05:55:44
【问题描述】:
有人知道我如何通过 java 代码将 NEWNYM 信号发送到 TOR 吗?
说我有这个:
String adress = "http://some-adress";
WebClient webClient = new WebClient(BrowserVersion.FIREFOX_52);
ProxyConfig proxyConfig = new ProxyConfig("127.0.0.1", 9150, true);
webClient.getOptions().setProxyConfig(proxyConfig);
webClient.getOptions().setJavaScriptEnabled(false);
webClient.getOptions().setUseInsecureSSL(true);
HtmlPage page = (HtmlPage)webClient.getPage(adress);
从技术上讲,我可以这样做来重新启动应用程序,并获得一个新的身份:
Runtime.getRuntime().exec("C:/Users/user/Desktop/Tor Browser/Browser/firefox.exe");
Runtime.getRuntime().exec("TASKKILL /F /IM firefox.exe");
但是必须有一种方法可以发送 NEWNYM 信号,因为通过这种方式获得 TOR 的新身份非常麻烦。
谁能帮帮我?
【问题讨论】:
-
我不太了解 tor 和 HTMLUnit,无法添加答案,但看起来您应该能够制作 WebRequest,使用
setHTTPMethod使其成为 NEWNYM(假设 NEWNYM是 HTTP 动词/方法而不是查询参数)然后通过您的 webClient 的 WebConnection 发送它