News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

@Hutch regarding thread - How to find IP address

Started by dicky96, January 08, 2006, 10:44:56 PM

Previous topic - Next topic

farrier

dicky96,

Have a look at:

www.Hamachi.cc

hth,

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

dicky96

If anyone is interested, I'm currently working on this problem, trying to use an external webpage to return my internet IP

When I have it working I'll post my findings back here  :wink

Ian_B

It should be easy to do it from an external viewpoint - how many of us have seen those clever forum signature pics that have a little sign saying "Your IP is blah.blah.blah.blah, you're using Internet Explorer 6.0c with the extra coffee-making doohickey" etc. Something offsite is parsing the HTML headers sent by the browser and sending it straight back formatted as a JPG. If anyone can post the jist of the code that does all that, I'd love to see it!

IanB

dicky96

I'm pretty sure you can reply the IP at least, with .asp 

When I'm done I'll post for sure, but am happy to use someone else's "wheel" rather than inventing my own of course  :wink

zooba

Does anyone else's IP address appear at the bottom of all of their posts here? Mine does...

QvasiModo

Quote from: Ian_B on January 15, 2006, 06:26:21 AM
It should be easy to do it from an external viewpoint - how many of us have seen those clever forum signature pics that have a little sign saying "Your IP is blah.blah.blah.blah, you're using Internet Explorer 6.0c with the extra coffee-making doohickey" etc. Something offsite is parsing the HTML headers sent by the browser and sending it straight back formatted as a JPG. If anyone can post the jist of the code that does all that, I'd love to see it!

IanB


It's easy to implement, the data is sent as HTTP headers and the IP is simply the source of the connection obtained through a call to gethostname(). CGI programs get all this as environment variables, so it's even easier; and there are plenty of free libraries to generate pictures from text. Just google a while and you'll find lots of examples. :)

The problem is, it won't work if you're behind a web proxy. You'd get the proxy IP address instead of yours.

P1

Quote from: QvasiModo on January 16, 2006, 04:30:51 PMThe problem is, it won't work if you're behind a web proxy. You'd get the proxy IP address instead of yours.
But that's exactly the IP address he wants.  But most proxies work from a IP pool of addresses.

But unless there is a reverse NAT for inbound connections it will do him little good.

His stated purpose is for Client Identity verfication.

Regards,  P1  :8)

dicky96

Hi
Actually I find this does work..... If I go to checkip.dyndns.org it returns a string

Current IP Address: xx.xxx.xxx.xxx

which IS my internet IP - the one I wanted  :U

That works even though I connect through a router - if you think about it, any request to a website must know the IP address to return the data to.  I've tested this on BT and Cable ISPs in the UK (where I am based)

All I do in my code is resolve checkip.dyndns.org to it's actual IP, send a GET / HTTP/1.0 string to that IP and then Recv the returned data.  After parsing the data I can easily find the IP address I wanted.

My next enhancement will be to create my own page that returns the IP address to save me relying on a third party page.  After some searching, CGI seems to be he thing to use.  Guess I'll have to learn that too!

If anyone wants my assembler source just ask.  It was easy enough once I figured out what I needed to do.

dicky

P1

Quote from: dicky96 on January 18, 2006, 07:22:12 PMAfter some searching, CGI seems to be he thing to use.  Guess I'll have to learn that too!
Go with ISAPI, it's more scalable, if you run into traffic load issues.  On top of that there are some pretty examples by Japeth.

It does not take much effort to kill a cgi with a DOS attack.

Regards,  P1  :8)

dicky96

@PI
I don't really think anyone will be mounting DOS attacks on a web page returning the internet IP for  my own little diagnostic software used by 100 or so clients...............  but having said that, I'm open to any suggestions.

Oh and I'd just like to add a quick note of thanks for all the help I've received here as a newbie.  It's so cool to be made to feel this welcome :)

P1

Let's go the security route, CGI's are more vuneralable to hacks.

Google for CGI vs. ISAPI comparasions, then evaluate the riskd to benefits.

Regards,  P1  :8)