Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fake HTTP Get Requests

Tags:

java

http

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;
    }
like image 605
jmj Avatar asked Jul 09 '10 08:07

jmj


3 Answers

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.

like image 71
Rob Levine Avatar answered Sep 20 '22 11:09

Rob Levine


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.

like image 43
Jon Skeet Avatar answered Sep 23 '22 11:09

Jon Skeet


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.

like image 42
Vadim Fedorov Avatar answered Sep 22 '22 11:09

Vadim Fedorov