diff options
Diffstat (limited to '')
-rw-r--r-- | OhSillyThreatDetector.lsl | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/OhSillyThreatDetector.lsl b/OhSillyThreatDetector.lsl new file mode 100644 index 0000000..4f17ed6 --- /dev/null +++ b/OhSillyThreatDetector.lsl | |||
@@ -0,0 +1,59 @@ | |||
1 | |||
2 | // Detect when OpenSim reports a function was used that triggered a threat level warning. | ||
3 | // Coz their official method doesn't work, and often their threat levels are set way too high. | ||
4 | |||
5 | // This script will send a link message with number DEBUG_CHANNEL, message being the name of the naughty function, | ||
6 | // and key of the prim containing the naughty script. It's up to the naughty script to catch this link message | ||
7 | // and do something less naughty. | ||
8 | |||
9 | // Since it sniffs on DEBUG_CHANNEL messages, and a script can't hear any message sent by scripts in the same prim, | ||
10 | // you'll need to put this script in a prim without the naughty scripts you want to check. | ||
11 | |||
12 | default | ||
13 | { | ||
14 | state_entry() | ||
15 | { | ||
16 | // llSay(DEBUG_CHANNEL, "G'day, I'm " + llGetKey() + " part of " + llGetLinkKey(LINK_ROOT)); | ||
17 | llListen(DEBUG_CHANNEL, "", NULL_KEY, ""); | ||
18 | } | ||
19 | |||
20 | listen(integer channel, string name, key id, string message) | ||
21 | { | ||
22 | key root = llList2Key(llGetObjectDetails(id, [OBJECT_ROOT]), 0); | ||
23 | // name is the name of the prim, id is the UUID of the prim. | ||
24 | // Reports the name and UUID of the prim itself, not the object it's part of. | ||
25 | // Naturally can't detect debugs from our own prim, even if it's a different script. | ||
26 | // Works from another prim in the same object. | ||
27 | |||
28 | /* Threat level errors look like this (at least in OpenSim 0.8.2) - | ||
29 | OSSL Runtime Error: osSetStateEvents permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission. | ||
30 | |||
31 | There is also (OpenSim 0.9 at least) - | ||
32 | Max Zephyr script | ||
33 | OSSL Runtime Error: permission denied. All OS functions are disabled.(script: oc_settings event: changed primID:487baa88-d6e5-420c-b18c-f47f5bbd7de4 at <127.9408, 128.0009, 25.75689>) | ||
34 | |||
35 | My script | ||
36 | OSSL Runtime Error: osSetSpeed permission denied. All OS functions are disabled.(script: 1AOor2 event: changed primID:c7db8d3c-ae33-44ce-a685-cf63a37f0cf5 at <123.933, 203.0375, 24.29473>) | ||
37 | |||
38 | From the source (NOTE: first version has no function name) - | ||
39 | ("{0} permission denied. All OS functions are disabled.") | ||
40 | ("{0} permission denied. All OS functions are disabled.", function) | ||
41 | ("{0} permission denied. Allowed threat level is {1} but function threat level is {2}.", function, | ||
42 | ("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", function | ||
43 | ("{0} permission denied. Script permissions error.", function | ||
44 | |||
45 | OpenSim 0.9.0.1 doesn't include the "OSSL Runtime Error: " bit at the beginning anymore. | ||
46 | OpenSim 0.9.2 seems to not even send it to the DEBUG_CHANNEL for scripts anymore. | ||
47 | */ | ||
48 | if ((llGetLinkKey(LINK_ROOT) == root) && ("OSSL Runtime Error: " == llGetSubString(message, 0, 19))) | ||
49 | { | ||
50 | list e = llParseStringKeepNulls(llGetSubString(message, 20, -1), [" "], []); | ||
51 | //llOwnerSay(llList2String(e, 0)); | ||
52 | if (("permission" == llList2String(e, 1)) && ("denied" == llList2String(e, 2))) | ||
53 | { | ||
54 | string function = llList2String(e, 0); | ||
55 | llMessageLinked(LINK_SET, DEBUG_CHANNEL, function, id); | ||
56 | } | ||
57 | } | ||
58 | } | ||
59 | } | ||