Script Resource Inspector (Result of "Run Only" thread)
Script Resource Inspector (Result of "Run Only" thread)
- Subject: Script Resource Inspector (Result of "Run Only" thread)
- From: Rob Jorgensen <email@hidden>
- Date: Sat, 23 Dec 2000 21:46:03 -0500
Greetings :-)
In a recent thread titled "Run Only", I had considered the usefulness
of creating a script which would give some indication of what an
unknown Run Only script might contain. It would be a monumental, if
not impossible task, to create a comprehensive script which was aware
of every potentially harmful event/command in every available
application and scripting addition. Nonetheless, here's the basic
script, which can be customized to suit your needs and comfort level.
If nothing else, the script can let you take a quick peek at the
resources of a Run Only script without using a resource editor such
as ResEdit. It would only take a couple of more lines of code to send
the contents of the resource to a text editor for your viewing
pleasure.
The only resource which this script deals with is "scpt", ID 128.
Tanaka's osax 2.0 is used for reading the resource and placing it
into a variable (resourceText). Other than that, I believe the script
is vanilla.
Here's the script (version 1.0):
-- Begin Script
on open {aFile}
set resourceText to ""
set theCriteria to {"fndrempt", "trsh", "coredel",
"coremove", "rdwrwrit", "rdwrread"} -- Modify to reflect your needs
and applications
set theHits to ""
try
set resourceText to MT Read Resource aFile of type
"scpt" ID 128
on error
display dialog "This file appears to be something
other than a script." buttons ("OK") default button 1 with icon 1
return
end try
repeat with i from 1 to count of theCriteria
if resourceText contains item i of theCriteria then
set theHits to (item i of theCriteria) & ", "
& theHits as text
end if
end repeat
try
set theHits to items 1 through ((count of theHits) -
2) of theHits as string
end try
if theHits is not "" then
display dialog "This script may contain harmful
events." buttons ("OK") default button 1 with icon 2
display dialog "Event(s) Found: " & theHits buttons
("OK") default button 1 with icon 2
else
display dialog "According to the pre-defined search
criteria specified in this script, no harmful events were found.
Always use caution when running unknown scripts." buttons ("OK")
default button 1 with icon 1
end if
end open
-- End Script
FYI: I'm running OS 9.0.4 and I have no idea how this will behave
when run under any other OS.
Any and all feedback is welcome. As you can see, I'm not a seasoned
scripter, so abuse gently. ;-)
Later,
Rob Jorgensen
Ohio, USA