aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OhSillyThreatDetector.lsl
blob: 4f17ed69a1d1059343f71ef96a30672bced09524 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

// Detect when OpenSim reports a function was used that triggered a threat level warning.
// Coz their official method doesn't work, and often their threat levels are set way too high.

// This script will send a link message with number DEBUG_CHANNEL, message being the name of the naughty function, 
// and key of the prim containing the naughty script.  It's up to the naughty script to catch this link message
// and do something less naughty.

// Since it sniffs on DEBUG_CHANNEL messages, and a script can't hear any message sent by scripts in the same prim,
// you'll need to put this script in a prim without the naughty scripts you want to check.

default
{
    state_entry()
    {
//        llSay(DEBUG_CHANNEL, "G'day, I'm " + llGetKey() + " part of " + llGetLinkKey(LINK_ROOT));
        llListen(DEBUG_CHANNEL, "", NULL_KEY, "");
    }

    listen(integer channel, string name, key id, string message)
    {
        key root =  llList2Key(llGetObjectDetails(id, [OBJECT_ROOT]), 0);
        // name is the name of the prim, id is the UUID of the prim.
        // Reports the name and UUID of the prim itself, not the object it's part of.
        // Naturally can't detect debugs from our own prim, even if it's a different script.
        // Works from another prim in the same object.

        /* Threat level errors look like this (at least in OpenSim 0.8.2) -
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.

There is also (OpenSim 0.9 at least) -
Max Zephyr script
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>)

My script
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>)

From the source (NOTE: first version has no function name) -
("{0} permission denied.  All OS functions are disabled.")
("{0} permission denied.  All OS functions are disabled.", function)
("{0} permission denied.  Allowed threat level is {1} but function threat level is {2}.", function,
("{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
("{0} permission denied. Script permissions error.", function

OpenSim 0.9.0.1 doesn't include the "OSSL Runtime Error: " bit at the beginning anymore.
OpenSim 0.9.2 seems to not even send it to the DEBUG_CHANNEL for scripts anymore.
        */
        if ((llGetLinkKey(LINK_ROOT) == root) && ("OSSL Runtime Error: " == llGetSubString(message, 0, 19)))
        {
            list e = llParseStringKeepNulls(llGetSubString(message, 20, -1), [" "], []);
//llOwnerSay(llList2String(e, 0));
            if (("permission" == llList2String(e, 1)) && ("denied" == llList2String(e, 2)))
            {
                string function = llList2String(e, 0);
                llMessageLinked(LINK_SET, DEBUG_CHANNEL, function, id);
            }
        }
    }
}