Does anyone know of a network lookup script that returns available machines, shares, and IP numbers on a local network…?
I have studied several Unix books, without success.
However, Apple built (part of) this functionality into the Finder (-> Network:Connect button) so there MIGHT be a hook into that…
What kind of service are you scanning for? FTP, WWW, Machines with AFP Shares? Is Rondevous running on all these machines?
Check out…
http://lists.apple.com/archives/applescript-users/2004/Oct/msg00465.html
I used this
do shell script “mDNS -B _ssh._tcp local. > ~/Desktop/SSHService.txt 2>&1 &”
do shell script “killall mDNS”
and then read the info out of the text file. I wasn’t happy with the solution, but it worked.
If you’re still running appletalk (not many do these days) you can use
atlookup -a
This app is interesting… You might ask him to make the app scriptable…
http://toxicsoftware.com/software/shareware/iRoster/
jj may weigh in on the topic?
Thanks.
The mDNS thing didn’t issue anything useful (probably requires preload of some routines)
Following your hints and some of then discussions at Apple, I was able to compile the following script
that works out-of-the box.
(it relies on the arp-call, that only returns reliable results after a broadcast ping)
It returns all the IP number of all active network machines (whatever the services) incl router.
getIPs("192.168.1.255") --broadcastAddress
on getIPs(broadcastAddress)
set myResults to do shell script "ping -c 1 -q " & broadcastAddress
set IPs to paragraphs of (do shell script "arp -a | awk '{print $2}' | tr -d '()'")
return IPs
end getIPs
Side note: iRoster goes a step further and implements a Services Search.
It offers applescripts, but they obviously do not call the iRoster app and I can’t determine what their use is.