How do I scare my students?

Ok this is probably basic stuff but I am really stuck!
I have browsed the forums for a way of doing this but can’t find one.
I need to make the kids in my class think that they are being monitored (to discourage them from logging on to inappropriate sites that the filter doesn’t work on). I would like to give them a warning message, then allow them to launch their browser. So far I have got to this:

“Your internet activity is being monitored by Mr.Tyrrell. Do you want to continue?”
display dialog “Your internet activity is being monitored by Mr.Tyrrell via wireless connection to his laptop . Are you sure you want to continue?”
display dialog “Are you really sure? Remember that EVERYTHING is being logged!”

When I run the script it isn’t attached to the app and when it is run it brings up another window entitled: Result.
How can I make this work when a user launches a browser, and make some kind of log of the date & time?

Sorry it’s a big request but I’ve tried looking and working it out myself but I can’t
I would really appreciate any help or links.
Thanks. :?

Wow, this is quite a challange. First, let me say that AppleScript isn’t really suited to this… but that’s never stopped me before. :slight_smile:

The following is a very untested solution. Perhaps other scripters might take a look at it and suggest improvements. The idea here is to create a stay-open, run-only script applet that is always running on the kiddies computers. The quit handler tries to ensure that they can’t turn off the applet without a password. Then, every few seconds or so, the applet checks to see if a browser was opened, (ie: the browser is launched first, then the warning pops up).

This is probably not a good idea, and you may be better off buying appropriate security software, as this isn’t going to stop a smart and persistent child:


--	If your kids are really intelligent, (and have access to
--	ResEdit under OS9 or any source code editor under OSX,
--	then this method of storing a password will be woefully
--	inadequate).
--
property thePassword : "Mr. Tyrrell is so cool."


