Fake HTTP Get Requests

2019-02-05 00:45发布

i have noticed certain sites which allows limited hit per IP so can i programatically make them feel that requests are not coming from the same IP ,

well i am not much sure abot HTTP packet, but can we specify it in header or somewhere to make them fool

here is the code for GET Request

public static String sendGetRequest(String endpoint, String requestParameters) {
        String result = null;
        if (endpoint.startsWith("http://")) {
// Send a GET request to the servlet
            try {
// Construct data
                StringBuffer data = new StringBuffer();

// Send data
                String urlStr = endpoint;
                if (requestParameters != null && requestParameters.length() > 0) {
                    urlStr += "?" + requestParameters;
                }
                URL url = new URL(urlStr);
                URLConnection conn = url.openConnection();

// Get the response
                BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                StringBuffer sb = new StringBuffer();
                String line;
                while ((line = rd.readLine()) != null) {
                    sb.append(line);
                }
                rd.close();
                result = sb.toString();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return result;
    }

标签: java http
7条回答
成全新的幸福
2楼-- · 2019-02-05 01:10

I am guessing the filter is being applied at the IP packet level rather than at the higher level HTTP level. In this case Yes and No.

Yes - it is technically possible to spoof your IP address so the IP packets look like they've come from elsewhere.

No - in that it is unlikely to be useful. If you spoof the "from" address on the TCP packets, then any replies from the machine you are connecting to will be lost as they try to route to the spoofed IP address. You'll get nothing back.

That is, you won't even be able to complete the TCP Three-Way-Handshake. Until that process is completed, you cannot even send anything down the connection - because there isn't even a connection, to begin with. HTTP runs over TCP, so unless you complete the handshake (which requires a valid 'from' IP address), you can't make any use of this.


An old trick was to use something called "Source Routing"; where TCP packets included information on how to route the information. This was for diagnostic use way back "in the day". You could put yourself in the designated route, and then just stop the packets when they reach you and reply to them, again with the source-routing information.

But this technique does not work at all anymore, because almost every single router on the Internet these days simply drops source-routed packets, as there is no legitimate need for them - and lots of potential havoc to be wreaked.

查看更多
仙女界的扛把子
3楼-- · 2019-02-05 01:10

No, you can't do it progmatically, unless you are using some kind of proxy.

Normally the IP detection comes from the IP level, not from the HTTP header. If someone is detecting IP's through the header, well...it's wrong.

查看更多
Melony?
4楼-- · 2019-02-05 01:23

No, sites that perform rate control based on source IP would be very naive if they implemented it using spoofable headers.

查看更多
萌系小妹纸
5楼-- · 2019-02-05 01:28

No, spoofing your IP is not something you can do in your HTTP headers.

Firstly, I'd suggest that whatever limit you're trying to get around - don't bother. It's there for a reason, and you'd probably be breaking someones terms of use for a service.

Secondly, if you're absolutely determined, I'd say the only way you'd be able to make it look like the request was coming from a different IP would be to actually make it come from a different IP - ie, by using a bunch of proxies.

查看更多
家丑人穷心不美
6楼-- · 2019-02-05 01:32

Firstly, I'd hope that any sites which are trying to do source throttling aren't going to trust some arbitrary header. The packet says where the response has to go back to - I'd hope that they'd throttle based on that.

Secondly, if a site doesn't want you to hit them repeatedly, don't you think it's rude of you to try to circumvent that? If I were a site owner and I noticed someone trying to do that, I'd probably blanket ban them if at all possible.

查看更多
淡お忘
7楼-- · 2019-02-05 01:35

No, it isn't possible to fool such systems using just Http header change. A possible way to achieve your goal would be using Tor network.

查看更多
登录 后发表回答