Getting a PUBLIC IP address

Hi,

We recently had a laptop stolen and my boss is far too cheap to fork out for a solution like Undercover Mac.

As such i have been “tasked” with writing a small app that will run at when ever there is an active network connection to check a text file on our web server using curl and if it’s serial and or mac address of the Ethernet port is found it will gather information and phone home using another curl command to open a mail.php file on our web server ie www.website.com/mail.php?ipaddress=217.82.1.1 etc etc.

Currently I have the whole thing working and am at the point of gathering system information. The one thing I am stuck on that really would be an absolutely piece of information is IP address. I am fully aware of how to get the internal “private” ip address but is it possible to actually get the external ip address even if they are using a router?

any help on this would be great and if anyone wants this when i have finished your more than welcome to it.

thanks

Dave Maltby

I have managed to do it with a website called whatsmyip.org. How ever if they ever change the site I am stuffed. heres the terminal command I used:

curl http://www.whatsmyip.org/ | grep ‘’ | sed ‘s|||g’

Any more feed back would be greatly appriciated

Dave Maltby

Hi,

serial number:


set serialNumber to do shell script "system_profiler SPHardwareDataType | awk '/Serial Number/ {print $NF}'"

external IP address (internet connection required, throws an error if there is none)

set externalIPAddress to do shell script "curl http://checkip.dyndns.org | awk '/: / {print $6}' | cut -f 1 -d '<' "

internal Ethernet MAC address


set internalMACAddress to primary Ethernet address of (system info)

Stefan you are truely a god among scripters.

Thank you!

Dave Maltby