0

I want to hit a URL from Delphi by using a Custom IP. I am trying to use, http://delphi.xcjc.net/viewthread.php?tid=47042 But this only accept Destination IP and port.

How can I change to URL?

2 Answers 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.

0

You would have to write your own http wrapper around that code I think.

Http works by sending a text message to an IP address and a port containing headers informing the server which page you like to retrieve.

So in your case you need to lookup the IP address using the server and domain part of the url, then craft an http request message.

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

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

But remember that if you spoof your IP address you will not receive any response, and also, spoofing your IP address could be a breach of contract with your ISP.

There might exist libraries to do this but beware of hidden surprises as many of them might be written by people with an agenda ;)

1
  • Thanks David, Can you Please gimme some samples or links to libraries or name? Jul 17, 2012 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.