1

I have a c# application that downloads multiple tiny files from websites (torrents). Some sites restrict the number of downloads per IP per day.

I do a HttpWebRequest and if the stream is a valid torrent, I save it to disk.

Is there a way for my c# application to spoof my IP when performing the HttpWebRequest, so that the download will not fail ?

I spaced out the download time to one per 10 minutes, but no luck. I still get blocked eventually.

I have heard that "TOR" can use diffrent IPs, but I don't want the people using my desktop app to have to install TOR browser separately.

           HttpWebResponse resp = null;

        try
        {
            var req = (HttpWebRequest)WebRequest.Create("http://www.exampe.com/test.torrent);
            req.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
            req.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
            req.Timeout = 30000;
            req.KeepAlive = true;
            resp = (HttpWebResponse)(req.GetResponse());

        }

Any solutions ?

1 Answers1

1

To do so, you need to manipulate tcp/ip packets. This means that you need to capture the outgoing packet created by HttpWebRequest and change its source IP to the spoofed one.

I found this forum post that seemingly has to do with what you want to do, check it out : http://pcapdotnet.codeplex.com/discussions/349978

As far as I know you can do it through PCap.net or SharpPcap libraries.

akardon
  • 43,164
  • 4
  • 34
  • 42
  • Wouldn't doing so prevent the response packets from getting back to you? Besides, you'd have to change your public ip address which may not be the ip address of your system. – Richard Barker Jun 17 '16 at 03:22
  • 1
    That's right and the Spoofed IP should be in your subnet to be routed back to your network. And if you're behind a NAT server, I think it wouldn't be possible. You can spoof but as NAT changes the packets again it would be pointless. – akardon Jun 17 '16 at 06:06