diff options
Diffstat (limited to 'OhSillyThreatDetector.lsl')
-rw-r--r-- | OhSillyThreatDetector.lsl | 79 |
1 files changed, 42 insertions, 37 deletions
diff --git a/OhSillyThreatDetector.lsl b/OhSillyThreatDetector.lsl index 24b3e43..2c808d2 100644 --- a/OhSillyThreatDetector.lsl +++ b/OhSillyThreatDetector.lsl | |||
@@ -9,7 +9,7 @@ | |||
9 | // Since it sniffs on DEBUG_CHANNEL messages, and a script can't hear any message sent by scripts in the same prim, | 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. | 10 | // you'll need to put this script in a prim without the naughty scripts you want to check. |
11 | 11 | ||
12 | // Naturally it looks as if OpenSim has decided that scripts sniffing DEBUG_CHANNEL is a bad idee now. | 12 | // Naturally it looks as if OpenSim has decided that scripts sniffing DEBUG_CHANNEL is a bad idea now. |
13 | 13 | ||
14 | // Bits of this where taken from the script at the bottom of http://opensimulator.org/wiki/Threat_level | 14 | // Bits of this where taken from the script at the bottom of http://opensimulator.org/wiki/Threat_level |
15 | 15 | ||
@@ -23,32 +23,37 @@ integer WhichProbeFunction; // to tell us which function we're probing | |||
23 | // OpenSim lies. | 23 | // OpenSim lies. |
24 | list FunctionNames = | 24 | list FunctionNames = |
25 | [ | 25 | [ |
26 | // "osAvatarName2Key", // low (it fails anyway) | 26 | "osAvatarPlayAnimation", // very high |
27 | "osAvatarPlayAnimation", // very high | 27 | "osAvatarStopAnimation", // very high |
28 | "osAvatarStopAnimation", // very high | 28 | "osForceOtherSit", // very high |
29 | "osForceOtherSit", // very high | 29 | "osGetAvatarList", // none |
30 | // "osGetAgentIP", // severe | 30 | "osMakeNotecard", // high (describes what they where when making this decision) |
31 | // "osGetAgents", // none (it fails anyway) | 31 | "osGetNotecard", // very high (describes what they where when making this decision) |
32 | "osGetAvatarList", // none (it fails anyway) | 32 | "osGetNotecardLine", // very high (describes what they where when making this decision) |
33 | "osMakeNotecard", // high (describes what they where when making this decision) | 33 | "osGetNumberOfNotecardLines", // very high (describes what they where when making this decision) |
34 | "osGetNotecard", // very high (describes what they where when making this decision) | 34 | "osGetInventoryDesc", // - |
35 | "osGetInventoryDesc", // - | 35 | "osGetRegionSize", // - |
36 | "osGetNotecardLine", // very high (describes what they where when making this decision) | 36 | "osGetRezzingObject", // none |
37 | "osGetNumberOfNotecardLines", // very high | 37 | "osIsNpc", // - |
38 | "osGetRegionSize", // - (it fails anyway) | 38 | "osKey2Name", // low |
39 | "osGetRezzingObject", // none (it fails anyway) | 39 | "osMessageObject", // low |
40 | "osIsNpc", // - (it fails anyway) | 40 | "osNpcSit", // high |
41 | "osKey2Name", // low (it fails anyway) | 41 | "osSetSpeed", // moderate |
42 | "osMessageObject", // low (it fails anyway) | 42 | // "osSetOwnerSpeed", // moderate (not in 0.9.0.2) |
43 | "osNpcSit", // high | 43 | "osTeleportAgent", // severe |
44 | "osSetSpeed", // moderate | 44 | "osTeleportOwner" // none |
45 | "osTeleportAgent" // severe (it works anyway) | ||
46 | ]; | 45 | ]; |
47 | list FunctionPermitted = []; // 0 = not permitted, 1 = permitted | 46 | list FunctionPermitted = []; // 0 = not permitted, 1 = permitted |
48 | 47 | ||
49 | startProbe() | 48 | startProbe() |
50 | { | 49 | { |
51 | // llSay(0, "Probing OhSilly threat system to see what OpenSim script functions we are allowed use -"); | 50 | string root = llKey2Name(llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_ROOT]), 0)); |
51 | |||
52 | llRegionSay(DEBUG_CHANNEL, "The '" + llGetObjectName() + "' prim in the object called '" + root + | ||
53 | "' belonging to '" + llKey2Name(llGetOwner()) + | ||
54 | "' might be about to spew OhSilly Threat Level system errors on the debug channel. " + | ||
55 | "Blame OpenSim developers for making this script jump through these hoops. Apologies. \n\n" + | ||
56 | "Probing OhSilly threat system to see what OpenSim script functions we are allowed use..."); | ||
52 | WhichProbeFunction = -1; | 57 | WhichProbeFunction = -1; |
53 | integer i = llGetListLength(FunctionNames); | 58 | integer i = llGetListLength(FunctionNames); |
54 | FunctionPermitted = []; | 59 | FunctionPermitted = []; |
@@ -73,7 +78,7 @@ default | |||
73 | 78 | ||
74 | listen(integer channel, string name, key id, string message) | 79 | listen(integer channel, string name, key id, string message) |
75 | { | 80 | { |
76 | key root = llList2Key(llGetObjectDetails(id, [OBJECT_ROOT]), 0); | 81 | // key root = llList2Key(llGetObjectDetails(id, [OBJECT_ROOT]), 0); |
77 | // name is the name of the prim, id is the UUID of the prim. | 82 | // name is the name of the prim, id is the UUID of the prim. |
78 | // Reports the name and UUID of the prim itself, not the object it's part of. | 83 | // Reports the name and UUID of the prim itself, not the object it's part of. |
79 | // Naturally can't detect debugs from our own prim, even if it's a different script. | 84 | // Naturally can't detect debugs from our own prim, even if it's a different script. |
@@ -96,9 +101,11 @@ From the source (NOTE: first version has no function name) - | |||
96 | ("{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 | 101 | ("{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 |
97 | ("{0} permission denied. Script permissions error.", function | 102 | ("{0} permission denied. Script permissions error.", function |
98 | 103 | ||
99 | OpenSim 0.9.1 seems to not even send it to the DEBUG_CHANNEL for scripts anymore. | 104 | OpenSim 0.9.1 sends to DEBUG_CHANNEL, but scripts can't read that. |
105 | osForceOtherSit permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.(script: OhSillyThreatDetector event: timer at <754.7451, 311.6997, 23.24454>) | ||
100 | */ | 106 | */ |
101 | if (llGetLinkKey(LINK_ROOT) == root) | 107 | //llOwnerSay(message); |
108 | // if (llGetLinkKey(LINK_ROOT) == root) | ||
102 | { | 109 | { |
103 | integer f = llSubStringIndex(message, "permission denied. "); | 110 | integer f = llSubStringIndex(message, "permission denied. "); |
104 | if (-1 != f) | 111 | if (-1 != f) |
@@ -108,7 +115,7 @@ OpenSim 0.9.1 seems to not even send it to the DEBUG_CHANNEL for scripts anymore | |||
108 | if (("OSSL" == llList2String(e, 0)) && ("Runtime" == llList2String(e, 1)) && ("Error:" == llList2String(e, 2))) | 115 | if (("OSSL" == llList2String(e, 0)) && ("Runtime" == llList2String(e, 1)) && ("Error:" == llList2String(e, 2))) |
109 | function = llList2String(e, 3); | 116 | function = llList2String(e, 3); |
110 | llMessageLinked(LINK_SET, DEBUG_CHANNEL, function, "0"); | 117 | llMessageLinked(LINK_SET, DEBUG_CHANNEL, function, "0"); |
111 | llOwnerSay("Found naughty function " + function); | 118 | llOwnerSay("Found naughty function " + function); |
112 | llRegionSay(DEBUG_CHANNEL, "OPENSIM SUCKS!"); | 119 | llRegionSay(DEBUG_CHANNEL, "OPENSIM SUCKS!"); |
113 | } | 120 | } |
114 | } | 121 | } |
@@ -152,34 +159,28 @@ llOwnerSay("Found naughty function " + function); | |||
152 | t += llList2String(FunctionNames, i) + "() "; | 159 | t += llList2String(FunctionNames, i) + "() "; |
153 | } | 160 | } |
154 | // llSay(0, s); | 161 | // llSay(0, s); |
155 | llSay(0, t); | 162 | llOwnerSay(t); |
156 | return; | 163 | return; |
157 | } | 164 | } |
158 | // llOwnerSay("Checking OpenSim function " + name + "()"); // say status | 165 | // llOwnerSay("Checking OpenSim function " + name + "()"); // say status |
159 | if ("osAvatarName2Key" == name) | 166 | if ("osAvatarPlayAnimation" == name) |
160 | osAvatarName2Key("John", "Smith"); | ||
161 | else if ("osAvatarPlayAnimation" == name) | ||
162 | osAvatarPlayAnimation(BogusKey, BogusKey); | 167 | osAvatarPlayAnimation(BogusKey, BogusKey); |
163 | else if ("osAvatarStopAnimation" == name) | 168 | else if ("osAvatarStopAnimation" == name) |
164 | osAvatarStopAnimation(BogusKey, BogusKey); | 169 | osAvatarStopAnimation(BogusKey, BogusKey); |
165 | else if ("osForceOtherSit" == name) | 170 | else if ("osForceOtherSit" == name) |
166 | osForceOtherSit(BogusKey, llGetKey()); | 171 | osForceOtherSit(BogusKey, llGetKey()); |
167 | else if ("osGetAgentIP" == name) | ||
168 | osGetAgentIP(BogusKey); | ||
169 | else if ("osGetAgents" == name) | ||
170 | osGetAgents(); | ||
171 | else if ("osGetAvatarList" == name) | 172 | else if ("osGetAvatarList" == name) |
172 | osGetAvatarList(); | 173 | osGetAvatarList(); |
173 | else if ("osMakeNotecard" == name) // Out of order, so the others have something to read. | 174 | else if ("osMakeNotecard" == name) // Out of order, so the others have something to read. |
174 | osMakeNotecard("OhSillyThreatCard", [""]); | 175 | osMakeNotecard("OhSillyThreatCard", [""]); |
175 | else if ("osGetNotecard" == name) | 176 | else if ("osGetNotecard" == name) |
176 | osGetNotecard("OhSillyThreatCard"); | 177 | osGetNotecard("OhSillyThreatCard"); |
177 | else if ("osGetInventoryDesc" == name) | ||
178 | osGetInventoryDesc("inventory"); | ||
179 | else if ("osGetNotecardLine" == name) | 178 | else if ("osGetNotecardLine" == name) |
180 | osGetNotecardLine("OhSillyThreatCard", 0); | 179 | osGetNotecardLine("OhSillyThreatCard", 0); |
181 | else if ("osGetNumberOfNotecardLines" == name) | 180 | else if ("osGetNumberOfNotecardLines" == name) |
182 | osGetNumberOfNotecardLines("OhSillyThreatCard"); | 181 | osGetNumberOfNotecardLines("OhSillyThreatCard"); |
182 | else if ("osGetInventoryDesc" == name) | ||
183 | osGetInventoryDesc("inventory"); | ||
183 | else if ("osGetRegionSize" == name) | 184 | else if ("osGetRegionSize" == name) |
184 | osGetRegionSize(); | 185 | osGetRegionSize(); |
185 | else if ("osGetRezzingObject" == name) | 186 | else if ("osGetRezzingObject" == name) |
@@ -187,15 +188,19 @@ llOwnerSay("Found naughty function " + function); | |||
187 | else if ("osIsNpc" == name) | 188 | else if ("osIsNpc" == name) |
188 | osIsNpc(BogusKey); | 189 | osIsNpc(BogusKey); |
189 | else if ("osKey2Name" == name) | 190 | else if ("osKey2Name" == name) |
190 | osKey2Name(BogusKey); | 191 | osKey2Name(llGetOwner()); |
191 | else if ("osMessageObject" == name) | 192 | else if ("osMessageObject" == name) |
192 | osMessageObject(llGetKey(), "G'day."); | 193 | osMessageObject(llGetKey(), "G'day."); |
193 | else if ("osNpcSit" == name) | 194 | else if ("osNpcSit" == name) |
194 | osNpcSit(BogusKey, llGetKey(), 0); | 195 | osNpcSit(BogusKey, llGetKey(), 0); |
195 | else if ("osSetSpeed" == name) | 196 | else if ("osSetSpeed" == name) |
196 | osSetSpeed(BogusKey, 1.0); | 197 | osSetSpeed(BogusKey, 1.0); |
198 | // else if ("osSetOwnerSpeed" == name) | ||
199 | // osSetOwnerSpeed(1.0); | ||
197 | else if ("osTeleportAgent" == name) | 200 | else if ("osTeleportAgent" == name) |
198 | osTeleportAgent(BogusKey, ZERO_VECTOR, ZERO_VECTOR); | 201 | osTeleportAgent(BogusKey, ZERO_VECTOR, ZERO_VECTOR); |
202 | else if ("osTeleportAgent" == name) | ||
203 | osTeleportOwner(ZERO_VECTOR, ZERO_VECTOR); | ||
199 | 204 | ||
200 | // If we got here, then the timer() handler didn't crash, which means the function it checked for | 205 | // If we got here, then the timer() handler didn't crash, which means the function it checked for |
201 | // was actually permitted. So we update the list to indicate that we can use that particular function. | 206 | // was actually permitted. So we update the list to indicate that we can use that particular function. |