如何将套接字(或袜子)与代理一起使用并将数据从该代理发送到网站?

发布于 01-17 08:45 字数 549 浏览 2 评论 0原文

因此,正如标题中提到的,我希望能够使用套接字模块或袜子模块通过代理匿名发送数据到 IP(我知道这可以使用不同的模块来完成,但我想要这个特定的模块)因为我可以更好地理解它)

我已经使用了袜子模块,如下所示..但我总是收到一条错误消息“无法建立连接,因为目标机器主动拒绝它”..我尝试了许多不同的代理运气不好..所以我想我正在做某事这里错了..有什么想法吗?

import socks

Socket=socks.socksocket()

Socket.setproxy(socks.PROXY_TYPE_SOCKS4,"(ProxyIP)",(ProxyPort))
Socket.connect(("(WebsiteIP or Domain Name)",(WebsitePort)))
Socket.close()
print ("connected")

我也尝试过这个但得到了同样的错误
Python 套接字模块。连接到 HTTP 代理,然后对外部资源执行 GET 请求

So as mentioned in the title I want to be able to send data to an ip anonymously through a proxy using the sockets module.. or the socks module.. (i know that this can be done with different modules but i want this specific one because i can better understand it)

i have used the socks module as shown below.. but i always get an error saying "No connection could be made because the target machine actively refused it".. i have tried a number of different proxies an got no luck.. so im thinking that im doing something wrong here.. any ideas?

import socks

Socket=socks.socksocket()

Socket.setproxy(socks.PROXY_TYPE_SOCKS4,"(ProxyIP)",(ProxyPort))
Socket.connect(("(WebsiteIP or Domain Name)",(WebsitePort)))
Socket.close()
print ("connected")

Also i have tried this but got the same error
Python socket module. Connecting to an HTTP proxy then performing a GET request on an external resource

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文