--	Allow applet to quit only after school is over, (or with
--	Mr. Tyrrell's password.)
--
property schoolIsOver : 60 * 60 * 15 -- 3:00 pm, in seconds


--	This indicates how many seconds elaspse between each check
--	for an open browser. AppleScript doesn't allow fractional
--	seconds, and you have to be careful, because if it checks
--	too often, it could cause memory problems:
--
property checkEvery : 5 -- seconds


--	Internal boolean switch
--
property browserWasLaunched : false


on quit
	
	--	Requires the computer's clock to be kept set properly,
	--	(which in a school environment is no doubt difficult).
	--
	set theTime to time of (current date) --> seconds
	
	if (theTime < shoolIsOver) then -- school's in session
		
		display dialog ("Oh, trying to quit, are we?") ¬
			buttons {"Password"} ¬
			default button ("Password") ¬
			default answer ""
		
		set thisPassword to text returned of result
		
		if (thisPassword = thePassword) then continue quit
		
		display dialog ("An illegal attempt to quit this Security " & ¬
			"Protocal has been logged to Mr. Tyrrell's laptop.") ¬
			buttons {"VIOLATOR!!!"} default button "VIOLATOR!!!"
		
		-- Put code here that ACTUALLY makes a log entry,
		-- (I'll let someone else post a solution for this).
		
	else
		continue quit -- school's over, kids have gone home
	end if
	
end quit

on idle
	
	tell application "Finder"
		
		set programNames to (name of every application process) as string
		
	end tell
	
	if (programNames contains "Safari") or ¬
		(programNames contains "Netscape") or ¬
		(programNames contains "Internet Explorer") then
		
		set browserIsOpen to true
	else
		set browserIsOpen to false
		
	end if
	
	if (browserWasLaunched) and (not browserIsOpen) then
		
		-- browser was closed
		--
		set browserWasLaunched to false
		
	else if (not browserWasLaunched) and (browserIsOpen) then
		
		-- browser was opened, so go scare the kiddies
		--
		set browserWasLaunched to true
		
		tell me to activate -- frontmost
		
		display dialog ("Your internet activity is being monitored " & ¬
			"by Mr.Tyrrell. Do you want to continue?") ¬
			buttons {"No, I'm bad.", "Yes, I'm good."} ¬
			default button "Yes, I'm good."
		
		if (button returned of result = "Yes, I'm good.") then
			
			display dialog ("Your internet activity is being monitored " & ¬
				"by Mr. Tyrrell via wireless connection to his laptop. " & ¬
				"Are you sure you want to continue?") ¬
				buttons {"Never mind.", "Yes, I'm sure."} ¬
				default button "Yes, I'm sure."
			
			if (button returned of result = "Yes, I'm sure.") then
				
				display dialog ("Are you really sure? Remember that " & ¬
					"EVERYTHING is being logged!") ¬
					buttons {"Oh... no.", "Yeah, man, get on with it."} ¬
					default button "Yeah, man, get on with it."
				
				if (button returned of result = "Yeah, man, get on with it.") then
					
					-- put logging code here
					
					return checkEvery -- break out of handler here
					
				end if
			end if
		end if
	end if
	
	--	Oh... last minute idea: if any of the above dialogs was "no",
	--	then let's go ahead and quit the offending application.
	--
	--
	--	Umm... under classic, I knew how to do this, but under OS X,
	--	the Finder isn't allowing me to send events to any "application
	--	process as <<class psn >>" What's going on here?
	
	return checkEvery -- break out of handler here
end idle

The above is not very robust, and I created it primarily as an exercise, but let me know if seems useful. :slight_smile:

Note: Any application can be force-quit with command-option-escape, which any real Macintosh literate kid is going to know, sorry.

First of all thanks for the prompt help - amazing!
I understand bits of it but as I originally said I am a complete beginner at this. I will try this when I get back to school in a fortnight.
All I really want to do is to make the kids think that they are being monitored. I assumed that the best way would be to use Aplescript to launch a dialogue box when the IE icon is clicked - didn’t rrealise that it might be relly complicated.
Thanks.

By the way - I have only just got the school to cough up for the macs. My kids are PC users and we are on a PC network so I don’t think that it would be a problem with them working things out. 11- 16 year olds are more interested in what they are doing outside of school than trying to work out hoe to circumvent a security application.
Thanks again
8)

OK, if you’re really not worried about having any actual security, then this should do:

  1. Paste this into a new script window:

	display dialog ("Your internet activity is being monitored by Mr. Tyrrell via wireless connection to his laptop. Are you sure you want to continue?")
	display dialog ("Are you really sure? Remember that EVERYTHING is being logged!")
	tell application "Safari" to activate

  1. Save the script as an application, naming it “Safari”, and placing it on the desktop.

  2. Go to your Applications folder and select the icon for Safari. Then choose “Get Info” from the File menu. When the Info window pops up, select the Safari icon in the upper left corner of the window and copy it (command-c). Then go to the desktop, select your script application called Safari, and do a Get Info on it. Select its icon in the upper left corner of the Info window and do a paste (command-v). Close the Info windows, and test out the script. It should look just like Safari.

  3. Now, if you want to try for some obfustication, drag the actual Safari application out of the Applications folder and… hmm, I don’t know, try hiding it somewhere on the hard drive, somewhere the kids aren’t likely to go. Now, place the script application called Safari into the applications folder and drag an alias of it to the desktop, (or drag it into the Dock, whereever you’d place alias to the real Safari, etc).

You may think that your kids aren’t really going to try too hard to get around stuff like this, but I can tell you from experience that there is always one quiet hacker in any group of 30 or more kids for whom the above suggestions will be, well, child’s play. :slight_smile:

Thanks again. It works apart form the annoying bit that says press run to use this script or quit to quit!
Why didn’t I think of that?
I only need it to work for a while until I can get them to come up with the funds for Remote Desktop.
Thanks very much for your help. :smiley:

No, no, that’s settable via a preference in the “save as” dialog box. In newer versions of Apple’s Script Editor, the “splash” screen is suppose to be off by default. I think the checkbox says “startup screen.” Just uncheck it when you do another “save as.”

You want to save as application, and run only i believe. And just a note, being one of those “hacker” kids in highschool, I can tell you this, if there were three warnings on the computer, I would definitely think it was a bs warning, Just once should suffice, three would have made me laugh. Maybe say that all computer activity is monitored and recorded! If you are worried, you can get a keystroke recorder to see what’s up.

ben