关于编写代理以更改发送到站点的传出 http 消息的客户端 IP 的问题
好吧,首先我对 HTTP 的一切一无所知,所以如果我有误解,请纠正我。
背景:
有一个网站禁止我发帖。没有什么不体面的事情,我只是一些当地政客眼中的“不方便的人”。问题是,虽然我可以从任何 IP 浏览该网站,并且如果我使用自己的 IP 以外的 IP,则可以从帐户发布消息,但如果我尝试从我的 IP 发布,我的帖子会被拒绝(只是进入太空,永远不会返回)。自己的IP。
这让我认为他们的防火墙或应用程序中的某些内容阻止了我发帖。 (我已经成功地使用开放代理从我的家用计算机上解决了这个问题,但可用的开放代理不可靠,而且通常很粗略,不是一个很好的解决方案。)
解决方案?
我想写下我希望的内容相对直接的代理,可以使用 C 和原始套接字在我自己的机器上运行。使用像 FoxyProxy 这样的东西,我希望仅针对这个网站将流量定向到该本地代理或从该本地代理定向流量。我希望编写代理就像在传出(发布)数据包上替换随机 IP 一样简单。这是对的吗?服务器是否会尝试“确认”某个帖子(该帖子永远不会返回给我,因为它不是我的 IP)还是只会发布?
另外,为了区分网站上的正常浏览流量(这需要代理不执行任何操作)和发布流量,我认为我需要查看包内以区分一种类型和另一种类型。想必这种区分很容易做出来吧?
任何有关相关材料的建议或指示都会很棒。如果我正在重新发明轮子,并且已经有代理这样做了,那就太好了,但我有兴趣了解一些基本原理。
感谢您的任何帮助。
Ok, so first off I am mostly ignorant of all things HTTP so if I have misconceptions please correct me.
Background:
There is a web site that has banned me from posting. Nothing unseemly going on, I am just an "inconvenient person" to some local politicians. Thing is, while I can browse the site from any IP and I can post messages from accounts if I use an IP other than my own, my posts are rejected (just go off into space never to return) if I try to post from my own IP.
This leads me to think their firewall or something in their app is blocking me from posting. (I have successfully used open proxies to get around this from my home machine but available open proxies are unreliable and often sketchy and not a great solution.)
Solution?
I would like to write what I hope is a relatively straight forward proxy to run on my own machine using C and raw sockets. Using something like FoxyProxy I hope to direct traffic to/from this local proxy just for this one web site. I am hoping writing the proxy is as simple as substituting a random IP on the outgoing (post) packets. Is this right? Do servers try to "ack" a post (which would never return to me because it isn't my IP) or will they just post?
Also, to distinguish normal browsing traffic on the site (which requires the proxy to do nothing) and posting traffic I assume I need to look within the packs to distinguish one type from another. Presumably this distinction is easily made?
Any suggestions or pointers to relevant material would be great. If I am reinventing the wheel and there are proxies that already do this that would be great too but I am interested in learning something about the underlying principles.
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了道德问题(即,如果这不是您的网站,那么您没有内在的“权利”在那里发帖),我认为您不能这样做。
TCP 协议要求两个端点之间进行双向通信。如果您欺骗源 IP 地址,则会丢失双向通信并且连接将失败。快速阅读有关 TCP 的 Wikipedia 条目肯定会对您有用。代理可以工作的唯一方法是它位于具有完全不同的 IP 地址的另一台计算机上。
最好的办法是与网站管理员讨论该问题。如果他们仍然不想让你参加,那么你就必须尊重他们的决定并离开。
回应 Sean 下面的评论: 考虑一下。如果技术上可以欺骗您的 IP 地址,您认为垃圾邮件发送者会不辞辛劳地获取巨大的僵尸网络(未阻止的 IP 地址池)来完成他们的肮脏工作吗?如果一项技术可以用于好的目的,那么它也可以用于坏的目的。
我建议您沿着“问责”路线来解决这个问题,而不是通过任何类型的技术规避。也就是说,如果这些人对你负责,那么就利用这种责任来得到你想要的东西。如果他们不对你负责,那么你可能无能为力。
Quite apart from the moral question (viz if it isn't your web site then you have no intrinsic 'right' to post there), I don't think you can do this.
The TCP protocol requires two-way communication between the two end points. If you spoof the source IP address then you lose that two-way communication and the connection will fail. A quick read of the Wikipedia entry on TCP will surely be useful to you. The only way a proxy could work is if it is located on a different machine with a genuinely different IP address.
Your best bet will be to talk about the issue with the administrator of the web site. If they still don't want you to participate then you'll just have to respect their decision and leave.
In response to Sean's comment below: Think about it. If it were technically possible to spoof your IP address, do you think spammers would go to the trouble of acquiring huge botnets - pools of unblocked IP addresses - to do their dirty work? If a technique can be used for good purposes it can also be used for bad purposes.
I would advise you to approach this down the 'accountability' route rather than by any kind of technical circumvention. That is, if these people are accountable to you then use that accountability to get what you want. If they are not accountable to you then there's probably nothing you can do.