• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11


  • Subject: Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
  • From: Jim Weisbin <email@hidden>
  • Date: Thu, 29 Oct 2015 08:39:40 -0400

Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11

I wrote:

>
> tell application "Finder"
> 	set internalIP to ""
> 	set my_interface to ""
> 	try
> 		set my_interface to do shell script "netstat -rn -f inet | egrep \"^default\" | awk '{print $6}' "
> 		display dialog my_interface
> 		if [my_interface is equal to ""] then
> 			error "no default interface found"
> 		else
> 			set internalIP to do shell script "ipconfig getifaddr " & my_interface
> 		end if
> 	on error
> 		set internalIP to "internal IP not found, or no default interface found"
> 	end try
> 	display dialog internalIP
> end tell
>

Sorry, that code gets the internal IP (LAN) address, not the external IP (WAN) address.

For the external, use curl to hit any of the web sites that offer this service, such as checkin.dyndns.org or others.

Having said that, I haven’t tested on El Capitan - it’s possible that the new “rootless” mode might interfere with the above, because “curl”, “netstat”, and “awk” all live in /usr/bin

You can test this by turning off rootless mode, instructions here:

http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/


Jim Weisbin | C.T.O. | human


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Prev by Date: RE: PDF Search
  • Next by Date: Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
  • Previous by thread: Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
  • Next by thread: Catching errors in dialog Input
  • Index(es):
    • Date
    • Thread