Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

so I have to do this project, and I honestly have NO idea where to start. So basically, it will send a simple GET request to a web server, and then wait for a reply, and it will print out the IP that replied. The HTTP request is not the hard part, it is getting the IP that replies... I was thinking about using a combination of netstat and grep, which are two things that I am not very fond of, so I was wondering if anyone could help me out. I could have a dedicated box for this if needed, something with like no other traffic coming in on port 80, or something like that.

share|improve this question
    
Depending on what tools you want to use, and assuming you'll do something with the result of the request, too: wget shows what it resolved the name to as part of its output, you could extract it fro mthere with sed? –  Ulrich Schwarz Jul 10 '13 at 20:15
    
@UlrichSchwarz This will not work, because it cannot simply resolve the name... It has to get the actual IP of the reply to a GET request, because the web server would be routed through a proxy with incoming requests, but not outgoing requests. Simply resolving the IP would get the proxy IP. –  user1307079 Jul 10 '13 at 20:29

2 Answers 2

There's a Linux command called GET (all caps) that issues a plain GET HTTP request and displays the result. I am unsure if it displays the IP of the remote host in its output.

share|improve this answer
wget --server-response "http://google.com/" -O /dev/null 2>&1 | grep -Em 1 "\|[0-9\.]+\|" | sed -r "s/^.*\|([0-9\.]+)\|.*$/\1/g"

Just replace "http://google.com/" with whatever you want to request.

share|improve this answer
    
This will not work, because it cannot simply resolve the name... It has to get the actual IP of the reply to a GET request, because the web server would be routed through a proxy with incoming requests, but not outgoing requests. Simply resolving the IP would get the proxy IP. –  user1307079 Jul 10 '13 at 20:27
    
If you are trying to penetrate the proxy that's impossible. The proxy goes and gets wherever it decides and then spits out the result as if it came from itself. Some proxies graciously tell you where it got the data, so you might be able to use that. Look at the results of the --server-response output from wget. –  BCable Jul 10 '13 at 20:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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