0

我想通过使用自定义 IP 从 Delphi 访问 URL。我正在尝试使用http://delphi.xcjc.net/viewthread.php?tid=47042 但这仅接受目标 IP 和端口。

如何更改为 URL?

4

2 回答 2

2

You can't spoof your IP address over a TCP connection, so "hitting" a URL via a spoofed IP address is impossible, as HTTP/HTTPS uses TCP.

The reason you can't spoof your IP address with a TCP connection is because there is a handshake with TCP connections, and your ACK must include the random number sent by the server in their SYN-ACK part of the handshake.

If you lie to the server about your IP address, you'll never receive the SYN-ACK, so you won't have the information required to finish the handshake.

Now, if you could guess the random number, that's a different story, and in the past, this was a common tactic, however the protocol has improved since then.

You can spoof your IP address with UDP, since it's connectionless, using Indy UDP sockets, however, you won't get a response back from the server, of course.

With Windows XP SP3 or above, access to raw sockets requires elevated privileges. This is fine on your own machine, however, if you are developing software to run by others, you will probably want to build in your own IP stack to avoid privilege issues.

There are some services that run on UDP, like some games even, however, the web as we know it is mostly TCP, so spoofing is mostly out of the question.

If you are trying to disguise your actual IP address, take a look at using a remote proxy server, which will forward any traffic through a third party IP address. You will, for all intent and purposes, appear to be the proxy.

于 2012-07-17T12:57:57.790 回答
0

我认为您必须围绕该代码编写自己的 http 包装器。

Http 通过向 IP 地址和包含标头的端口发送文本消息来工作,以通知服务器您要检索哪个页面。

因此,在您的情况下,您需要使用 url 的服务器和域部分查找 IP 地址,然后制作一个 http 请求消息。

http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol

http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html

但请记住,如果您欺骗您的 IP 地址,您将不会收到任何响应,而且,欺骗您的 IP 地址可能会违反与您的 ISP 的合同。

可能有图书馆可以做到这一点,但要小心隐藏的惊喜,因为其中许多可能是由有议程的人编写的;)

于 2012-07-17T07:07:06.413 回答