C# How to spoof IP address for WebRequest

前端 未结 6 1566
小蘑菇
小蘑菇 2020-12-14 10:28

I have asp.net website hosted and I am making WebRequest to post data and get response. The website is having IP filtering. I want to spoof sender IP address for testing pur

相关标签:
6条回答
  • 2020-12-14 10:47

    Use the Spoof class found in the System.Security namespace...

    0 讨论(0)
  • 2020-12-14 10:48

    If you're expecting to get a response, then no. Without the correct IP address, the server won't send the response to the correct destination.

    If you insist on trying anyway, see this article for programmatically setting the client's IP address.

    0 讨论(0)
  • 2020-12-14 11:02

    Or you can use Web Performance Tests and a load test with IP Switching enabled

    0 讨论(0)
  • 2020-12-14 11:04

    Some servers can also consider X-Forwarded-For and X-Real-IP headers. So if server checks for these headers you can add them to your Web request. But it depends on server implementation.

    0 讨论(0)
  • 2020-12-14 11:09

    You can try to use a proxy, as documented here. ( http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.proxy.aspx ).

    Setting up a proxy on a different computer, then configuring that computer as your requests proxy server should make the request appear as if it came from the proxy's IP, not yours.

    0 讨论(0)
  • 2020-12-14 11:11

    What your looking for is SharpPCap which is a .NET port of WinPCap.. it allows you to do IP Spoofing, which is what your talking about. The only problem with your idea is that you wont be able to get a response back. You can send requests out, but if you dont have a proper return address then the request will be lost in the interwebs.


    Edit

    To do this yoruself w/out the help of a library you will need to construct the raw packets yourself. This has been answered here.

    0 讨论(0)
提交回复
热议问题