Wireless Access

From nswccWiki
Jump to: navigation, search

Unwired Remote Access into an Apple (desktop or Xserve) server

This AppleScript can be used for establishing a wireless connection between a laptop and server. Using the little known AppleTalk + ‘eppc://’ protocol you have remote Finder level access to a folder on the remote server from the laptop. That is an icon on the laptop will represent a folder on the server, and behave accordingly.

Before using this script you need to set up an Airport wireless link between the laptop and the remote server. There are obvious potential security risks, but with care, by activating password access and using non routable addresses they can be minimised. This can be useful for updating information on a server.

It also demonstrates speech response instead of message box interaction on the screen. The original use was for performing this sequence in preparation for a presentation at a conference.

-- 2008 Ian W. Parker. 
-- Automate wireless  connection to an Apple airport network
-- from a laptop for a demonstration. Features speech response
-- first worked on: 2007-04-15, last worked on: 2008-01-18
-- requires XNetwork OSAX be installed on client machine
-- WARNING ensure password access activated on server
set theVolume to "HD Macintosh" -- name of target volume
set theserver to "HD Macintosh" -- name of server
set the userID to "ianparker" -- name of user
set theserver to "10.0.2.1" -- name of server (IP address)
set theNetwork to "IAN-PAN" -- ie. the name of the network connection channel
if not (is airport working) then
	start airport
	say "Airport is activating" with waiting until completion
else
	say "Airport is active" with waiting until completion
end if
delay 2
say "Connecting to personal access network" with waiting until completion
try
	connect to wireless network theNetwork
on error
	say "Expected wireless network not active on client" with waiting until completion
end try
delay 5 -- for the connection to establish
say "For this session," with waiting until completion
set passCode to text returned of ¬
	(display dialog "Enter password for " & userID with icon caution default answer "" with hidden answer)
try
	-- WARNING : ENSURE SECURITY ON SERVER & CLIENT BEFORE PROCEEDING
	-- REQUIRES APPLETalk TO BE ACTIVE ON THE SERVER & CLIENT
	mount volume theVolume on server theserver as user name userID with password passCode
on error
	say "Check Apple Talk is active on Server and Client" with waiting until completion
end try
say "opening work folder on client " with waiting until completion
-- need to make the password via a dialog box
set thepass to userID & ":" & passCode & "@"
say " and, opening work folders on server " with waiting until completion
try
	-- WARNING : ENSURE SECURITY ON SERVER & CLIENT  BEFORE PROCEEDING
	-- REQUIRES APPLE REMOTE EVENTS TO BE ACTIVE ON THE SERVER
	-- remotely control Finder on server from client	
	tell application "Finder" of machine ("eppc://" & thepass & theserver & ":3031/")
		using terms from application "Finder"
			open folder theVolume & ":Users:" & userID -- desktop folder of user
			open folder theVolume -- top level folder
		end using terms from
	end tell
on error
	say "server unreachable, ensure,"
	say "wireless networking is activated," with waiting until completion
	say "remote apple events activated on server," with waiting until completion
	say " and check personal file server" with waiting until completion
end try

There are applications that implement remote access to varying degrees, and for varying purposes but this is just a demonstration of what can be done using AppleScript.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox