Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Security Security Orb  

Security Orb

A high quality Security system

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

the Zip file

Download all files for Security Orb
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. PDSHomeSecurityOrb_OpenSource-20140803.zip
Get file # 2. !README.txt
Get file # 3. HomeSecurity Channel.txt
Get file # 4. HomeSecurity Settings 9.000.txt
Get file # 5. HS9 0Menus _DON'T RESET_.lsl
Get file # 6. HS9 1Security _DON'T RESET_.lsl
Get file # 7. HS9 21Sensor _DON'T RESET_.lsl
Get file # 8. HS9 2Scanner _DON'T RESET_.lsl
Get file # 9. HS9 3Weapon _DON'T RESET_.lsl
Get file # 10. HS9 4Settings _DON'T RESET_.lsl
Get file # 11. HS9 5List _DON'T RESET_.lsl
Get file # 12. HS9 6EmailUUID0 _DON'T RESET_.lsl
Get file # 13. HS9 6EmailUUID1 _DON'T RESET_.lsl
Get file # 14. HS9 6EmailUUID2 _DON'T RESET_.lsl
Get file # 15. HS9 7Updates _DON'T RESET_.lsl
Get file # 16. HS9 81VisitorLog _DON'T RESET_.lsl
Get file # 17. HS9 8Log _DON'T RESET_.lsl
Get file # 18. HS9 9Backup _DON'T RESET_.lsl
Get file # 19. HSP 22AvScripts.lsl
Get file # 20. README.txt
Get file # 21. [35285 bytes] hsorb1sim.jpg
Get file # 22. [79817 bytes] hsorbapartments.jpg
Get file # 23. [42648 bytes] hsorbmultiplesims.jpg
Get file # 24. [64412 bytes] hsorbpaths.jpg
Get file # 25. [50696 bytes] hsorbv13_1region.jpg
Get file # 26. [17478 bytes] hsorbv13_multipleregions.jpg
1 When using these script in world you will need to remove the .txt and .lsl.txt suffixes. They are just there for convenience outside of in world.
2 Some people might have trouble with the * in the file names. You may need to change the name of the file when/if extracting to your computer.
3
4
5
6 CC-BY-NC-SA
7
8 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
9 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
10
11 In summary:
12
13 You are free to:
14
15 Share — copy and redistribute the material in any medium or format
16 Adapt — remix, transform, and build upon the material
17
18 The licensor cannot revoke these freedoms as long as you follow the license terms.
19
20 Under the following terms:
21
22 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
23
24 NonCommercial — You may not use the material for commercial purposes.
25
26 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
27
28 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
29
30 In addition:
31 You can't use the trade mark "PDS HomeSecurity" or PDS logos.

Security Orb

A High quality Security System

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 channel=8
2 announce=0
3
4 # The top line is the channel commands and networked commands are received on by the Orb.
5 # The second line is the channel the HS Orb talks to you on. 0 = normal chat.
6
7 # By default the 2 lines should be:
8 # channel=8
9 # announce=0
10 # without any hashes (#) or spaces at the beginning
11
12 #PUBLIC DOMAIN

Security Orb

A High quality Security System

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 #################################################################
2 # IF YOU EDIT THIS NOTECARD YOU WILL NEED TO TYPE /8reset TO FORCE THE ORB TO RE-READ THIS CARD #
3 #################################################################
4 #PUBLIC DOMAIN
5
6 # If you find this too confusing then click the HS Orb and select [ SET UP ]
7 # lines staring with # are commented out!
8
9 ## OPERATION SECURITY
10
11 #Operators can control and configure EVERY aspect of your HS!
12 #psyke.phaeton is in charge of Psyke Defense Systems product development and installations.
13 #one 'operator=name' entry per name per line - format: operator=name
14 operator=psyke.phaeton
15
16 #Group Operated = All people (not just Officers) with the same group ACTIVE as the HS can control the HS completely. 1 is yes, 0 is no
17 #If this is set to 1 make sure to set your HS to a group. SecondLife sees no group on the HS and an avatar as the same group!!!!!
18 group_operated=0
19
20 #Networked devices are other Objects in second life than can control this HS. Typically other HS systems. Use /<channel> hsid to find
21 #the ID number of the other Object wish to add here <channel> is the number from channel= above. format: network=<HSID number>
22 network=01c3f5fg
23
24 #UUID of the upgrade server. Do not change this unless instructed
25 upgrade_server=cedd82b1-e1ff-b45f-b35f-d232583c0fac
26
27 #Allows "HomeSecurity Guardian HUD" to connect to the HS Orb if set to 1. Slight chance of hacking when enabled. See doco. Default 0 means off
28 object_interface=0
29
30 ## SCANNER SETTINGS
31
32 #Guests can access this land controlled by this HS when in Guests Mode. An alternative is the Group Safe option, see below.
33 #one 'guest=name' entry per name per line - format: operator=name
34 guest=your.guest
35
36 # This setting (authorised) is replaced by using guest= above but still works for backwards compatibility. You can ignore this entry.
37 # authorised=authorised.guest
38
39 #Friends can access this land controlled by this HS in Guests or Friends Mode. An alternative is the Group Safe option, see below.
40 #one 'friend=name' entry per name per line - format: friend=name
41 # Psyke Phaeton is in charge of Psyke Defense Systems product development and support.
42 friend=psyke.phaeton
43
44 #Targets are always shot when we are in Alarm or Target Mode. Targets are not shot when we are off or in Scan mode.
45 #one 'target=name' entry per name per line - format: target=name
46 target=an.enemy
47
48 #Armed range: how close a person can get in meters before we would shoot them if they are a valid target. -1 recommended
49 #Version 13+: -1 means this land parcel, -2 means any parcel owned by this parcels owner, -4 means whole region, otherwise non-zero
50 armed_range=-1
51
52 #Scan Rage is how far we look in meters when scanning only and not in Target/Friend/Guest mode, 256 recommended
53 #Version 13+: -1 means this land parcel, -2 means any parcel owned by this parcels owner, -4 means whole region, otherwise non-zero
54 scan_range=-4
55
56 #Scan rate is how often we look and how much warning intruders get. 10.0 is recommended 6.0 is the fastest reliable speed
57 scan_rate=10.0
58
59 #Group Safe with set to 1 will keep any person who has the same group ACTIVE as the HS safe ALWAYS! Except when using Menu:List Near/Select X/Strike
60 X# NOTE: Make sure you set the group on the HS too! SecondLife sees no group on the HS and on an avatar as being in the same group!
61 group_safe=0
62
63 #Island sim owners can legitimately not warn intruders before removing them from their land. If you are in this situation you may change this to 1
64 no_warning=0
65
66 # warning message sent before people are attacked
67 warning_message=You are not authorised to be in this area.
68
69 # warning message sent before guests and group members are attacked when in Freind Mode. If blank previous warning_message used.
70 guest_warning_message=Guest and Group members not allowed at this time.
71
72 #Display Name matches an Operator name but they are not that Operator. Teleport them Home? 0=no, 1=yes
73 fake_op_displayname_protection=0
74
75 #Display Name matches an Operator name but they are not that Operator
76 fake_op_displayname_message=Your Display Name is the same as a valid Security Operator in this area. You have been removed because you are not this Operator.
77
78 # Distance from the Orb above and below that the Orb's attacks can be limited to.
79 up=500.000
80 down=500.000
81
82 #0 = Sleep never, 1 = Sleep when No Operators present, 2 = Sleep when an Operator is present
83 sleep=0
84
85 # When this HS Orb sees a visitor come or go should the Operator get an IM? 0=no, 1=yes
86 visit_im=1
87
88 #Send a IM to the Operator starting the Orb when the web page URL changes? 0=no, 1=yes
89 announce_web=1
90
91 #Avatar Script Limits: -1 to disable, or 0 or more to enable.
92 # script_memory_* is in bytes.
93 # script_time_* is in seconds with a decimal point (1 micro-second = 0.000001 seconds).
94 # *_warn means they get 1 dialog box per visit
95 # *_teleport means they get sent out of the region by being teleported home
96 script_memory_warn=-1
97 script_count_warn=-1
98 script_time_warn=-1
99 script_memory_teleport=-1
100 script_count_teleport=-1
101 script_time_teleport=-1
102
103 ## ATTACK SETTINGS
104
105 #How hard do we push if using Attack Mode Push?? this is a percentage without the trailing %
106 push_percent=100.0
107
108 #Attack Type: 0 = push, 2 = Teleport Home, 3 = Land Eject
109 attack_type=3
110
111 #Foreign Land (Land not owned by this lands owner) is kept safe if this is 1... DONT SHOOT YOUR NEIGBORS!! MAKE THIS 1. 1 = yes, 0 = no
112 ######### MAKING THIS SETTING 0 MAY RESULT IN ABUSE REPORTS WHEN THE HS ATTACKS PEOPLE ON OTHER LAND!!!!! ########
113 foreign_land_safe=1
114
115 # Make other land, with a different name, owned by this land's owner safe? Set yes on rental properties for example. 1 = yes, 0 = no.
116 other_land_safe=1
117
118 #Notify the operator who started the HS when an attack occurs, 2 = Menu (Works only when you have been in the sim), 1 = IM (works only when avatar owned), 0 = no
119 notify_operator=1
120
121 #Notify the intruder after they are attacked with a popup menu informing them what happened and who owns the HS? 1 = yes, 0 = no
122 notify_intruder=1
123
124 # warning message sent after people are attacked
125 attack_message=You have been removed from this area because you are not authorised to be here.
126
127 #SL Land Ban people from the land? 0=no 1=yes.
128 ban=0
129
130 # How long to land ban in hours. 0 means for ever. SL max is 144 hours.
131 ban_time=0.5
132
133 #################################################################
134 # IF YOU EDIT THIS NOTECARD YOU WILL NEED TO TYPE /8reset TO FORCE THE ORB TO RE-READ THIS CARD #
135 #################################################################

Security Orb

A high quality security systemk

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31
32 integer announce; //channel replies are sent to
33 integer channel; // channel we use for dialog box and user commands
34 integer list_number_offset; // the number of the name to display in the next /MAIN/TARGETS menu.
35 //integer tpd = 6; // targets shown per dialog window in TARGETS menu
36 integer listen_id; // id of the listen()er
37 key menu_user_id; // saves name of menu user so dataserver() can use it when calling granting_user() printed text
38 key name_query_id; // query id SL gave when i asked for a key->name from data server
39 integer basic_menu;
40
41 //Last sentence for list when in Wizard menus
42 string wiz_last = "\nYou can edit these lists in 'Names' later"; //SETTINGS/Lists later.";
43 //Last sentence for list when in ADVANCED/Settings or Lists menus
44 string set_last = "\nTo delete an entry press (Next>>)";
45
46 string menu1operator1 = "(1/18) Operators:\nOperators can operate the Orb. Add yourself as operator. To add joe.blogs as Operator type in chat:\t /";
47 string menu1operator2 = "addo joe.blogs\n";
48
49 string menu1access1 =
50 "(2/18) Visitor Lists
51 Access to your land is dual level.
52 Guests Mode: allows Friends, Guests & Group
53 Friends Mode: allows Friends only.
54 To add Guest type: /";
55 string menu1access2 = "addg persons.name
56 To add Friend type: /";
57 //"(7/18) Authorised List:
58 //Authorised people are never attacked & Orb owner is never attacked. To add Joe Bloggs as safe type:
59 //\t /";
60 string menu1access3 = "addf persons.name\n";
61
62 string menu1target1 =
63 "(3/18) Target List
64 Targets are attacked. Orb owner is never attacked. To have joe.bloggs attacked when armed type:
65 \t/";
66 string menu1target2 = "addt joe.bloggs\n";
67
68 string menu1limits1 =
69 "(16/18) Limits
70 Set up and down range limits. Commands:
71 \t/";
72 string menu1limits2 = "up=<number in meters>
73 \t/";
74 string menu1limits3 = "down=<number in meters>
75 Typed anytime. Width limits set with Range & land borders. Recommend 500";
76
77 string menu1visit_im =
78 "(17/18) Visit IM:
79
80 When a visitor comes or goes should you get an IM?
81
82 Recommend [On]";
83
84 string menu1lists1 =
85 "View/Edit Lists:
86 Visitors ·· To add a Guest: /";
87 string menu1lists2 = "addg name
88 To add a Friend: /";
89 string menu1lists3 = "addf name
90 Operators ·· To add Operator: /";
91 string menu1lists4 = "addo name
92 Targets ·· To add Target: /";
93 string menu1lists5 = "addt name
94 Network ·· To network Orbs. /";
95 string menu1lists6 = "addn HSID
96 See TOP MENU/Help about Networking HSOrbs";
97
98 //MENU common items
99 string menu_groupset =
100 "
101 SL Viewer Instructions:
102 - Right Click the HSOrb, choose Edit
103 - Click General tab
104 - Click the Group: button, select Group
105 - Tick Share (with group)
106 - Click Deed (& Deed on the popup)
107 - Press [On] in this window";
108
109
110 //MENUS!!!
111 string menu1main =
112 "SETUP ·· *START HERE!*
113 Help ·· documentation & instructions
114 TurnOn ·· your PDS HomeSecurity™ Orb
115 TurnOff ·· your PDS HomeSecurity™ Orb
116 Names ·· and networks. Add/Delete
117 Log ·· of commands and visitors
118 ListNear ·· avatars
119 SETTINGS ·· for your PDS HomeSecurity™ Orb
120 Updates ·· and fixes";
121
122 // ? ? > ? ? ? ? ? ? ? ? ? ? › ? " " <-- fixed space
123
124 string menu1turnOn =
125 "Choose a Mode: Guests Recommended
126 Friends ·· Allow Orb FRIENDS ONLY
127 Guests^ ·· Allow Orb Friends, Guests & Group^
128 Public ·· Attack Orb Targets ONLY
129 NoAttack ·· Scan, NEVER ATTACK
130
131 ^ If Settings > Weapon > GroupSafe is ON people with same group ACTIVE as Orb are never attacked in Guests Mode";
132
133 string menu1wizard =
134 "Setup Wizard
135 Basic ·· 4 questions (Linden Home/New User)
136 Full ·· 18 questions (Experienced Users)
137
138 Experienced users can edit the 'HomeSecurity Settings' notecard and copy to other HSOrbs";
139
140 string menu1attackType =
141 "(4/18) Attack Type
142 Eject^ ·· them to outside your land (polite)
143 Teleport^ ·· the person back home (mean)
144 Push* ·· person gently away (useless)
145 ^ Orb and land need exact same owner.
146 * Very weak attack! Land Restricted Push may need to be off. Recommend Eject";
147
148
149 string menu1groupOp =
150 "(5/18) Group Operated
151 To have group members operate the Orb do these steps then click [On].
152 Recommend [Off]\n";
153
154 //string menu1relay =
155 //
156 //"--- Networking Devices ---
157 //This option is for networking multiple Orb systems. See doco in me.
158 //
159 //The command to add Networked Devices is:
160 //\t/8addn <HSID number>
161 //
162 //Assuming the default channel 8 is used.";
163
164 string menu1scanRange =
165
166 "(6/18) NoAttack Range
167
168 NoAttack Mode NEVER attacks.
169 How far to scan in NoAttack Mode?
170 'LandOwners' is any Region land with this lands owner.
171 Recomend Region.";
172
173 string menu1armedRange =
174
175 "(7/18) Armed Range
176
177 When the Orb is armed, how close can they get before attacked?
178 'LandOwners' is any Region land with this lands owner.
179 Recommend ThisLand.";
180
181 string menu1scanTimer =
182
183 "(8/18) Scan/Warn Timer
184
185 How often do we scan the area and how much warning do we give? Takes 1 second to scan 15 avatars.
186 Linden's recomend 10 secs";
187
188 string menu1groupSafe =
189
190 "(9/18) Group Safe
191 For group members to be safe follow these instructions then click [On] To be safe group members will need to have the Group ACTIVE on their avatar! Recommend [Off]";
192
193 string menu1push =
194
195 "(10/18) Push Percent
196
197 If you were to use Push how hard is person pushed. People across region borders can't be pushed
198 Recommend [100%] which is still weak.";
199
200 string menu1foreignLand =
201
202 "(11/18) Foreign Land Safe
203 Keep EVERYONE over foreign land SAFE?
204 The Orb can tell if the target and the Orb are over land owned by the same person.
205 Recommend [On] SO YOU DON'T ATTACK YOUR NEIGHBOURS AND THEIR VISITORS!!";
206
207 string menu1otherLand =
208
209 "(12/18) Keep other land SAFE?
210 The Orb can tell if an avatar & Orb are over different land. Recomended [On] FOR RENTED LAND where neigbours land has same owner.
211 Recommend [On] so any other land is ignored.";
212
213 string menu1sleep =
214 "(13/18) Sleep
215
216 SleepNever ·· Never sleep *Recommended*
217 SleepNoOp ·· Sleep when NO Operator present
218 SleepSeeOp ·· Sleep when Operator is present";
219
220
221 string menu1notifyOp =
222 "(14/18) Notify Op
223 Does the person who activates the Orb want an IM or Menu^ popup when it attacks?
224 Recommend [IM]
225 ^ Menus can only be sent by SL if you have been in this region since logon";
226
227 string menu1notifyIntruder =
228 "(15/18) Notify Intruder
229
230 Do you want to tell the target who attacked them?
231
232 Recommend [On]";
233
234 string menu1wizcomp =
235 "Wizard Completed: Congratulations!
236
237 You have configured the Orb.
238
239 Click [TurnOn] and select an option
240 Click [Help] for advanced documentation";
241
242 //string menu1off = "
243 //
244 //
245 //\t\t\t\t\t -=[ Orb is Offline ]=-";
246
247 //Deed to Group
248 //Group Land?
249 //LIST NEAR
250 //SETTINGS
251
252 //? SETUP · wizard ? BEGIN HERE
253 //? Help · documentation & instructions
254
255 //? TurnOn · your HomeSecurity™ Orb
256 //? TurnOff · your HomeSecurity™ Orb
257
258 //? Names · and networks. Add/Delete
259 //? Log · of commands and visitors
260 //? ListNear · avatars
261
262 //? SETTINGS · for your HomeSecurity™ Orb
263 //? Updates · and fixes";
264
265 string menu1settings =
266 "SETTINGS:
267 SETUP ·· wizard
268 Security ·· Operators, Group Operation
269 Scanner ·· Timer, Range, Names, Sleep, VisitIM
270 Weapon ·· AttackType, Notifications, Bans,
271 GroupSafe, Foreign/Other Land
272 Lists ·· Ops, Targets, Friends, Guests, Network
273 AvLimits ·· Avatar Script Limits, Age Limits,
274 DisplayName Protection
275
276 Click Help, Commands chapter for more.";
277
278 string menu1log =
279 "
280 Log Menu
281 VLog ·· Visitor log
282 CLog ·· Command log
283 VlogClear ·· Clear Visitor Log
284 CLogClear ·· Clear Command Log";
285
286 string menu1dispprot =
287 "(18/18) Display Name Protection
288
289 If an avatar is not an Operator but does use an Operators name in his Display Name do you want them removed from this area?
290 Recommend [Off]";
291
292
293
294 show_menu(key id, string menu_name, list buttons) {
295 llDialog(id, menu_name, buttons,channel);
296 }
297
298 main_menu(key id) {
299 //llSay(0,"menu main_menu() id = " + (string)id);
300 show_menu(id,menu1main,["TurnOff","ListNear","SETTINGS","TurnOn","Names","Log","SETUP","Help","Updates"]);
301 }
302
303 ml(integer num, string msg, key id) {
304 llMessageLinked(LINK_THIS,num,msg,id);
305 }
306
307 access_granted(key id, string name) { //, string remote?) {
308 llSay(announce,"(Menus) "+ //remote? +
309 "Access granted to " + name);
310 }
311
312 print_status() {
313 //llSay(0,"(Menus) Channel: " + (string)channel + " (" + (string)llGetFreeMemory() + " bytes free)");
314 llSay(0,"(0Menus) " + (string)llGetUsedMemory() + "b");
315 }
316
317 basic_menu_check(key id) {
318 if(basic_menu) show_menu(id, menu1wizcomp, ["TurnOn","Help","TOP MENU"]); //show wizcomp
319 else show_menu(id, menu1groupOp + menu_groupset, ["5 Off","5 On"]); //ask more questions
320 basic_menu = 0;
321 }
322
323 default
324 {
325 state_entry () {
326 if(llGetMemoryLimit() < 65536) llSay(DEBUG_CHANNEL,"**** Memory limit too low. Mono disabled? ****");
327 //channel number will be triggered from Settings Script detecting CHANGE_INVENTORY
328 if(llGetStartParameter() == 1294853845) {
329 //script sent from update disk
330 //llSay(DEBUG_CHANNEL,"(Menus) Updated");
331
332 } else {
333 //script reset, or STOLEN from orb or UPDATE DISK
334 llSay(0,"Restart detected. Script deleting.");
335 if(llKey2Name(llGetOwner()) != "Psyke Phaeton") llRemoveInventory(llGetScriptName()); //not psyke, delete
336 //recompiling script does not cause CHANGE_INVENTORY, therefore reget channel number
337 llGetNotecardLine("HomeSecurity Channel",0);
338 print_status();
339 }
340 }
341
342 link_message(integer sender, integer num, string menu, key id) {
343
344 //DEBUG
345 //llSay(DEBUG_CHANNEL,"(0Debug) num=" +(string)num + " string=" + menu + " key=" + (string)id);
346
347 if(num < 0 || num > 999) return; //not for me :)
348
349 if(num == 1) channel = (integer)menu; //the string variable from ml we called menu because it mostly sends menu buttons here
350 if(num == 2) announce = (integer)menu; //the string variable from ml we called menu because it mostly sends menu buttons here
351
352 if(num == 100) print_status();
353
354 if(num == 111) { //Security:detected a click and sent command 0111
355 //llSay(0,"menu ++");
356 main_menu(id);
357 string name;
358 if(llGetDisplayName(id) == "") name = llKey2Name(id) + " (" + llGetUsername(id) + ")";
359 else name = llGetDisplayName(id) + " (" + llGetUsername(id) + ")";
360 //if(name == "()") name = (string)id;
361 access_granted(id,name); //,"");
362 }
363 if(num == 112) { //Security:sent command 0112 to show a menu
364
365 //llSay(0,"(0Debug) menu click '" + menu + "'");
366 //commonly used button sets
367 list range_buttons = ["10m.","15m.","20m.","30m.","50m.","100m.","150m.","200m.","500m.","ThisLand.","LandOwners.","Region."];//use by Wiz ScanRange
368 list rate_buttons = ["15 secs","20 secs","30 secs","6 secs","8 secs","10 secs","1 secs","2 secs","4 secs"];
369 list pushpc_buttons = ["100%","85%","70%","60%","50%","40%","30%","20%","10%","5%","1%","0.001%"];
370 list settings_buttons = ["Weapon","Lists","Help","SETUP","Security","Scanner","TOP MENU","AvLimits"];
371 list log_buttons = ["CLog","CLogClear","VLogClear","VLog","TOP MENU"];
372 //user commands converted to expected menu names
373
374 menu = llToLower(menu);
375 string suffix = llGetSubString(menu,llSubStringIndex(menu,"=") + 1,-1);
376 string prefix = llToLower(llGetSubString(menu,0,llSubStringIndex(menu,"=")));
377
378
379 //Turned On via network. Extract the Op UUID so VisitIM won't nag them from this Orb then process command as normal.
380 integer localop = 1; //show menu after activating by default (unless turned via network)
381
382 if(llGetSubString(menu,0,8) == "noattack=") { menu="noattack"; localop = 0;} //id = (key)llGetSubString(menu,9,-10);
383 if(llGetSubString(menu,0,6) == "public=") { menu="public"; localop = 0;} //id = (key)llGetSubString(menu,7,-10);
384 if(llGetSubString(menu,0,6) == "guests=") { menu="guests"; localop = 0;} //id = (key)llGetSubString(menu,7,-10);
385 if(llGetSubString(menu,0,7) == "friends=") { menu="friends"; localop = 0;} //id = (key)llGetSubString(menu,8,-10);
386
387 //if(llGetSubString(menu,0,1) == "? ") menu = llGetSubString(menu,2,-1); // ? TOP MENU = MAIN MENU
388
389 //MENUS OR COMMANDS FROM (SECURITY)
390
391 if(menu=="full") {basic_menu = 0; ml(2000,llGetUsername(id),id); show_menu(id, menu1operator1 + (string)channel + menu1operator2 + wiz_last,["1 Next >"]); }
392 else if(menu=="basic") {
393 llSay(announce,"(0Menu) Configuring settings to Basic...");
394 basic_menu = 1;
395 ml(2000,llGetUsername(id),""); //"" key stops Sleep Menu popup being sent.
396 ml(1500,"0",""); //groupop off
397 ml(2500,"-4",""); //scanrange = Region
398 ml(2501,"-1",""); //armed range = ThisLand
399 ml(2502,"10",""); //scan timer
400 ml(3501,"0",""); //groupsafe
401 ml(3502,"1",""); //ForeignLand Safe on
402 ml(3508,"1",""); //OtherLand Safe on
403 ml(2104,"0",""); //sleepnever
404 ml(3503,"1",""); //Notify Op
405 ml(3504,"1",""); //Notify Intruder
406 ml(2106,"1",""); //VisitIM yes
407 ml(2650,"500",""); //Up 96m
408 ml(2651,"500",""); //Down 96m
409 ml(2020,"0",""); //Display Name Protection off
410 //...add more default settings here....
411 show_menu(id, menu1operator1 + (string)channel + menu1operator2 + wiz_last,["1 Next >","Help"]);
412 //...more other questions up here for Linden Home users!!...
413 //Targets
414 //Friends/Guests
415 //teleport/eject?
416 }
417 else if(menu=="1 next >") show_menu(id, menu1access1 + (string)channel + menu1access2 + (string)channel + menu1access3 + wiz_last, ["2 Next >","Help"]); //ops -> visitors
418 else if(menu=="2 next >") show_menu(id, menu1target1 + (string)channel + menu1target2 + wiz_last, ["3 Next >","Help"]); //visitors -> targets
419 else if(menu=="3 next >") show_menu(id, menu1attackType, ["4 Teleport","4 Push","Help","4 Eject"]); //targets -> attacktype
420 else if(menu=="4 push") {ml(3505,"0",""); ml(2201,"0",""); basic_menu_check(id); } //attacktype -> if not BASIC GroupOp else WizComp
421 else if(menu=="4 teleport") {ml(3505,"2",""); ml(2201,"2",""); basic_menu_check(id); } //attacktype -> if not BASIC GroupOp else WizComp
422 else if(menu=="4 eject") {ml(3505,"3",""); ml(2201,"3",""); basic_menu_check(id); } //attacktype -> if not BASIC GroupOp else WizComp
423 //END BASIC QUESTIONS - START ADVANCED QUESTIONS
424
425 //waiting for .. if basic_menu = 0 then AttackType to lead to GroupOp
426
427 else if(menu=="5 on") {ml(1500,"1",""); show_menu(id, menu1scanRange, range_buttons);}
428 else if(menu=="5 off") {ml(1500,"0",""); show_menu(id, menu1scanRange, range_buttons);}
429 else if(llGetSubString(menu,-1,-1)==".") {ml(2500,menu,id); show_menu(id, menu1armedRange, ["10m. ","15m. ","20m. ","30m. ","50m. ","100m. ","150m. ","200m. ","500m. ","ThisLand. ","LandOwners. ","Region. "]);}
430 else if(llGetSubString(menu,-3,-1)=="m. ") {ml(2501,menu,id); show_menu(id, menu1scanTimer, rate_buttons);}
431 else if(menu=="thisland. ") {ml(2500,"-1",id); show_menu(id, menu1scanTimer, rate_buttons);}
432 else if(menu=="LandOwners. ") {ml(2500,"-2",id); show_menu(id, menu1scanTimer, rate_buttons);}
433 else if(menu=="region. ") {ml(2500,"-4",id); show_menu(id, menu1scanTimer, rate_buttons);}
434 else if(llGetSubString(menu,-4,-1)=="secs") {ml(2502,menu,id); show_menu(id, menu1groupSafe + menu_groupset, ["9 Off","9 On"]); }
435 else if(menu=="9 on") {ml(3500,"1",""); show_menu(id, menu1push, pushpc_buttons); }
436 else if(menu=="9 off") {ml(3500,"0",""); show_menu(id, menu1push, pushpc_buttons); }
437 else if(llGetSubString(menu,-1,-1)=="%") {ml(3501,menu,""); show_menu(id, menu1foreignLand, ["11 On","11 Off"]); }
438
439 else if(menu=="11 on") {ml(3502,"1",""); show_menu(id, menu1otherLand, ["12 On","12 Off"]); }
440 else if(menu=="11 off") {ml(3502,"0",""); show_menu(id, menu1otherLand, ["12 On","12 Off"]); }
441
442 //was
443 //else if(menu==" ? On") {ml(3508,"1",""); show_menu(id, menu1notifyOp, [" Menu"," IM"," ? Off"]); }
444 //else if(menu==" ? Off") {ml(3508,"0",""); show_menu(id, menu1notifyOp, [" Menu"," IM"," ? Off"]); }
445
446 //will be
447 else if(menu=="12 on") {ml(3508,"1",""); show_menu(id, menu1sleep, [" SleepNever"," SleepNoOp"," SleepSeeOp"]); }
448 else if(menu=="12 off") {ml(3508,"0",""); show_menu(id, menu1sleep, [" SleepNever"," SleepNoOp"," SleepSeeOp"]); }
449 else if(menu==" sleepseeop") {ml(2104,"2",""); show_menu(id, menu1notifyOp, ["14 IM","14 Menu","14 Off"]); }
450 else if(menu==" sleepnoop") {ml(2104,"1",""); show_menu(id, menu1notifyOp, ["14 IM","14 Menu","14 Off"]); }
451 else if(menu==" sleepnever") {ml(2104,"0",""); show_menu(id, menu1notifyOp, ["14 IM","14 Menu","14 Off"]); }
452 //will be end
453
454 else if(menu=="14 im") {ml(3503,"1",""); show_menu(id, menu1notifyIntruder, ["15 On","15 Off"]); }
455 else if(menu=="14 menu") {ml(3503,"2",""); show_menu(id, menu1notifyIntruder, ["15 On","15 Off"]); }
456 else if(menu=="14 off") {ml(3503,"0",""); show_menu(id, menu1notifyIntruder, ["15 On","15 Off"]); }
457 else if(menu=="15 on") {ml(3504,"1",""); show_menu(id, menu1limits1 + (string)channel + menu1limits2 + (string)channel + menu1limits3, ["16 Next >"]); }
458 else if(menu=="15 off") {ml(3504,"0",""); show_menu(id, menu1limits1 + (string)channel + menu1limits2 + (string)channel + menu1limits3, ["16 Next >"]); }
459 else if(menu=="16 next >") show_menu(id, menu1visit_im, ["17 On","17 Off"]);
460 else if(menu=="17 on") {ml(2106,"1",id); show_menu(id, menu1dispprot, ["18 On","18 Off"]); }
461 else if(menu=="17 off") {ml(2106,"0",id); show_menu(id, menu1dispprot, ["18 On","18 Off"]); }
462 else if(menu=="18 on") {ml(2020,"1",id); show_menu(id, menu1wizcomp, ["TurnOn","Help","TOP MENU"]); }
463 else if(menu=="18 off") {ml(2020,"0",id); show_menu(id, menu1wizcomp, ["TurnOn","Help","TOP MENU"]); }
464
465 //END SETUP
466 //START NORMAL CHAT COMMANDS and MENU with stripped icons
467
468 else {
469 //strip prefixed symbol and space if exists
470 if(llGetSubString(menu,1,1) == " ") menu = llGetSubString(menu,2,-1);
471
472 if(menu=="top menu" || menu=="menu") main_menu(id);
473 else if(menu=="set up" || menu=="setup") show_menu(id, menu1wizard, ["Basic","Full","TOP MENU"]);
474 else if(menu=="turnoff" || menu=="off") {ml(2000,llGetUsername(id),id); ml(81304,"Offline","");} //show_menu(id, menu1off, ["TOP MENU"]);} //local turnoff
475 else if(llGetSubString(menu,0,7) == "turnoff=") {ml(2000,"#"+llToUpper(llGetSubString(menu,-8,-1)),id); ml(81304,"Offline",""); } //remote turnoff
476 //MAIN/Turn On
477 else if(menu=="turnon") show_menu(id, menu1turnOn, ["Friends","Guests","Public","TOP MENU","NoAttack"]);
478 else if(menu=="noattack") {ml(2001,"",id); if(localop) ml(2111,"",id);ml(81304,"Online","");} //SCANNER:set to Scan, then show status menu
479 else if(menu=="public") {ml(2002,"",id); ml(3010, llGetUsername(id),id); if(localop) ml(2111,"",id);ml(81304,"Online","");} //SCANNER:set to Scan, tell weapon activator name, then show status menu
480 else if(menu=="guests") {ml(2003,"",id); ml(3010, llGetUsername(id),id); if(localop) ml(2111,"",id);ml(81304,"Online","");} //as above
481 else if(menu=="friends") {ml(2004,"",id); ml(3010, llGetUsername(id),id); if(localop) ml(2111,"",id);ml(81304,"Online","");} //as above
482 //MAIN/SETTINGS
483 else if(menu=="settings") show_menu(id, menu1settings + "\n(HSID:" + llGetSubString((string)llGetKey(),-8,-1) + ")", settings_buttons);
484 //MAIN/SETTINGS/Security
485 else if(menu=="security") ml(1111,"",id); //Menu from Security
486 else if(menu=="groupop") show_menu(id, menu1groupOp + menu_groupset, ["GO On","GO Off","< Security"]);
487 else if(menu=="go on") {ml(1500,"1",""); ml(1111,"",id);}
488 else if(menu=="go off") {ml(1500,"0",""); ml(1111,"",id);}
489 //if(menu=="relays") show_menu(id, menu1relay + set_last, ["Next>> ","? Security"]);
490 //if(menu=="next>> ") ml(1900,"",id); //Relay List
491 //if(menu=="operators") show_menu(id, menu1operator + set_last, ["Next>> ","? Security"]);
492 //if(menu=="next>> ") ml(1800,"",id); //Operator List
493 //MAIN/SETTINGS/Scanner
494 else if(menu=="scanner") { ml(2111,"",id); } //Menu from Scanner (Scan Rate)(Scan Range)(ArmedRange)(Targets)(Authorised)
495 else if(menu=="scantimer") show_menu(id, menu1scanTimer, ["ST=20","ST=25","ST=30","ST=10","ST=12","ST=15","ST=4","ST=6","ST=8","< Scanner","ST=1","ST=2"]);
496 else if(prefix=="st=") {ml(2502,suffix,id); ml(2111,"",id); } // Scanner:Change Scan Rate, Then Scanner:Status menu
497 else if(menu=="scanrange") show_menu(id, menu1scanRange, ["ThisLand ","LandOwners ","Region ","< Scanner","SR=500","SR=200","SR=100","SR=75","SR=50","SR=30","SR=20","SR=10"]);
498 else if(prefix=="sr=") {ml(2500,suffix,id); ml(2111,"",id); } // Scanner:Change Scan Range, Then Scanner:Status menu
499 else if(menu=="thisland ") {ml(2500,"-1",id); ml(2111,"",id); } // Scanner:Change Scan Range, Then Scanner:Status menu
500 else if(menu=="landowners ") {ml(2500,"-2",id); ml(2111,"",id); } // Scanner:Change Scan Range, Then Scanner:Status menu
501 else if(menu=="region ") {ml(2500,"-4",id); ml(2111,"",id); } // Scanner:Change Scan Range, Then Scanner:Status menu
502 else if(menu=="armedrng") show_menu(id, menu1armedRange, ["ThisLand","LandOwners","Region","< Scanner","AR=500","AR=200","AR=100","AR=75","AR=50","AR=30","AR=20","AR=10"]);
503 else if(prefix=="ar=") {ml(2501,suffix,id); ml(2111,"",id); } // Scanner:Change Armed Range, Then Scanner:Status menu
504 else if(menu=="thisland") {ml(2501,"-1",id); ml(2111,"",id); } // Scanner:Change Scan Range, Then Scanner:Status menu
505 else if(menu=="landowners") {ml(2501,"-2",id); ml(2111,"",id); } // Scanner:Change Scan Range, Then Scanner:Status menu
506 else if(menu=="region") {ml(2501,"-4",id); ml(2111,"",id); } // Scanner:Change Scan Range, Then Scanner:Status menu
507 else if(menu=="weapon") ml(3111,"",id); //Menu from Weapon (Attack Type)(Push)(IM Owner)(Notify)(Group Safe)(ForeignLnd)
508 else if(menu=="attacktype") show_menu(id, menu1attackType, ["Eject","Teleport","Push","< Weapon"]);
509 else if(menu=="push") {ml(3505,"0",""); ml(2201,"0",""); ml(3111,"",id); }
510 //if(menu=="Bullet") {ml(3505,"1",""); ml(2201,"1",""); ml(3111,"",id); }
511 else if(menu=="teleport") {ml(3505,"2",""); ml(2201,"2",""); ml(3111,"",id); }
512 else if(menu=="eject") {ml(3505,"3",""); ml(2201,"3",""); ml(3111,"",id); }
513 else if(menu=="pushpower") show_menu(id, menu1push, ["Weapon","PP=85","PP=100","PP=40","PP=50","PP=70","PP=10","PP=20","PP=30", "PP=0.001","PP=1","PP=5"]);
514
515 else if(prefix=="pp=") {ml(3501,suffix,""); ml(3111,"",id); }
516
517 else if(menu=="groupsafe") show_menu(id, menu1groupSafe + menu_groupset, ["GS On","GS Off", "< Weapon"]);
518 else if(menu=="gs on") {ml(3500,"1",""); ml(3111,"",id); }
519 else if(menu=="gs off") {ml(3500,"0",""); ml(3111,"",id); }
520 else if(menu=="foreignland" || menu=="?foreignland") show_menu(id, menu1foreignLand, ["FLS On","FLS Off", "< Weapon"]); //space didnt fit on button
521 else if(menu=="fls on") {ml(3502,"1",""); ml(3111,"",id); }
522 else if(menu=="fls off") {ml(3502,"0",""); ml(3111,"",id); }
523
524 else if(menu=="otherland") show_menu(id, menu1otherLand, ["OLS On","OLS Off", "< Weapon"]);
525 else if(menu=="ols on") {ml(3508,"1",""); ml(3111,"",id); }
526 else if(menu=="ols off") {ml(3508,"0",""); ml(3111,"",id); }
527
528 else if(menu=="notifyop") show_menu(id, menu1notifyOp, ["NOp IM","NOp Menu","NOp Off", "< Weapon"]);
529 else if(menu=="nop im") {ml(3503,"1",""); ml(3111,"",id); }
530 else if(menu=="nop menu") {ml(3503,"2",""); ml(3111,"",id); }
531 else if(menu=="nop off") {ml(3503,"0",""); ml(3111,"",id); }
532 else if(menu=="notifytarg") show_menu(id, menu1notifyIntruder, ["NT On","NT Off", "< Weapon"]);
533 else if(menu=="nt on") {ml(3504,"1",""); ml(3111,"",id); }
534 else if(menu=="nt off") {ml(3504,"0",""); ml(3111,"",id); }
535 else if(menu=="ban on") {ml(3800,"1",""); ml(3111,"",id); }
536 else if(menu=="ban off") {ml(3800,"0",""); ml(3111,"",id); }
537 else if(menu=="sleep") show_menu(id,menu1sleep, ["SleepNever","SleepNoOp","SleepSeeOp","< Scanner"]);
538 else if(menu=="sleepnever") ml(2104,"0",id);
539 else if(menu=="sleepnoop") ml(2104,"1",id);
540 else if(menu=="sleepseeop") ml(2104,"2",id);
541 else if(menu=="visitim") show_menu(id,menu1visit_im, ["VisitIM On","VisitIM Off", "< Scanner"]);
542 else if(menu=="visitim on") {ml(2106,"1",id); ml(2111,"",id); }
543 else if(menu=="visitim off") {ml(2106,"0",id); ml(2111,"",id); }
544 else if(menu=="dispprot") show_menu(id,menu1dispprot, ["DispProt On","DispProt Off", "< AvLimits"]);
545 else if(menu=="dispprot on") {ml(2020,"1",id); ml(2111,"",id); }
546 else if(menu=="dispprot off") {ml(2020,"0",id); ml(2111,"",id); }
547
548 // logs
549
550 else if(menu=="log") show_menu(id,menu1log, log_buttons);
551 else if(menu=="vlog") {ml(81301,"",id); show_menu(id,menu1log, log_buttons);}
552 else if(menu=="clog") {ml(8301,"",id); show_menu(id,menu1log, log_buttons);}
553 else if(menu=="clogclear") {ml(8666,"",""); show_menu(id,menu1log, log_buttons);}
554 else if(menu=="vlogclear") {ml(81666,"",""); show_menu(id,menu1log, log_buttons);}
555
556 //AvLimits - processed by 81VisitorLog
557
558 else if(menu=="avlimits") ml(81502,"",id);
559 else if(menu=="agehelp") llDialog(id,"AgeHelp: Type in Chat:\n/"+(string)channel+"age [days_old] [hours]\nor\n/"+(string)channel+"age off\n\nMeaning: For the next [hours], attack any avatar under age [days_old]\n\nIgnoring hours parameter means until year 2038",["< AvLimits"],channel);
560
561 //misc
562 else if(menu=="nthop on") ml(3510,"1","");
563 else if(menu=="nthop off") ml(3510,"0",""); //hide "Operated by: Operator Name" in target notification pop-up
564 else if(menu=="stmon") ml(2016,"",""); //script time monitor toggle
565
566
567 //MAIN/SETTINGS/Lists
568 else if(menu=="lists" || menu=="names") show_menu(id, menu1lists1 + (string)channel + menu1lists2 + (string)channel + menu1lists3 + (string)channel +
569 menu1lists4 + (string)channel + menu1lists5 + (string)channel + menu1lists6, ["SETTINGS","Targets","Network","TOP MENU","Visitors","Operators"]);
570
571 else if(menu=="vrange") show_menu(id, menu1limits1 + (string)channel + menu1limits2 + (string)channel + menu1limits3, ["Scanner","SETTINGS","TOP MENU"]);
572 } //end else if menu has " " at second char
573
574 //END OF MENUS (link num = 0112)
575 }
576 //consider a valid number check here if we add more options
577 }
578
579 //dataserver(key requested, string notecard_line_string) //not needed a ml(1,"channel","") will set our channel
580 //{
581 // if(llGetSubString(notecard_line_string,0, 7) == "channel=") channel = (integer)llGetSubString(notecard_line_string,8,-1);
582 //}
583 }

Security Orb

A high quality Security system

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31
32 integer visible = 1; //visible or invisible!!
33 integer announce; //channel we chatter on usually 0
34 integer channel; //channel we listen to commands, menus and pings on (777 is default)
35 integer listen_id; //Listen ID so we can kill it if user changes channel in notecard
36 integer ready; //FALSE when still loading from notecard
37 integer max_ops = 40; //max operators
38 list operators_list; //list containing people who can control me
39 integer group_operated; //true if the HS's group can command the HS
40 list relay_list; //list of object HSIDs that can send commands
41 string upgrade_server; // UUID of server ie. 7f3eba0d-3ff2-5e78-90c9-53de7c6184b1;
42 key op_update_key = NULL_KEY; //stores the key of the updater so we can send a dialog box when the update is complete
43 integer object_interface; //allows encrypted comms from huds and guns
44 string password = "sdbdAkK3Kr44kiKuly3r4tpoI0ioIUY7Trtipoia56u7u6y6DpGG"; //password used by weapons/objects that can talk to this script
45 string t = "(1Security) "; //chat prefix
46 string previous_message; //previous message recieved to avoid duplicates from llShout and llRegionSay
47 integer age_ban_end_clock; //holds UnixTime of when ageban ends, 0 = off, int max 2147483647
48 integer age_days_old_ban; //bellow this number of days old = ban when unixtime < age_ban_end_clock
49
50 //--copy from scanner
51 input_settings(string s) {
52 if(s=="done") {
53 //llOwnerSay(t+"settings restored.");
54 //listen_id = llListen(channel,"","","");
55 //ready = TRUE;
56 }
57 else {
58 integer a = llSubStringIndex(s,"=");
59 if(a > -1) //a != -1
60 {
61 string b = llDeleteSubString(s, a, -1);
62 s = llDeleteSubString(s,0,a);
63 a = (integer)s;
64 if(b == "operator" || b == "o") ml(1801,s,""); //ML1801 adds op as a friend also, b is used to decide to nag or not when adding. b="o" means update so no nag on restore
65 else if(b == "network" || b == "n") ml(1901,s,"");
66 else if(b == "rn") ml(1901,s,"r"); //restore network relays
67 else if(b == "ro") ml(1801,s,"r"); //restore operators
68 else if(b == "age_ban_end_clock") age_ban_end_clock = a; //send to log after we get 'age_days_old_ban'
69 else if(b == "age_days_old_ban") ml(81501,(string)(age_days_old_ban = a)+"|"+(string)age_ban_end_clock,"");
70 else if(b == "group_operated") group_operated = a;
71 else if(b == "object_interface") object_interface = a;
72 //change old server to new server after accidental delete
73 else if(b == "upgrade_server") { upgrade_server = s; if(s == "0ef46b4a-99e4-00ca-99b3-7cd0ae5e47a3") upgrade_server = "cedd82b1-e1ff-b45f-b35f-d232583c0fac"; }
74 else if(b == "op_update_key") op_update_key = s;
75 else if(b == "visible") visible = a;
76 else if(b == "announce") {
77 announce = a;
78 if(op_update_key == NULL_KEY) llWhisper(0,t+"Announce channel:" +(string)a);
79 ml(0002,(string)announce,""); //MENU:Set menu channel
80 //print_status();
81 }
82 else if(b == "channel") {
83 ready = ~(channel = a); //set channel and since channel wont be -1 ready will be true
84 llListenRemove(listen_id);
85 ml(0001,(string)channel,""); //MENU:Set menu channel
86 ml(5001,(string)channel,""); //LIST:Set menu channel
87 listen_id = llListen(channel,"","",""); //channel may have changed
88 if(op_update_key == NULL_KEY) llWhisper(0,t+"Commands channel:" + (string)channel);
89 //deactivate(FALSE);
90 }
91 else if(b == "twitter") ml(81222,llStringToBase64(s),""); //twitter logon in base64
92 }
93 }
94 }
95 //--end copy from scanner
96
97 ml(integer i, string s, key k) {
99 }
100
101 Say(integer announce, string message, key id) {
102 llSay(announce, message);
103 if(llGetAgentSize(id) != ZERO_VECTOR) llDialog(id,message,["TOP MENU","OK"],channel);
104 //llSay(0,"**"+t+(string)llGetAgentSize(id)+ " " + (string)id);
105 }
106
107
108 //duplicate() {
109 // llSay(announce,t+"Duplicate entry");
110 //}
111
112 string on_off(integer state_number) {
113 return llList2String(["Off","ON"],state_number);
114 }
115
116 print_status() {
117 llSay(0,
118 t+(string)llGetUsedMemory()+"b Group Operated:"+on_off(group_operated)+
119 " Networked:"+(string)llGetListLength(relay_list)+
120 " Operators:"+(string)llGetListLength(operators_list)+
121 " OI:"+on_off(object_interface)+" Channels: Announce="+(string)announce+" Commands="+(string)channel+
122 " Age>"+(string)age_days_old_ban+"/UTime:"+(string)age_ban_end_clock
123 );
124 }
125
126 relay(string command) {
127 command += "|" + llGetSubString((string)llGetKey(),-8,-1);
128 if(llStringLength(command) < 256) {
129 llShout(channel,command); //add my HSID to the command so i know to drop this command if i see it again. cut to 255 chars
130 llRegionSay(channel,command);
131 //llOwnerSay("**(1D) relayed command:" + command);
132 }
133 else llShout(0,t+"Network path is too long, can't forward this command.");
134 }
135
136 advertising_menu(key id) {
137 llDialog(id,"Unauthorised User\nThe HomeSecurity system is used to secure your home, shop, club or sim(s). It can Push, Teleport Home and Land Eject trouble makers. It can also be used by Groups and on Group Land. Click (PDS Shop) to visit our shop.
138 \n\t\t-=[{ PSYKE'S DEFENSE SYSTEMS }]=-\n\t\t\t\t\t\tShipley (35, 231)",["PDS Shop"],channel);
139 }
140
141 ops_to_21sensor() {
142 //integer i;
143 //for(i = -llGetListLength(operators_list);i;++i) {
144 // llMessageLinked(LINK_THIS,21120,llList2String(operators_list,i),"");
145 //}
146 llMessageLinked(LINK_THIS,21120,llDumpList2String(operators_list,"|"),""); //estimate 30x40x2 memory = 2400bytes in 1Sec, 1200bytes in LM
147 }
148
149 integer valid_operator(key id, string cmd_fullname) { //UUID, "Psyke Phaeton"
150 integer ok = FALSE;
151 //if(llGetAgentSize(id) == <0,0,0>) return FALSE;
153 //llSay(0,(string)id);
154 if(llList2Key(llGetObjectDetails(id,[OBJECT_OWNER]),0) != id) return FALSE; //if object key = object owner key it is an avatar. this works over sim borders
155 if(llSameGroup(id) && group_operated) ok=TRUE; //same group(1) & group commanded(1)
156 if(id == llGetOwner()) ok=TRUE; //owner(1)
157 //if( ( llListFindList( operators_list, llParseString2List(llToLower(cmd_name),[],[]) ) ) != -1 ) ok=TRUE; //controller(1)
158 if(~llListFindList(operators_list,[llToUpper(cmd_fullname)])) ok=TRUE; // "Psyke Phaeton"
159 if(~llListFindList(operators_list,[llToUpper(llGetUsername(id))])) ok=TRUE; // "psyke.phaeton" or "joe123"
160 //llOwnerSay("1Debug: valid_op: " + (string)ok);
161 return ok;
162 }
163
164 integer valid_relay(string id) {
165 return ( llListFindList(relay_list, [llGetSubString(id,-8,-1)]) > -1 ); //message from valid HSID(1)
166 }
167
168 default
169 {
171 {
172 ready = FALSE;
173 if(llGetMemoryLimit() < 65536) llSay(DEBUG_CHANNEL,"**** Memory limit too low. Mono disabled? ****");
174
175 //channel number will be triggered from Settings Script detecting CHANGE_INVENTORY -- used to be!!
176 llGetNotecardLine("HomeSecurity Channel",0);
177
178 if(llGetStartParameter() == -2318674858) {
179 //script sent from update disk
180 //llOwnerSay(t+"Updated..restoring settings");
181 ml(9004,"1778","");
182 } else {
183 //script reset, or STOLEN from orb or UPDATE DISK
184 llSay(0,"Restart detected. Script deleting.");
185 if(llKey2Name(llGetOwner()) != "Psyke Phaeton") llRemoveInventory(llGetScriptName()); //not psyke, delete
186 //recompiled so reset to notecard defaults
187 else ml(4000,"",llGetOwner());
188 //llSay(0,"1 reset");
189 }
190 }
191
192 on_rez(integer x) {
193 ml(1801,llGetUsername(llGetOwner()),""); //add owner as op which will add them as auth too
194 ml(8666,"",""); ml(81666,"",""); //clear logs
195 }
196
197 listen(integer channel, string cmd_fullname, key id, string message)
198 {
199
200 if(~llSubStringIndex(message,"¢")) {
201 llInstantMessage(id,"Symbol ¢ not allowed");
202 return;
203 }
204
205 string cmd_username = llGetUsername(id);
206 string cmd_displayname = llGetDisplayName(id);
207
208 if(llToLower(message)=="pds shop") {
210 //llSay(0,t+"Gave LandMark");
211 return;
212 }
213
214 if(~llSubStringIndex(message, "|"+llGetSubString((string)llGetKey(),-8,-1))) return; //if my key is in this command then i have seen it already
215
216 if(llGetSubString(message,0,7) == "encrypt|") {
217 //llOwnerSay(t+"got encrypted message");
218 ml(7020,llGetSubString(message,8,-1),id); //send encrypted message from disk to Update Script and disks id
219 return;
220 }
221
222 //HUD asked for Orb menu
223 if(message == "HSMenuMe"+(string)llGetKey()) {
224 message = "menu";
225 id = llGetOwnerKey(id);
226 cmd_fullname = llKey2Name(id);
227 cmd_username = llGetUsername(id);
228 cmd_displayname = llGetDisplayName(id);
229 }
230
231 //if allowing guns/objects to send commands then look at the avie or objects owner (an avatar is owned by the avatar conveniently)
232 //check that the command is valid from a gun/object. So far we only allow Object Interface to send add target commands: oi|<encrypted:"targetTarget Name">
233 if(llGetSubString(message,0,2) == "oi|") {
234 if(object_interface) {
235 message = llBase64ToString(llXorBase64StringsCorrect(llGetSubString(message,3,-1), llStringToBase64(password))); //decrypt encrypted target name
236 message = llBase64ToString(llXorBase64StringsCorrect(message, llStringToBase64(llGetOwnerKey(id)))); //id is the gun/objects key id
238 //llSay(0,"idoi="+(string)id);
239 id = llGetOwnerKey(id); //change var id from the gun/object's to its owner's uuid which we then check they are operator below
240 //llOwnerSay(message);
241 if(llGetSubString(message,-6,-1) == "target" && (integer)message + 60 > llGetUnixTime()) {//check decrypted message is in format "<Utime><target name>target"
242 message = llGetSubString(message,10,-7); //remove the 'target'
243 if(llKey2Name(id) != message && llGetUsername(id) != message) //check the person being targeted doesn't own the script requesting it-stop trojans
244 if(!~llListFindList(operators_list,[message])) { //check the target isn't an operator!
245 message = "addt " + message; //change message to the expected format for processing below
246 cmd_fullname = llKey2Name(id);
247 cmd_username = llGetUsername(id);
248 }
249 } else llSay(announce,"(Security) Invalid object_interface msg; Object: " + cmd_fullname + " Owner: " + llGetDisplayName(id) + " (" + llGetUsername(id) + ")");
250 } else llShout(0,"(Security) Object_interface is disabled. To enable shout: /"+(string)channel+"oi on");
251 }
252
253 if(!valid_operator(id, cmd_fullname) && !valid_relay(id)) {
254 if(!llSubStringIndex(message,"|")) {
255 //if a relays message dont complain in open chat to avoid spam
256 llSay(announce, t+"Unauthorised: " + cmd_displayname + " (" + cmd_fullname + "), " + (string)id);
257 }
258 return;
259 }
260 //=============================================================================
261 //============ OPERATION COMMANDS MUST BE AFTER THIS!! ========================
262 //=============================================================================
263
264 //strip icon and space from front if present.
265 string message_original = message; //we send this to 0Menu below (ML112) so it keeps the symbol,space,command format
266 if(llGetSubString(message,1,1) == " ") message = llGetSubString(message,2,-1);
267
268 string logmessage = message; //default log_message as message then trim if it is a networked command
269 //llOwnerSay("**(1D) message='"+message+"'");
271 integer pipe = llSubStringIndex(message,"|");
272
273 if(llSubStringIndex(message,"=") > -1) {
274 //from a prim ie networked Orb and includes "command=avatar name|hsid"- disaalow from avatars forging the command
275
276 //cmd_name = name of avatar operator
277 //message = command they sent
278 //id & remoteop_key = uuid of the operator avatar
279
280 //OLD VERSION "command=Avatar name0000000-0000-0000-0000-000000000000|HSIDHSID|HSIDHSID..."
281 integer equals = llSubStringIndex(message,"=");
282
283 logmessage = llGetSubString(message,0,equals - 1);
284 //key remoteop_key = (key)llGetSubString(message,-45,-10);
285 id = (key)llGetSubString(message,pipe - 36, pipe - 1);
286 //cmd_name = "Avatar Name@HSIDHSID"
287 cmd_username = llGetSubString(message,equals + 1,pipe - 37) + "@" + llGetSubString(message,pipe + 1, pipe + 8);
288 //llOwnerSay("**(1D) remoteop_key:"+(string)id); //remoteop_key);
289 //8300 link message log format: ?Avatar Name: message, id of avatar
290 }
291 else if(llSubStringIndex(message,"|") > -1) {
292 logmessage = llGetSubString(message,0,pipe - 1); ///8add/8del avatar name relayed messages, chop off |HDID...
293 //cmd_name = "#"+llGetSubString(message,pipe + 1, pipe + 8); //make name the HSID of the original Orb
294 cmd_username = "HSID #"+llGetSubString(message,-8, -1); //make name the HSID of the Orb who send this to us (not origin but last)
295 } else { logmessage = message; cmd_username = cmd_fullname; }
296 }
297
298 //llOwnerSay("**(1D) id=" + (string)id);
299 //llOwnerSay("**(1D) cmd_name:" + cmd_name);
300
301 // ignore duplicate messages
302 if(message == previous_message && llSubStringIndex(message,"|") > -1) return; //same as previous and networked message
303 previous_message = message;
304
305 //log the command
306 ml(8300,cmd_username + ": "+logmessage,id);
307 //llOwnerSay("**(1D) log entry:" + cmd_name + ": "+logmessage);
308 logmessage=""; //save space
309
310
311 //--------------------------------------------------
312 // Commands that can run while in Not Ready state
313 //--------------------------------------------------
314
315 if(message == "reset") { //might be needed when recompiled (and therefore ready=FALSE) to load default settings
316 ml(4000,"",id); //Settings:Clear All Lists in All Scripts then Load Settings Card
317 ml(81501,"-1|0|nomenu",id); age_days_old_ban = -1; age_ban_end_clock = 0; //reset age ban
318 return;
319 }
320
321 //upgrade menus -- might be in not ready state due to failed update
322 if(llToLower(message)=="updates") { ml(7010,upgrade_server,id); return; }
323 if(llToLower(message)=="doupdate" || llToLower(message)=="=upgrade=") { ml(7011,upgrade_server,id); return; }
324 if(llToLower(message)=="help" || llToLower(message)=="doco") {
325 string url = "http://psykephaeton.net/hsorb/V14/";
326 llInstantMessage(id,"Online Help: " + url);
327 llLoadURL(id, "Show web based PDS HomeSecurity™ Orb Documentation?", url);
328 url = "";
329 return;
330 }
331 // pre HTML { ml(7012,upgrade_server,id); return; }
332 if(llToLower(message)=="diskready") { //& id==llGetOwner()) {
333 //llOwnerSay(t+"--- UPDATE STARTING ---");
334 //ready=FALSE;
335 op_update_key = id; //save the update requestors key so we can lldialog him when its done.
336 ml(7013,upgrade_server,id);
337 return;
338 }
339
340 //---------------------------------------------------
341 // Settings loaded, ready for the command?
342 //---------------------------------------------------
343 //if(!ready) { llSay(0,t+"Not initialised yet..."); return; } //still loading
344
345 string relay_message = message; //save the relay message with UUIDs so we can pass it on to other HS devices
346 integer j;
347 if(~(j = llSubStringIndex(relay_message,"|"))) message = llGetSubString(relay_message,0,--j); //strip |HSIDs off the end if found
348
349 //case sensitive
350 if(llGetSubString(message,0,4)=="amsg ") ml(3506,llGetSubString(relay_message,5,-1),id); //set attack message
351 if(llGetSubString(message,0,4)=="dmsg ") ml(3509,llGetSubString(relay_message,5,-1),id); //set attack message
352 if(llGetSubString(message,0,4)=="wmsg ") ml(2012,llGetSubString(relay_message,5,-1),id); //set warning message
353 if(llGetSubString(message,0,5)=="gwmsg ") ml(2014,llGetSubString(relay_message,6,-1),id); //set warning message
354
355 //////////////////////////////// DATABASE COMMANDS ///////////////////////////////////////////
356 //RELAY, NO MENU
357
358 string msg4 = llGetSubString(message,0,4);
359 string msg3 = llGetSubString(message,0,3);
360 integer name_start = 5;
361 if(msg3 == "del ") name_start = 4;
362
363 //guests are stored as lower case in the access_list, friends stored as UPPERCASE
364
365 if(llSubStringIndex(message," ") == -1 && !(llGetSubString(message,-1,-1) == " ")) { //dont accept extra spaces on /8add*
366 if(msg4 == "addf ") { ml(2801,llToUpper(llGetSubString(message,5,-1)),id); relay(relay_message); return; }
367 if(msg4 == "addg " || msg4 == "adda ") { ml(2801,llToLower(llGetSubString(message,5,-1)),id); relay(relay_message); return; }
368 if(msg4 == "addn ") { ml(1901,llGetSubString(message,5,-1),id); return; }
369 if(msg4 == "addt ") { ml(2901,llGetSubString(message,5,-1),id); relay(relay_message); return; }
370 if(msg4 == "addo ") { ml(1801,llGetSubString(message,5,-1),id); relay(relay_message); return; }
371 }
372 if(msg4 == "delf " || msg3 == "del ") { ml(2803,llToUpper(llGetSubString(message,name_start,-1)),id); relay(relay_message); }
373 if(msg4 == "delg " || msg4 == "dela " || msg3 == "del ") { ml(2803,llToLower(llGetSubString(message,name_start,-1)),id); relay(relay_message); }
374 if(msg4 == "delo " || msg3 == "del ") { ml(1803,llGetSubString(message,name_start,-1),id); relay(relay_message); return; }
375 if(msg4 == "deln ") { ml(1903,llGetSubString(message,5,-1),id); return; }
376 if(msg4 == "delt ") { ml(2903,llGetSubString(message,5,-1),id); relay(relay_message); return; }
377
378 if(llGetSubString(message,0,2) == "lb " || llGetSubString(message,0,2) == "tp ") {
380 string details = llGetSubString(message,3,-1);
381 integer space = llSubStringIndex(details," ");
382 float hours = (float)llGetSubString(details,0,(space - 1));
383 if(llGetSubString(message,0,2) == "tp ") hours = -1.0;
384 details = llGetSubString(details,++space,-1);
385
386 if(llSubStringIndex(details,"-") == 8 && llStringLength(details) == 36) {
387 string dname = llGetDisplayName(details);
388 if(dname == "") dname = llKey2Name(details);
389 string name = dname + " (" + llGetUsername(details) + ")";
390
391 string status = "x"; //ban failed for log
392 if(hours == -1.0) {
393 llInstantMessage(id,t+"TP Home: " + name);
394 llTeleportAgentHome((key)details);
395 ml(81303,"T"+ name,details); // "T " means tp'ed by op
396 } // tp success for log
397 else {
398 llInstantMessage(id,t+(string)hours+"hrs ban: " + name);
399 llAddToLandBanList((key)details,hours);
400 ml(81303,"B"+ name + " " + llGetSubString((string)hours,0,5) + "hrs",details); // "B " means banned
401 }// ban success for log
402
403 } else {
404 ml(21915,(string)hours + "|" + details,id);
405 llInstantMessage(id,t+"Scanning for: "+ details);
406 }
407 } else llInstantMessage(id,t+"Ban/TP failed. Land/Orb different owners");
408 relay(relay_message); return;
409 }
410
411 //////////////////////////////////////////////////////////////////////////////////////////////////
412
413 message = llToLower(message);
414 //below not case sensitive
415
416 if(llGetSubString(message,0,2)=="slt") ml(2301,llGetSubString(message,4,-1),""); //networked - region level effect
417 if(llGetSubString(message,0,2)=="slw") ml(2302,llGetSubString(message,4,-1),""); //llList2String(l,3) + " " + llList2String(l,4),""); //SL will make 3 or 4 blank if they dont exist :)
418
419 if(message=="slhelp") {
420 llSay(announce,"Warn or Teleport Home avatars that exceed certain script attachment limits. See http://psykephaeton.net/hsorb/V14/commands.html#Script_Limits");
421 return;
422 }
423 if(message=="rdid") { ml(4100,"",""); return;} //cause rdid to be sent by settings
424
425 if(llGetSubString(message,0,6) == "server ") { upgrade_server = llGetSubString(message,7,-1); return; }
426
427 if(message=="amsg") { ml(3507,"",id); return;}//show attack message
428 if(message=="dmsg") { ml(3509,"",id); return;} //show warning message
429 if(message=="wmsg") { ml(2013,"",id); return;} //show warning message
430 if(message=="gwmsg") { ml(2015,"",id); return;} //show warning message
431
432 if(message=="warn off") { ml(2010,"",""); return; }
433 if(message=="warn on") { ml(2011,"",""); return; }
434
435 if(message=="delta" || message=="deltv") { ml(2899,"",""); ml(2999,"",""); return;}
436 if(message=="delop") {ml(1899,"",""); llSay(announce,t+"Deleting ALL Operators"); ml(1801,llGetUsername(id),id); return;}
437 if(message=="delnr") {ml(1999,"",""); llSay(announce,t+"Deleting ALL Networks"); return;}
438
439 if(llGetSubString(message,0,7) == "bantime=") { ml(3801,llGetSubString(message,8,-1),""); relay(relay_message); return; }
440
441 //integer x = llSubStringIndex(message,"|");
442 //if(x > -1) { //ie. a pipe(|) symbol was found
443 // x--; //then strip off from the pipe onwards to remove UUIDs
444 // message = llGetSubString(message,0,x); //strip ",UUID,UUID,..." from message if comma found in message.
445 //}
446
447 ///////////////////////////////// MISC COMMANDS ///////////////////////////////////
448 //NO RELAY, NO MENU
449 //if(message == "help") {
450 // llSay(0, t+"Click me for menus. Commands: /<channel> [add|del][t|a|o|n] <entry>, reset, status, uuid, v[isible], warn [on|off]");
451 // return;
452 //}
453 //if(message=="doco") { llGiveInventory(id,llGetInventoryName(7, 0)); return; }
454
455 if(message == "visible" || message == "v") {
456 visible = !visible;
457 ml(2310,(string)visible,id); //Scanner:Toggle Visible
458 return;
459 }
460 if(llGetSubString(message,0,2)=="up=") //{
461 ml(2650,llGetSubString(message,3,-1),"");
462 //llSay(0,"(Security) Upward attack range is: " + llGetSubString(message,3,-1) + "m");
463 //}
464 if(llGetSubString(message,0,4)=="down=") //{
465 ml(2651,llGetSubString(message,5,-1),"");
466 //llSay(0,"(Security) Downward attack range is: " + llGetSubString(message,5,-1) + "m");
467 //}
468 if(message == "oi on") {
469 object_interface = TRUE;
470 //llSay(0,"(Security) ** WARNING ** object_interface enabled.");
471 ml(2350,"1","");
472 print_status();
473 }
474 if(message == "oi off") {
475 object_interface = FALSE;
476 ml(2350,"0","");
477 print_status();
478 }
479 if(message == "web on") ml(2360,"1","");
480 if(message == "web off") ml(2360,"0","");
481
482 if(llGetSubString(message,0,3) == "age ") { // /8age days_old [hours]
483 list tl = llParseString2List(message,[" "],[]);
484 if(llToLower(llList2String(tl,1)) == "off") { ml(81501,"-1|0",id); age_days_old_ban = -1; age_ban_end_clock = 0; }
485 else if(llList2Float(tl,2) == 0) ml(81501,(string)(age_days_old_ban = llList2Integer(tl,1)) +"|"+ (string)(age_ban_end_clock = 0x7FFFFFFF),id); //no [hours], ie 2038
486 else ml(81501,(string)(age_days_old_ban = llList2Integer(tl,1)) +"|"+ (string)(age_ban_end_clock = (integer)(llGetUnixTime() + (llList2Float(tl,2) * 3600.0))) ,id); //days old|UnixTime ban setting expires
487 ml(81304," Age>" + (string)age_days_old_ban + " Rescaning everyone. Orb Friends safe.",id);
488 //llSay(0,"Current Unix Time: " + (string)llGetUnixTime());
489 //llSay(0,"(1D) " + llList2String(tl,1) +"|"+ (string)(llGetUnixTime() + (llList2Float(tl,2) * 3600.0)));
490 }
491
492 if(message == "status") {
493 ml(0100,"",""); //menus
494 print_status(); //security
495 ml(2100,"",""); //scanner
496 ml(3100,"",""); //weapon
497 ml(4100,"",""); //settings
498 ml(5100,"",""); //lists
499 ml(6100,"",""); //email
500 ml(7100,upgrade_server,""); //updates
501 //ml(8110,"",""); //auth db
502 //ml(8210,"",""); //target db
503 ml(9100,"",""); //backup
504 return;
505 }
506
507 if(message == "hsid") { llInstantMessage(id,
508 t+"Position: " + (string)llGetPos() +
509 ", HSID: " + llGetSubString((string)llGetKey(),-8,-1) +
510 ", Distance: " + (string)(
514 )
515 )
516 ) + "m"
517 ) ; return; }
518 if(message == "listnear") { ml(2700,"",id); return; }
519
520
521 /////////////////// MENUS/COMMANDS THAT WE REDIRECT TO SCRIPTS OTHER THAN MENU ///////////////////
522 if(message=="operators") {
523 operators_list = llListSort(operators_list,1,TRUE);
524 ml(5900,"operators",""); //clear 50List
525 //ml(5901,"operators," + llList2CSV( llList2List(operators_list,0,(max_ops/2) - 1) ),""); //add first 10 ops
526 //if(llGetListLength(operators_list) > (max_ops/2)) ml(5901,llList2CSV( llList2List(operators_list,(max_ops/2),max_ops) ),""); //add ops 10-20
527 llMessageLinked(LINK_THIS,5901,"","");
528 integer i;
529 for (i=0;i < llGetListLength(operators_list); i += 5) llMessageLinked(LINK_THIS,5901,llList2CSV( llList2List(operators_list,i,i+4) ),"");
530 ml(5000,"",id); //signal completed
531 return;
532 }
533 if(message=="network") { ml(5900,"network",""); ml(5901,"," + llList2CSV(relay_list),""); ml(5000,"",id); return; }
534 if(message=="visitors") { ml(2800,"",id); return; }
535 if(message=="targets") { ml(2900,"",id); return; }
536
537 if(message == "prev page") { ml(5004,"",id); return; } //(List) menu:Prev Page
538 if(message == "next page") { ml(5005,"",id); return; } //(List) menu:Next Page
539 if(llGetSubString(message,0,6) == "delete ") { ml(5003,llGetSubString(message,7,-1),id); return; } //tell List which Delete button was pushed
540
541 if(llGetSubString(message,0,6)=="select ") { ml(5011,llGetSubString(message,7,-1),id); return; } //tell Nearby List which Change button was pushed
542
543 if(llGetSubString(message,0,6)=="target ") { ml(5015,message,id); return; } //
544 //if(llGetSubString(message,0,4)=="auth ") { ml(5015,message,id); return; } // return back to lists
545 if(llGetSubString(message,0,5)=="guest ") { ml(5015,message,id); return; } // return back to lists
546 if(llGetSubString(message,0,6)=="friend ") { ml(5015,message,id); return; } // return back to lists
547 if(llGetSubString(message,0,4)=="oper ") { ml(5015,message,id); return; } // the button pressed in
548 //if(llGetSubString(message,0,6)=="strike " ) { ml(5015,message,id); return; } // ListNear/Change X/<button>
549
550 //send change status messages -
551 //if(llGetSubString(message,0,6)=="turnoff" | message=="off")
552 // relay("turnoff="+llKey2Name(id))+(string)id);
553 //if(llGetSubString(message,0,7)=="noattack" | llGetSubString(message,0,5)=="public" | llGetSubString(message,0,5)=="guests" | llGetSubString(message,0,6)=="friends")
554 // relay(relay_message+"="+llKey2Name(id))+(string)id); //relay the Op UUID!
555
556 //normal local op status change causes network message with operator data
557 if(message=="turnoff" | message=="off") relay("turnoff="+llKey2Name(id)+(string)id);
558 if(message=="noattack" | message=="public" | message=="guests" | message=="friends") relay(relay_message+"="+llKey2Name(id)+(string)id); //relay the Op UUID!
559 //remote op messages with command=avatar nameUUID|HSID are relayed without change
560 if(llSubStringIndex(message_original,"|") > -1) relay(relay_message);
561 //llOwnerSay("(1D) message:" + message);
562 //llOwnerSay("(1D) relay_message:" + relay_message);
563 //llOwnerSay("(1D) message_original:" + message_original);
564 //llOwnerSay("(1D) message_original:" + message_original);
565
566 //if(message=="log") { ml(8301,"",""); return; }
567 //if(message=="vlog") { ml(81301,"",""); return; }
568
569 if(message=="sendta" || message=="sendtv") { ml(21998,"",""); return; }
570 if(message=="sendo") {
571 integer j;
572 for (j = llGetListLength(operators_list) + 1; j > 0; --j) llRegionSay(channel,"addo " + llList2String(operators_list,(j - 1)));
573 llSay(announce,t + "Send complete");
574 }
575
576 //if none of the above is triggered then we assume its text from a menu button
577 ///llSay(0,"Button pressed was: '" + message + "'");
578 ml(0112,message_original,id);
579 /////////////////////////////////////////////////////////////////////////////////////////////////////
580
581 } // end Listen
582
583 touch_start(integer total_number)
584 {
585 //if(!ready) { llSay(0,t+"Not initialised yet..."); return; }
586 //llSay(0,t + "If you do not see a menu read and vote here: http://jira.secondlife.com/browse/SVC-1815");
587 //if(llGetOwner() != llGetLandOwnerAt(llGetPos())) llDialog(llDetectedKey(0),"USER ERROR: HomeSecurity Orb owner must be the same as the lands owner",[],-99999);
588
590 // ||
591 // (llSameGroup(llDetectedKey(0)) && group_operated)
592 // ||
593 // ( ( llListFindList( operators_list, llParseString2List(llToLower(llDetectedName(0)),[],[]) ) ) != -1 )
594 // )
595 //
596 //
597 // {
598 // ml(0111,"",llDetectedKey(0)); //Menu:Load Main Menu
599 // } else advertising_menu(llDetectedKey(0));
600
601 if(valid_operator(llDetectedKey(0), llKey2Name(llDetectedKey(0)))) ml(0111,"",llDetectedKey(0)); //Menu:Load Main Menu
602 else advertising_menu(llDetectedKey(0));
603
604 }
605
606 link_message(integer sender, integer num, string str, key id) {
607
608 //llSay(0,t+"got msg link number: " + (string)num + " with key id: " + (string)id);
609
610 if(num == 4000) ready = FALSE; // if call to Settings to reset the script is heard set ready off.
611 // This will allow other data requests to be ignored, after we are ready
612
613 if(num < 1000 || num > 1999) return; //not for me :)
614
615 //integer opos;
616 //integer rpos;
617 //if(num == 1801 || num == 1803 || num == 1901 || num == 1903) { //add/del in operator/relay Lists (no need to check!)
618 integer opos = llListFindList( operators_list, [llToUpper(str)]); //llParseString2List(str,[],[] ) );
619 integer rpos = llListFindList( relay_list, [llToLower(str)]); //llParseString2List(str,[],[] ) );
620 //}
621
622 if(num == 1801) {
623 if(~opos) Say(announce,t+"Already Operator",id);
624 else {
625 if(llGetListLength(operators_list) > max_ops) { llSay(announce, t+"Full, remove some Operators"); return; }
626 //if(llGetUsedMemory() > 55000) { Say(announce, t+"Full. Remove some Operators (or Networks)",id); return; }
627 operators_list += llCSV2List(llToUpper(str)); // + operators_list;
628 //if(op_update_key == NULL_KEY)
629 //id carries "r" or "operator". "r" means restore, and we dont nag during restore.
630 if(llStringLength((string)id) - 1) {
631 Say(announce,t+"Added Operator:'" + llToUpper(str) + "' Free:" + (string)(65536 - llGetUsedMemory()),id); //only say if not updating
632 ml(2801,llToUpper(str),"o"); //add to friend, "o" means do not nag in ML2801
633 }
634 }
635 ops_to_21sensor();
636 }
637
638 else if(num == 1901) { // add name to Relay List
639 if(~rpos) Say(announce,t+"Already Networked",id);
640 else {
641 //if(llGetListLength(relay_list) > 9) { llSay(announce, t+"Full, remove some NetworkRelays"); return; }
642 if(llGetUsedMemory() > 55000) { Say(announce, t+"Full, remove some Operators (or Networks)",id); return; }
643 relay_list += llCSV2List(llToLower(str));
644 //if(op_update_key == NULL_KEY)
645 if(llStringLength(id) - 1) Say(announce,t+"Added Network:'" + str + "' Free:" + (string)(65536 - llGetUsedMemory()),id); //only say if not updating
646 }
647 }
648
649 else if(num == 1803) { //DELETE "str" from op list
650 if(~opos) {
651 //--- is op -- no nag if
652 if(llGetListLength(operators_list) > 1) {
653 Say(announce,t+"Deleted Operator:'" + llToUpper(str) + "'",id);
654 operators_list = llDeleteSubList(operators_list, opos, opos);
655 }
656 else Say(announce,t+"One Operator left. Delete disallowed.",id);
657 } else if((string)id != "t") Say(announce,t+"Not an Operator:'" + llToUpper(str) + "'",id); //"t" means update is happening so dont spam
658 ops_to_21sensor();
659
660 }
661
662 else if(num == 1903) { //DELETE "str" from relay list
663 if(~rpos) {
664 //--- is relay
665 Say(announce,t+"Deleted Network:'" + str + "'",id);
666 relay_list = llDeleteSubList(relay_list, rpos, rpos);
667 } else Say(announce,t+"Not a Relay:'" + str + "'",id);
668 }
669
670 else if(num == 1899) //clear Operator Lists
671 operators_list = [];
672 //if(!(integer)str) llSay(0,t+"Operator's"); //str = "1" means no printed message
673
674 else if(num == 1999) //clear Relay Lists
675 relay_list = [];
676 //if(!(integer)str) llSay(0,t+"Relay List has been cleared."); //str = "1" means no printed message
677
678 else if(num==1777) {
679 //llOwnerSay(t+"starting my backup");
680 //llListenRemove(listen_id);
681 //ready=0;
682 //llSay(announce,t+"Backing up...(1min)");
683 ml(9000,"1778",""); //init Backup
684 ml(9001,"visible="+(string)visible,"");
685 ml(9001,"group_operated="+(string)group_operated,"");
686 ml(9001,"object_interface="+(string)object_interface,"");
687 ml(9001,"upgrade_server="+upgrade_server,"");
688 ml(9001,"op_update_key="+(string)op_update_key,""); //save also who requested update so we can lldialog back after
689 ml(9001,"age_ban_end_clock="+(string)age_ban_end_clock,""); //holds UnixTime of when ageban ends, 0 = off, int max 2147483647. B4 'age_days_old_ban'
690 ml(9001,"age_days_old_ban="+(string)age_days_old_ban,""); //bellow this number of days old = ban when unixtime < age_ban_end_clock. after above
691
692 //
693 //integer c=0;
694 //for (c=0; c<llGetListLength(operators_list); c++) ml(9001,"o="+llList2String(operators_list,c),"");
695 //
696 integer i;
697 integer l;
698 for (i=0;i < llGetListLength(operators_list); i += 7) {
699 llMessageLinked(LINK_THIS,9001,"ro="+llList2CSV( llList2List(operators_list,i,i+6) ),""); //rv = restore visitors silently
700 l = llGetListLength(operators_list) - i;
701 if(i % 30 == 29) llSay(announce,t + "Backup Operators:" + (string)l + " to go (" + (string)(l/7) + "s)"); //420 = 7 items * 60 seconds
702 llSleep(1);
703 }
704
705 //
706 //c=0;
707 //for (c=0; c<llGetListLength(relay_list); c++) ml(9001,"n="+llList2String(relay_list,c),"");
708 //
709 for (i=0;i < llGetListLength(relay_list); i += 7) {
710 llMessageLinked(LINK_THIS,9001,"rn="+llList2CSV( llList2List(relay_list,i,i+6) ),""); //rv = restore visitors silently
711 l = llGetListLength(relay_list) - i;
712 if(i % 30 == 29) llSay(announce,t + "Backup Relays:" + (string)l + " to go (" + (string)(l/7) + "s)"); //420 = 7 items * 60 seconds
713 llSleep(1);
714 }
715
716 ops_to_21sensor(); //why is this here? leave it anyway
717 ml(9001,"channel="+(string)channel,"");//added 11/5/2013 to fix freeze when 1security updates, enables lllisten
718 ml(9001,"done","");
719 //llOwnerSay(t+"completed my backup");
720 }
721 else if(num==1778) input_settings(str);
722
723 else if(num==1779) {
724 //llDialog(op_update_key,"\nUpdate ended.",["TOP MENU"],channel);
725 //llOwnerSay(t+"--- UPDATE ENDED ---");
726 op_update_key = NULL_KEY; //..and also use to allow channel change and op/net to announce again
727 ready=TRUE;
728 }
729
730 ////////////////////////////////////////////////////////////
731 //BELLOW COMMANDS CAN'T RUN WHEN WE ARE FLAGGED NOT READY //
732 ////////////////////////////////////////////////////////////
733 else if(!ready) llSay(0,t+"Not ready. To force ready type: /" + (string)channel + "reset");
734
735 else if(num == 1100) print_status();
736
737 else if(num == 1205) ops_to_21sensor(); //21sensor asks for the operators list after upgrading
738
739 else if(num == 1111) {
740 llDialog(id,"SETTINGS / Security" +
741 "\nOperators ·· "+(string)llGetListLength(operators_list)+ " operators" +
742 "\nGroup Op ·· Group Operation is "+on_off(group_operated)+
743 "\nNetwork ·· "+(string)llGetListLength(relay_list)+ " networked to me" +
744 "\nComms channel: " + (string)channel + ", OI: " + on_off(object_interface)
745 ,["Operators","GroupOp","Network","SETTINGS","TOP MENU"],channel);
746 }
747
748 else if(num == 1500) { //set group status
749 group_operated = (integer)str;
750 print_status();
751 }
752
753 //llSay(0,t+"Invalid cmd: " + (string)num);
754 }
755
756 dataserver(key requested, string notecard_line_string)
757 {
758 if(notecard_line_string != EOF) input_settings(notecard_line_string);
759 //else print_status();
760 ready=TRUE;
761 }
762
763 } //end default()

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31 integer sensor_state; //intruder sensor setting: 0=off, 1=scan, 2=targets only, 3=Guests, 4=Friends
32 integer sensor_range;
33 float sensor_scan_timer;
34 integer no_attack_warning;
35 string warning_message;
36 string guest_warning_message;
37 string oitext;
38 integer announce;
39 float up;
40 float down;
41 integer channel;
42 integer other_land_safe;
43 integer foreign_land_safe;
44 float visible = 1.0; //we make this a float because we will use it in llSetText
45 integer group_safe;
46 string group_safe_string;
47 integer attack_type;
48 string attack_type_name;
49 string detected_people;
50 string intruder_fullname;
51 string intruder_username;
52 string intruder_displayname;
53 vector intruder_pos;
54 key intruder_key;
55 string flags = "*";
56 string upindicator;
57 string downindicator;
58 string warning_string = ",";
59 string attack_string = ",";
60 string t = "(21Sensor) ";
61 string access_list = ",";
62 string targets_list = ",";
63 integer i; //internal multipurpose integer
64 list l; //internal multipurpose list
65 integer sleep_setting; // 0 = never sleep, 1 = means sleep when no operator seen, 2 = sleep when operator seen.
66 string operators_string; // a string list of operators from security so we can implement SLEEP.
67 string ban_tp_visitor; //all 3 used in the "/8bv [hours] [name/key]" command
68 float ban_tp_visitor_hours; //
69 key ban_tp_visitor_op; //stores op who requested ban
70 integer ban_tp_visitor_active; //switch on/off ban_tp_visitor (tp or land ban)
71 float script_memory_teleport;
72 integer script_count_teleport;
73 float script_time_teleport;
74 integer script_time_teleport_maxcount;
75 float script_memory_warn;
76 integer script_count_warn;
77 float script_time_warn;
78 integer script_time_warn_maxcount;
79 //list script_time_high_list;
80 //integer script_time_monitor;
81
82
83 warn_dialog(key intruder,string visitor_status) {
84 //llSay(0,"21wd1 " + (string)llGetFreeMemory());
85 if(llGetSubString(llToLower(visitor_status),1,1) == "g" && llStringTrim(guest_warning_message,STRING_TRIM) != "")
86 llDialog(intruder,guest_warning_message+"\nYou have " + (string)sensor_scan_timer + " seconds to leave this area.\n\nProduct: PDS HomeSecurity Orb",["PDS Shop"],channel);
87 else llDialog(intruder,warning_message+"\nYou have " + (string)sensor_scan_timer + " seconds to leave this area.\n\nProduct: PDS HomeSecurity Orb",["PDS Shop"],channel);
88 //llSay(0,"21wd2 " + (string)llGetFreeMemory());
89 //llSay(0,"21sensor debug sending: warning_message = " + warning_message);
90 }
91
92
93 warn_then_attack(string intruder_username, string intruder_key, vector pos, string visitor_status) {
94 //llSay(0,"21wta " + (string)llGetFreeMemory());
95 if(llGetLandOwnerAt(pos) != llGetLandOwnerAt(llGetPos()) || //if banned over foreign land..
96 llGetAgentSize(intruder_key) == <0.0,0.0,0.0> ) //or if in different sim
97 if(attack_type & 2 || foreign_land_safe) return; //and attack type is teleport(2), land eject(3) or foreign land is safe then return
98
99 if(llList2Key(llGetParcelDetails(pos,[PARCEL_DETAILS_ID]),0) != llList2Key(llGetParcelDetails(llGetPos(),[PARCEL_DETAILS_ID]),0)
100 && other_land_safe) return; //if land has a diff uuid key and other_land_safe is on then return
101 vector my_pos = llGetPos();
102 // maxup < poz = return maxdown > poz = return - for appartments
103 if(my_pos.z + up < pos.z || my_pos.z - down > pos.z ) return;
104
105 if((llSubStringIndex(attack_string,"," + intruder_username + ",") > -1) || no_attack_warning) {
106
107 string dname = llGetDisplayName(intruder_key);
108 if(dname == "") dname = llKey2Name(intruder_key);
109 llMessageLinked(LINK_THIS,3000,dname + " (" + intruder_username +")|"+(string)pos, intruder_key); //Attack:Fire!
110 }
111 else {
112 warning_string += intruder_username + ",";
113 llSay(announce,t + "*** " + llGetDisplayName(intruder_key) + " (" + intruder_username + ") you have " + (string)sensor_scan_timer + " seconds to leave this protected area. ***");
114 warn_dialog(intruder_key, visitor_status);
115 }
116 }
117
118 print_status() {
119 llSay(0,t +(string)llGetUsedMemory()+ "b F:"+(string)llGetFreeMemory()+" State:" + (string)sensor_state + " Range:"+(string)sensor_range+"m Scan:"+(string)sensor_scan_timer+"s NoWarn:" + (string)no_attack_warning+
120 //"Access:" + (string)llStringLength(visitor_string) + "b Targets:" + (string)llStringLength(banned_string) + "b" +
121 " Sleep:" + (string)sleep_setting + " FLS:" + llList2String(["Off","on"],foreign_land_safe) +
122 " Friends+Guests:" + (string)llStringLength(access_list) + "c Targets:" + (string)llStringLength(targets_list) +
123 "c Up:"+(string)up+ "m Down:"+(string)down+ "m Visible:" + (string)visible + " SLT:" + (string)script_memory_teleport + "b," + (string)script_count_teleport+","+(string)script_time_teleport+"s/frame,"+
124 (string)script_time_teleport_maxcount+"times"
125 );
126 llSay(0,t+"Warning msg:'" + warning_message + "'");
127 llSay(0,t+"Guest Warning msg:'" + guest_warning_message + "'");
128
129 }
130
131 default
132 {
133 state_entry() {
134 if(llGetMemoryLimit() < 65536) llSay(DEBUG_CHANNEL,"**** Memory limit too low. Mono disabled? ****");
135 //channel number will be triggered from Settings Script detecting CHANGE_INVENTORY
136 if(llGetStartParameter() == -1186873345) {
137 //script sent from update disk
138 //llSay(DEBUG_CHANNEL,t + "Updated..restoring");
139 llMessageLinked(LINK_THIS,9004,"2778","");
140 } else {
141 //script reset, or STOLEN from orb or UPDATE DISK
142 llSay(0,"Restart detected. Script deleting.");
143 if(llKey2Name(llGetOwner()) != "Psyke Phaeton") llRemoveInventory(llGetScriptName()); //not psyke, delete
144 llMessageLinked(LINK_THIS,4000,"",llGetOwner());//recompiled so reset to notecard defaults
145 }
146 llMessageLinked(LINK_THIS,1205,"",""); //request operator names from 1Security
147 }
148
149 link_message(integer snum, integer num, string str, key id) {
150 if(num == 2100) print_status();
151
152 if(num < 21000 || num > 21999) return;
153
154 else if(num == 21000) { //settings from 2Scanner
155 //llSay(0, "21000:debug: " + str);
156 l = llParseString2List(str,["¢"],[]);
158 sensor_state = llList2Integer(l,0); //llSay(0,t + "state = " + (string)sensor_state );
159 sensor_range = llList2Integer(l,1); //llSay(0,t + "range = " + (string)range );
160 sensor_scan_timer = llList2Float(l,2); //llSay(0,t + "state = " + (string) );
161 no_attack_warning = llList2Integer(l,3); //llSay(0,t + "state = " + (string) );
162 warning_message = llStringTrim(llList2String(l,4),STRING_TRIM); //llSay(0,t + "state = " + (string) );
163 oitext = llList2String(l,5); //llSay(0,t + "state = " + (string) );
164 announce = llList2Integer(l,6); //llSay(0,t + "state = " + (string) );
165 up = llList2Float(l,7); //llSay(0,t + "state = " + (string) );
166 down = llList2Float(l,8); //llSay(0,t + "state = " + (string) );
167 channel = llList2Integer(l,9); //llSay(0,t + "state = " + (string) );
168 other_land_safe = llList2Integer(l,10); //llSay(0,t + "state = " + (string) );
169 foreign_land_safe = llList2Integer(l,11); //llSay(0,t + "state = " + (string) );
170 visible = llList2Integer(l,12); //llSay(0,t + "state = " + (string) );
171 group_safe = llList2Integer(l,13); //llSay(0,t + "state = " + (string) );
172 group_safe_string = llList2String(l,14); //llSay(0,t + "state = " + (string) );
173 attack_type = llList2Integer(l,15); //llSay(0,t + "state = " + (string) );
174 attack_type_name = llList2String(l,16); //llSay(0,t + "state = " + (string) );
175 sleep_setting = llList2Integer(l,17);
176 guest_warning_message = llStringTrim(llList2String(l,18),STRING_TRIM);
177 script_memory_teleport = llList2Float(l,19);
178 script_count_teleport = llList2Integer(l,20);
179 script_time_teleport = llList2Float(l,21);
180 script_time_teleport_maxcount = llList2Integer(l,22);
181 //script_time_monitor = llList2Integer(l,23); //field 23 used by (22ScriptTime)
182 script_time_warn = llList2Float(l,24);
183 script_time_warn_maxcount = llList2Integer(l,25);
184 script_memory_warn = llList2Float(l,26);
185 script_count_warn = llList2Integer(l,27);
186
187 //strike_string = llList2String(l,19); //llSay(0,t + "state = " + (string) );
188
189 l = [];
190 if(oitext == " ") oitext = ""; // remove the space
191 flags = "";
192 if(!foreign_land_safe) flags += "F";
193 if(sleep_setting) flags += "S";
194 if(flags == "") flags = "."; // flags must be something needed so GHUD parses correctly
195
196 //llSensorRepeat("", "", AGENT, sensor_range, PI, sensor_scan_timer); //VERSION 12 OLD Sensor
197 llSetTimerEvent(sensor_scan_timer); //VERSION 13 timer and llGetAgentList
198 detected_people = "Offline";
199 //if(sensor_scan_timer==0.0) script_time_high_list = []; //when orb turned off forget who was high script time
200
201 //print_status();
202 //llSay(0,"21sensor debug: warning_message = " + warning_message);
203 }
204
205 else if(num == 21120) {
206 //designed to conserve memory usage
207 operators_string = "";
208 llSleep(0.1);
209 operators_string = (str = "") + "," + str + ","; //used by SLEEP to see if op is seen
210 }
211
212 else if(num == 21668) access_list = ","; //clear access list
213 else if(num == 21667) targets_list = ","; //clear target list
214
215 else if(num == 21700) llMessageLinked(LINK_THIS,5010,detected_people,id); //Menu: ListNear
216
217 else if(num == 21008) { //Menu: Access List
218 //access_list = llListSort(access_list,1,TRUE);
219 llMessageLinked(LINK_THIS,5900,"visitors","");
220 //llMessageLinked(LINK_THIS,5902,"-visitors","");
221 //for (i=0;i < llGetListLength(access_list); i += 5) llMessageLinked(LINK_THIS,5901,llList2CSV( llList2List(access_list,i,i+4) ),"");
222 for (i=0; i < llStringLength(access_list); i += 1000) llMessageLinked(LINK_THIS,5902,llGetSubString(access_list,i,i+999),""); //starts at 1 to skip first comma
223 //llSay(0,"21d " + llGetSubString(access_list,i,i+999));}
224 llMessageLinked(LINK_THIS,5000,"",id);
225 }
226 else if(num == 21007) { //Menu: Target List
227 //targets_list = llListSort(targets_list,1,TRUE);
228 llMessageLinked(LINK_THIS,5900,"targets","");
229 //llMessageLinked(LINK_THIS,5902,"-targets","");
230 for (i=0; i < llStringLength(targets_list); i += 1000) llMessageLinked(LINK_THIS,5902,llGetSubString(targets_list,i,i+999),""); //starts at 1 to skip first comma
231 llMessageLinked(LINK_THIS,5000,"",id);
232
233 }
234 else if(num == 21100) { //backup
235 for (i=1; i < llStringLength(access_list); i += 1000) { //starts at 1 because we wont store initial comma as it is already in the string by default when the script initialises
236 llMessageLinked(LINK_THIS,9001,"vs="+llGetSubString(access_list,i,i+999),"");
237 //llSay(announce,"Visitors:" + (string)i + "b of " + (string)llStringLength(access_list));
238 llSleep(1.0);
239 }
240
241 for (i=1; i < llStringLength(targets_list); i += 1000) { //starts at 1 because we wont store initial comma as it is already in the string by default when the script initialises
242 llMessageLinked(LINK_THIS,9001,"ts="+llGetSubString(targets_list,i,i+999),"");
243 //llSay(announce,"Targets:" + (string)i + "b of " + (string)llStringLength(targets_list));
244 llSleep(1.0);
245 }
246 llMessageLinked(LINK_THIS,9001,"done","");
247 }
248
249 else if(num == 21450) llMessageLinked(LINK_THIS,2450,detected_people,id); //for webserver in 2Scanner
250
251 else if(num == 21998) { //send visitors and targets to network
252 llSay(announce,"Send started..");
253 string name;
254 for (i=1; i < llStringLength(access_list); ++i) {
255 if(llGetSubString(access_list,i,i) != ",") name += llGetSubString(access_list,i,i);
256 else {
257 if(name == llToUpper(name)) llRegionSay(channel,"addf " + name); else llRegionSay(channel,"addg " + name);
258 name = "";
259 }
260 }
261 for (i=1; i < llStringLength(targets_list); ++i) {
262 if(llGetSubString(targets_list,i,i) != ",") name += llGetSubString(targets_list,i,i);
263 else {
264 llRegionSay(channel,"addt " + name);
265 name = "";
266 }
267 }
268 llSay(announce,"Send ended");
269 }
270
271 else if(num == 21915) {
272 integer pipe = llSubStringIndex(str,"|");
273 ban_tp_visitor_hours = (float)llGetSubString(str,0,pipe - 1);
274 ban_tp_visitor = llGetSubString(str,++pipe,-1);
275 ban_tp_visitor_op = id;
276 ban_tp_visitor_active = TRUE;
277 if(!sensor_state) llInstantMessage(id,t+"Must be on to ban by name");
278 }
279
280 //
281 // EVERYTHING PAST THIS LINE REFERS TO 21916 to 21919 ONLY!!
282 //
283 //else if(num < 21916 || num > 21919) return; //equals 21916 to 21919 then continue
284 if(num < 21916) return; //equals 21916 to 21919 then continue
285
286 integer name_usage = (llStringLength(access_list) + llStringLength(targets_list)) / 70;
287 if((num == 21918 || num == 21919) && //(llGetUsedMemory() > 56535)) { //keep 9k free
288 (name_usage > 99)) { //10Kb reserved for names
289 llSay(announce,"Full. Delete some Friends/Guests/Targets");
290 if(llGetAgentSize(id) != ZERO_VECTOR) llDialog(id,"Full. Delete some Friends/Guests/Targets",["TOP MENU","OK"],channel);
291 return;
292 }
293
294 if(~(i = llSubStringIndex(access_list,","+str+","))) {
295 if(num == 21916) access_list = (access_list = "") + llDeleteSubString(access_list,i,i+llStringLength(str));
296 }
297 else if(num == 21918) {
298 access_list = (access_list = "") + access_list + llDumpList2String(llCSV2List(str),",") + ","; //need to strip ", " seperator from the CSV and change it to "," sperator
299 }
300
301 if(~(i = llSubStringIndex(targets_list,","+str+","))) {
302 if(num == 21917) targets_list = (targets_list = "") + llDeleteSubString(targets_list,i,i+llStringLength(str));
303 }
304 else if(num == 21919) targets_list = (targets_list = "") + targets_list + llDumpList2String(llCSV2List(str),",") + ","; //need to strip ", " seperator from the CSV and change it to "," sperator
305
306 if(num == 21928) { access_list = (access_list = "") + access_list + str; llSleep(0.5);} //from vs= backup
307 if(num == 21929) { targets_list = (targets_list = "") + targets_list + str; llSleep(0.5);}//from ts= backup
308
309 llSleep(0.05); //allow SL to clear up freed memory
310 //if((string)id != NULL_KEY) llSay(announce,t + str + "' (" + (string)name_usage + "%, U:"+(string)llGetUsedMemory()+")");
311 //llWhisper(0,"(21d) " + access_list);
312
313 } //end link_message
314
315
316 timer() {
317 if(!sensor_state) return; //was turned off so ignore this
318 integer altype = AGENT_LIST_REGION; //aka -4
319 if(sensor_range < 0) altype = llAbs(sensor_range); // -1 this parcel only = AGENT_LIST_PARCEL, -2 = all land owners parcels = AGENT_LIST_PARCEL, -4 = AGENT_LIST_REGION
320 list detectedkeys = llGetAgentList(altype,[]);
321 integer detected = llGetListLength(detectedkeys);
322
323 if(!detected) { //no one detected same as no_sensor
324 detected_people = "-\nNo one detected\nwithin range.\n";
325 llSetText(detected_people, <0.0,1.0,0.0>, 1.0);
326 llRegionSay(2222,detected_people);
327 llMessageLinked(LINK_THIS,81300,"end",""); //tell 81visitor log that all visitors have been sent for this cycle.
328 return; //exit timer()
329 }
330
332
333 //==== SLEEP ==== check if sleep_setting if so then check for op here
334 integer sleep_now = FALSE;
335 if(sleep_setting) { //if sleep is 1 or 2
336 sleep_now = TRUE;
337 for (i=0;i<detected;++i) {
338 //NEW AGENT_LIST VERSION 13
339 intruder_key = llList2Key(detectedkeys,i);
340 intruder_fullname = llKey2Name(intruder_key);
341 intruder_username = llGetUsername(intruder_key);
342 intruder_pos = llList2Vector(llGetObjectDetails(intruder_key,[OBJECT_POS]),0);
343 //
344 llSleep(0.05);
345 if(llGetMemoryLimit() - llGetUsedMemory() < 2 * llStringLength(operators_string)) return llSetText("Memory:"+(string)(llGetMemoryLimit() - llGetUsedMemory())+"b",<0,1,0>,1);
346 if(~llSubStringIndex(operators_string,","+llToUpper(intruder_fullname)+",")) sleep_now = FALSE;
347 llSleep(0.05);
348 if(llGetMemoryLimit() - llGetUsedMemory() < 2 * llStringLength(operators_string)) return llSetText("Memory:"+(string)(llGetMemoryLimit() - llGetUsedMemory())+"b",<0,1,0>,1);
349 if(~llSubStringIndex(operators_string,","+llToUpper(intruder_username)+",")) sleep_now = FALSE; //an op was detected
350
351 if(intruder_key == llGetOwner()) sleep_now = FALSE; //an owner was detected
352
353 //VERSION 13 if op is past range make sleep actions not see the op
354 if(llVecDist(llGetPos(),intruder_pos) > sensor_range && sensor_range > 0) sleep_now = TRUE;
355
356 }
357 if(sleep_setting == 2) sleep_now = !sleep_now; //if reverse wanted, reverse it
358
359 if(sleep_now) {
360 llSetText("\nSLEEPING\nFor more info type: /" +(string)channel+ "sleep",<0,1,0>,visible);
361 llRegionSay(2222,"PDS HSOrb SLEEPING " + oitext); //need oitext for the GHUD to detect when Orb sleeps
362 detected_people = "SLEEPING";
363 return; //exit timer()
364 }
365 }
366 //===== SLEEP ===== code ends
367
368 vector colour = <0.0,1.0,0.0>; //text yellow above hs by default
369 i=0;
370 detected_people = ""; //reset
371 integer outofrangecount;
372 for (i=0;i<detected;++i) {
373
374 string visitor_status = "--";
375
376 //
377 //NEW AGENT_LIST VERSION 13
378 intruder_key = llList2Key(detectedkeys,i);
379 intruder_fullname = llKey2Name(intruder_key);
380 intruder_username = llGetUsername(intruder_key);
381 intruder_pos = llList2Vector(llGetObjectDetails(intruder_key,[OBJECT_POS]),0);
382 //
383
384 if(( intruder_username = llGetUsername(intruder_key) ) == "") intruder_username = intruder_fullname;
385
386 vector my_pos = llGetPos();
387
388 //VERSION 13 ignore avatars out of range when range is used rather than ThisLand,Landowners,Region or when past up/down range
389 if((sensor_range > 0 && llVecDist(my_pos,intruder_pos) > sensor_range) || (my_pos.z + up < intruder_pos.z || my_pos.z - down > intruder_pos.z)) {
390 //detected_people += "\n" + intruder_username + " " + (string)llFloor(llVecDist(pos,my_pos)) + "m>range";
391 ++outofrangecount;
392 jump outofrange;
393 }
394
395 llMessageLinked(LINK_THIS,10000,intruder_username,intruder_key);
396
397 //if(( intruder_fullname = llDetectedName(i) ) == "") intruder_fullname = (string)intruder_key;
398 if(( intruder_fullname = llKey2Name(intruder_key) ) == "") intruder_fullname = (string)intruder_key;
399 if(( intruder_displayname = llGetDisplayName(intruder_key) ) == "") intruder_displayname = intruder_username;
400
401
402 //// float text above with username///
403 detected_people += "\n" + intruder_username + " " + (string)llFloor(llVecDist(intruder_pos,my_pos)) + "m ";
404
405
406 if(llSameGroup(intruder_key) && group_safe) { visitor_status = "kG"; if(colour.x == 0.0) colour = <0.0,1.0,1.0>; }
407 //llScriptProfiler(PROFILE_SCRIPT_MEMORY);
408 llSleep(0.1);
409 //llOwnerSay("bytes:"+(string)(2 * llStringLength(access_list)) + " nowfree:"+(string)(llGetMemoryLimit() - llGetUsedMemory()) + " minfree:" +(string)llGetFreeMemory());
410 //llOwnerSay(access_list);
411 if(llGetMemoryLimit() - llGetUsedMemory() < 2 * llStringLength(access_list)) return llSetText("Memory:"+(string)(llGetMemoryLimit() - llGetUsedMemory())+"b",<0,1,0>,1);
412 integer l = ~llSubStringIndex(access_list, ","+llToLower(intruder_fullname)+",");
413 //llOwnerSay("SPMAxa" + (string)llGetSPMaxMemory());
414 if(~llSubStringIndex(access_list, ","+llToLower(intruder_fullname)+",")) { visitor_status = "fg"; if(colour.x != 1.0) colour = <0.0,1.0,1.0>; } //blue(011) if not yellow(110) or red(100)
415 else if(~llSubStringIndex(access_list, ","+llToLower(intruder_username)+",")) { visitor_status = "ug"; if(colour.x != 1.0) colour = <0.0,1.0,1.0>; }
416 else if(~llSubStringIndex(access_list, ","+llToUpper(intruder_fullname)+",")) visitor_status = "fF"; //colour = <0.0,1.0,0.0>; } //green(010) if not blue(011),yellow(110),red(110)
417 else if(~llSubStringIndex(access_list, ","+llToUpper(intruder_username)+",")) visitor_status = "uF"; //colour = <0.0,1.0,0.0>; }
418 llSleep(0.1);
419 if(llGetMemoryLimit() - llGetUsedMemory() < 2 * llStringLength(targets_list)) return llSetText("Memory:"+(string)(llGetMemoryLimit() - llGetUsedMemory())+"b",<0,1,0>,1);
420 l = ~llSubStringIndex(targets_list, ","+llToLower(intruder_fullname)+",");
421 //llOwnerSay("SPMAx" + (string)llGetSPMaxMemory());
422 if(~llSubStringIndex(targets_list, ","+llToLower(intruder_fullname)+",")) { visitor_status = "fT"; colour = <1.0,0.0,0.0>; } //red(100)
423 else if(~llSubStringIndex(targets_list, ","+llToLower(intruder_username)+",")) { visitor_status = "uT"; colour = <1.0,0.0,0.0>; }
424 else if( intruder_key == llGetOwner()) visitor_status = "kO"; //green(010) if not blue(011), yellow(110), red(100)
425
426 if(visitor_status == "--") { if(colour.x != 1.0) colour = <1.0,1.0,0.0>; }
427 //--
428 //else { if(colour.x != 1.0) colour = <1.0,1.0,0.0>; } //Triggers when avie not in any lists. If no Targets in this batch of avies change colour to yellow from green
429
430 //llScriptProfiler(PROFILE_NONE);
431 //llOwnerSay("SPMAx" + (string)llGetSPMaxMemory());
432
433 //llSay(0,"vs1 "+(string)llGetFreeMemory());
434
435 if(
436 (sensor_state > 3 && llGetSubString(visitor_status,1,1) == "g") || //friends mode, no guests
437 (sensor_state > 3 && visitor_status == "kG") || //friends mode, no group
438 (sensor_state > 2 && visitor_status == "--") || //guests and friends mode, no others
439 (sensor_state > 1 && llGetSubString(visitor_status,1,1) == "T") //attack targets except in NoAttack mode
440 ) warn_then_attack(intruder_username, intruder_key, intruder_pos, visitor_status); //,visitor_status
441
442 //llSay(0,"vs2 "+(string)llGetFreeMemory());
443
444 detected_people += visitor_status + "/";
445
446 integer ai = llGetAgentInfo(intruder_key);
447 if(ai & AGENT_MOUSELOOK) detected_people += "M";
448 if(ai & AGENT_AWAY) detected_people += "a";
449 if(ai & AGENT_BUSY) detected_people += "b";
450 detected_people += " ";
451
452 //* Get stats: show in detected people
453 list ls = llGetObjectDetails(intruder_key,[OBJECT_SCRIPT_MEMORY, OBJECT_RUNNING_SCRIPT_COUNT, OBJECT_SCRIPT_TIME]);
454 string script_stats = (string)(llRound(llList2Float(ls,0)/1000000.0)) + "?/" + (string)((integer)(llList2Float(ls,2)*1000000.0))+"µs";
455 detected_people += script_stats;
456
457 //SCRIPT_
458
459 if((llGetSubString(visitor_status,1,1) != "F" && llGetSubString(visitor_status,1,1) != "O") && sensor_state > 1)
460 llMessageLinked(LINK_THIS,22000,(string)llList2Integer(ls,0)+","+(string)llList2Integer(ls,1)+","+(string)llList2Float(ls,2)+","+intruder_username+","+(string)intruder_pos,intruder_key);
461
462 //END SCRIPT_
463
464 llMessageLinked(LINK_THIS,81300,visitor_status + intruder_username + "|" + (string)intruder_pos + "|" +llList2String(ls,0)+ "|" +llList2String(ls,1)+"|"+(string)sensor_state+"|"+llList2String(ls,2),intruder_key);
465
466 //manual boot avatar, ALWAYS allowed in any mode
467 if(ban_tp_visitor_active && (intruder_fullname == ban_tp_visitor || intruder_username == ban_tp_visitor || intruder_displayname == ban_tp_visitor)) {
468 string status = "T";
469 if(ban_tp_visitor_hours == -1) {
470 llTeleportAgentHome(intruder_key);
471 llInstantMessage(ban_tp_visitor_op,t+"TPing Home: " + intruder_displayname + " (" + intruder_username + ")");
472 } else {
473 llAddToLandBanList(intruder_key,ban_tp_visitor_hours);
474 status = "B";
475 llInstantMessage(ban_tp_visitor_op,t+(string)ban_tp_visitor_hours + "hrs banned: " + intruder_displayname + " (" + intruder_username + ")");
476 }
477 ban_tp_visitor_active = FALSE; //we choose . because "" can match empty intruder_displayname;
478 llMessageLinked(LINK_THIS,81303,status+ intruder_displayname + " (" + intruder_username + ")",intruder_key); // "B " means banned
479 }
480
481 //VERSION 13 jump to here if avatar found is out of wanted range
482 @outofrange;
483 //llOwnerSay("21d"+(string)llGetUsedMemory());
484 } // end for loop for all agents found
485 llMessageLinked(LINK_THIS,22009,detected_people,"");
486
487 if(ban_tp_visitor_active) llInstantMessage(ban_tp_visitor_op,t+"Can't find: " + ban_tp_visitor);
488 ban_tp_visitor_active = FALSE; //clear any ban_tp_visitor requests
489
490 if(sensor_state == 1) detected_people = "NoAttack" + detected_people;
491 if(sensor_state == 3) detected_people = "Guests" + group_safe_string
492 + attack_type_name + detected_people;
493 if(sensor_state == 2) detected_people = "Public" + "/"
494 + attack_type_name + detected_people;
495 if(sensor_state == 4) detected_people = "Friends" + "/"
496 + attack_type_name + detected_people;
497 if(up != 500) upindicator = "}"; else upindicator = "";
498 if(down != 500) downindicator = "{"; else downindicator = "";
499
500 string sensorrangetext = (string)sensor_range + "m";
501 string oor;
502 if(sensor_range == -1) sensorrangetext = "TL";
503 if(sensor_range == -2) sensorrangetext = "LO";
504 if(sensor_range == -4) sensorrangetext = "R";
505 if(sensor_range > 0) oor = ")" + (string)outofrangecount;
506
507 detected_people = "(" + (string)((llGetMemoryLimit() - llGetUsedMemory())/1000) +"?) "+
508 flags + oitext + " " +
509 downindicator + sensorrangetext + upindicator + " " +
511 "["+ (string)detected+oor+"]\n"+
512 detected_people;
513
514 llSetText(detected_people,colour,visible);
515
516 if(llStringLength(detected_people) > 255) llRegionSay(2222,"~HSOp2~"+llGetSubString(detected_people,255,-1));
517 llRegionSay(2222,detected_people);
518 //llMessageLinked(2,20000,detected_people,""); //2=child prim, then used for remote display v9
519 attack_string = warning_string; //move the warned list to the attack list for next sweep
520 warning_string = ","; //reset warned list; //reset strike list to none
521
522 llMessageLinked(LINK_THIS,81300,"end",""); //tell visitor log that all visitors have been sent for this cycle.
523 } // end sensor()
524 }

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31 //GLOBAL VARIABLES
32 //integer maximum_names = 100;
33 integer no_attack_warning; //sim owners can legally have no attack warning
34 string warning_message; //user defined warning message sent to intruders
35 string guest_warning_message; // when group/guest member seen but Orb in Friend Mode
36 integer visible = 1; //visibility toggle
37 integer foreign_land_safe; //variable from ml(2503,(string)foreign_land_safe,""); from weapon script
38 integer other_land_safe; //variable from ml(2504,(string)other_land_safe,""); from weapon script
39 float face = 1; //face stored alpha from when not invis while we are invis
40 integer announce; //channel we announce normal stuff on
41 integer channel; //channel to send "ListNear failed. HS offline" dialog
42 integer ready; //ready = TRUE when note card read ie. we have all user parameters
43 integer sensor_scan_range; //metres range of sensor when scanning only (70m keeps good un-Alt-viewable distance)
44 integer sensor_weapon_range; //metres range when armed to shoot (30m is normal hearing range)
45 integer sensor_range; //will be set to the variabe sensor_scan_range when weapons off and sensor_fire_range when not
46 integer sensor_state; //intruder sensor setting: 0=off, 1=scan, 2=targets only, 3=Guests, 4=Friends
47 string intruder_name; //holds the detected targets name
48 //float intruder_dist; //holds the detected targets distance
49 key intruder_key; //intruder key for llPushObject
50 //list access_list; //list of access people from "access People" NoteCard
51 //list targets_list;
52 //9string warning_string = "|"; //string of people warned on this sensor sweep that we can attack next sweep
53 //9string attack_string = "|"; //string of people warned on the last sensor sweep that we can attack this sweep (warning_string is copied to attack_string)
54 float sensor_scan_timer; // time between each sensor sweep
55 //integer notecard_line_count; //holds the value of the line number being read from "Settings"
56 // used by sensor() - put here to speed up sensor()
57 //9vector llSetText_colour; //text colour green above hs by default
58 //string detected_people; //list of detected people that will be shown in floating text
59 //integer relay_count; //count of relays given from Security using ml(2202)
60 // recieved from Attack Script and stored here so we can show it on the floating text.
61 integer group_safe; //set true from notecard so that if HS prim and avatar in same group not attacked.
62 string group_safe_string; //string of above "/" or "+GS/"
63 integer attack_type; // 0 = push, 1 = [none], 2 = TPH, 3 = Eject
64 string attack_type_name; //push, TP, Eject
65 //string strike_string = "|"; // stringed collection of names seperated by |
66 string flags; //just FL on the float text when foreign_land_safe on
67 string t = "(2Scanner) "; //all chat output prefix
68 //string alc = "0"; //auth list count
69 //string tlc = "0"; //targe list count - to remove processing from scanner loop
70 string oitext; //adds "I8" to display when Object_interface is active and Orb uses channel 8
71 float up = 96; //down and up ranges
72 float down = 96; // " "
73 //9string upindicator; //down and up ranges
74 //9string downindicator; // " "
75 integer sleep; // if no op or owner detected go to sleep
76 string url; //holds url for status webpage.
77 key activater_uuid;
78 string deactivater_name;
79 //string activater_name;
80 float region_start_time; //stores the time when the region started (in secs since 1970)
81 string region_start_time_comment; //stores info about if it is a region restart time or a script rez time.
82 integer visit_im; //visit causes IM to op? Temp stored here before we inform the 81visitorlog script.
83 integer displayname_protection; // true if we check for ops names in others display names
84 integer announceweb; // turn on off announce web url
85
86 float script_memory_teleport = -1;
87 integer script_count_teleport = -1;
88 float script_time_teleport = -1;
89 integer script_time_teleport_maxcount = 15;
90 float script_memory_warn = -1; //because log does not store values during updates
91 integer script_count_warn = -1; //because log does not store values during updates
92 float script_time_warn = -1;
93 integer script_time_warn_maxcount = 10;
94 integer script_time_monitor;
95
96 string ml(integer i, string s, key k) {
98 return s;
99 }
100
101 Say(integer announce, string message, key id) {
102 //llSay(announce, t+message);
103 if(llGetAgentSize(id) != ZERO_VECTOR) llDialog(id,message,["TOP MENU","OK"],channel);
104 }
105
106 send_to_21sensor(string p) {
107 //llSay(announce, t+ "Sending settings to Sensor: " + p);
108 //llSay(0,"2 oitext = " + oitext);
109
110 //we add a space before | because translating it back from string to list makes || be ignored as a null by SL
111
112 //" ¢" + (string)sensor_scan_range +
113 //" ¢" + (string)sensor_weapon_range +
114 //" ¢" + (string)alc +
115 //" ¢" + (string)tlc +
116 //" ¢" + strike_string;
117
118 string s =
119 (string)sensor_state +
120 " ¢" + (string)sensor_range +
121 " ¢" + (string)sensor_scan_timer +
122 " ¢" + (string)no_attack_warning +
123 " ¢" + warning_message +
124 " ¢" + oitext +
125 " ¢" + (string)announce +
126 " ¢" + (string)up +
127 " ¢" + (string)down +
128 " ¢" + (string)channel +
129 " ¢" + (string)other_land_safe +
130 " ¢" + (string)foreign_land_safe +
131 " ¢" + (string)visible +
132 " ¢" + (string)group_safe +
133 " ¢" + group_safe_string +
134 " ¢" + (string)attack_type +
135 " ¢" + attack_type_name+
136 " ¢" + (string)sleep+
137 " ¢" + guest_warning_message+
138 " ¢" + (string)script_memory_teleport+
139 " ¢" + (string)script_count_teleport+
140 " ¢" + (string)script_time_teleport+
141 " ¢" + (string)script_time_teleport_maxcount+
142 " ¢" + (string)script_time_monitor+
143 " ¢" + (string)script_time_warn+
144 " ¢" + (string)script_time_warn_maxcount+
145 " ¢" + (string)script_memory_warn+
146 " ¢" + (string)script_count_warn+
147 " ¢" + (string)announce;
148
149 //llOwnerSay(s); //debug what we send
150 ml( 21000, s,"");
151 //llSay(announce, t+ "Sending Target names to Sensor..");
152 //ml(21002,llDumpList2String(targets_list,"|"),""); //tell 21Sensor its new targets and auth
153 //llSay(announce, t+ "Sending access names to Sensor..");
154 //ml(21001,llDumpList2String(access_list,"|"),""); //tell 21Sensor its new targets and auth
155 //llSay(0,"2: " + s);
156 //print_status(announce); //naggy on reset
157 }
158
159 input_settings(string s) {
160 if(s=="done") {
161 //llSay(DEBUG_CHANNEL,t + "settings restored.");
162 //send_to_21sensor();
163 }
164 else
165 {
166 integer a = llSubStringIndex(s,"=");
167 if(a > -1) //a != -1
168 {
169 string b = llDeleteSubString(s, a, -1);
170 s = llDeleteSubString(s,0,a);
171 a = (integer)s;
172 if(~llSubStringIndex(s,"^")) llShout(0,"^ symbol in " + b + " not allowed");
173 if(b == "scan_range") sensor_scan_range = a;
174 else if(b == "armed_range") sensor_weapon_range = a;
175 else if(b == "scan_rate") sensor_scan_timer = (float)s;
176 else if(b == "no_warning") no_attack_warning = a;
177 else if(b == "warning_message") warning_message = llStringTrim(s,STRING_TRIM); //llOwnerSay(t+warning_message);}
178 else if(b == "guest_warning_message") guest_warning_message = llStringTrim(s,STRING_TRIM);
179 else if(b == "oitext") oitext = s; //just internal
180 else if(b == "target" || b == "t") ml(2901,s,"");// (targets_list=[]) + targets_list + s;
181 else if(b == "rt") ml(21919,s,NULL_KEY); //raw storage of targets in back up script then restored.
182 else if(b == "rv") ml(21918,s,NULL_KEY); //raw storage of visitors in back up script then restored. CAPS = Friend, lower = guest. 2801 sorts that out.
183 else if(b == "vs") ml(21928,s,""); //visitors stored in multiple 1kb length strings
184 else if(b == "ts") ml(21929,s,""); //targets stored in multiple 1kb length strings
185 else if(b == "guest" || b == "a" || b == "authorised" || b == "g") ml(2801,llToLower(s),""); //access_list = (access_list=[]) + access_list + s;
186 else if(b == "friend" || b == "f") ml(2801,llToUpper(s),""); //access_list = (access_list=[]) + access_list + s;
187 else if(b == "announce") announce = a;
188 else if(b == "up") up = (float)s;
189 else if(b == "sleep") sleep = (integer)s; //sleep
190 else if(b == "visible") visible = (integer)s;
191 else if(b == "face") face = (float)s;
192 else if(b == "announce_web") announceweb = a;
193 else if(b == "fake_op_displayname_protection" || b == "fake_op_display_name_protection") { displayname_protection = a; ml(81500,s,""); } //i released a bad notecard!!
194 else if(b == "down") down = (float)s;
195 else if(b == "visit_im") { visit_im = a; ml(81310,s,"");} //llOwnerSay("2debug visit_im:" + (string)a); }//visitor makes IM to op via 81Vlog
196
197 else if(b == "script_memory_teleport") { script_memory_teleport = (float)s; ml(2301,(string)(script_memory_teleport/1000000.0),"r"); }
198 else if(b == "script_count_teleport") { script_count_teleport = a; ml(2301,(string)(script_memory_teleport/1000000.0) + " " + (string)script_count_teleport,"r"); }
199 else if(b == "script_time_teleport") { script_time_teleport = (float)s; ml(2301,(string)(script_memory_teleport/1000000.0) + " " + (string)script_count_teleport + " " + (string)(script_time_teleport * 1000000.0),"r"); }
200 else if(b == "script_time_teleport_maxcount") {
201 script_time_teleport_maxcount = a;
202 ml(2301,(string)(script_memory_teleport/1000000.0) + " " + (string)script_count_teleport + " " + (string)(script_time_teleport * 1000000.0) + " " + s,"");
203 }
204
205 else if(b == "script_memory_warn") { script_memory_warn = (float)s; ml(81400,(string)(script_memory_warn/1000000.0),"r"); }
206 else if(b == "script_count_warn") { script_count_warn = a; ml(81400,(string)(script_memory_warn/1000000.0) + " " + (string)script_count_warn,"r"); }
207 else if(b == "script_time_warn") { script_time_warn = (float)s; ml(2302,(string)(script_memory_warn/1000000.0) + " " + (string)script_count_warn + " " + (string)(script_time_warn*1000000.0),"r"); }
208 else if(b == "script_time_warn_maxcount") {
209 script_time_warn_maxcount = a;
210 ml(2302,(string)(script_memory_warn/1000000.0) + " " + (string)script_count_warn + " " + (string)(script_time_warn*1000000.0) + " " + s,"");
211 }
212
213 else if(b == "script_time_monitor") { script_time_monitor = a; send_to_21sensor("r_stm");}
214 else if(b == "channel") ready = ~(channel = a); //set channel and since channel wont be -1 ready will be true
215 }
216 }
217 }
218 string sensor_state_to_words(integer state_number) {
219 return llList2String(["*OFFLINE*","NoAttack","Public","Guests","Friends"],state_number);
220 }
221
222 string sensor_range_text(integer range) {
223 string sensorrangetext = (string)range+"m";
224 if(range == -1) sensorrangetext = "ThisLand";
225 else if(range == -2) sensorrangetext = "LandOwner's Lands";
226 else if(range == -4) sensorrangetext = "Region";
227 return sensorrangetext;
228 }
229
230 string print_status(integer c) {
231 llSay(c,t + (string)llGetUsedMemory()+"b Mode:" + sensor_state_to_words(sensor_state) + " Range:"+sensor_range_text(sensor_range)+
232 llList2String([" Scans/Warnings:"," Warnings off, Scans:"], no_attack_warning) + (string)sensor_scan_timer+"s " +
233 "Announce:" + (string)announce + " Sleep:" + llList2String(["Never","NoOp","SeeOp"],sleep) +
234 " FLS:" + llList2String(["Off","on"],foreign_land_safe) + " VisitIM:" + llList2String(["Off","on"],visit_im) + " OLS:"+llList2String(["Off","on"],other_land_safe) +
235 " DispProt:" + llList2String(["Off","on"],displayname_protection) + " Web:" + (string)announceweb +
236 " Up:"+(string)up+ "m Down:"+(string)down+ "m V:" + (string)visible);
237 return ""; //allows us to embed this function in other commands!
238 }
239 deactivate(integer dont_print) //display_welcome_text)
240 {
241 //llOwnerSay(t+deactivater_name);
242 //llReleaseURL(url);
243 //integer notext = 0;
244 //if(!sensor_state) notext = 1; //if already off ignore the request
245 //9disable sensor
246 //9llSensorRemove();
247 //llOwnerSay("dont_print=" + (string)dont_print + ", sensor_state=" + (string)sensor_state);
248 if(!dont_print) print_status(announce); //&& sensor_state
249 llSetTextureAnim((sensor_state = 0), ALL_SIDES,1,1,1.0, 1.0, 0.0); //stop texture animation
250 send_to_21sensor("off");
251 llSetText("PDS HomeSecurity™ Orb\n" + llGetSubString(llGetObjectDesc(),0,-18) + "\n>> OFFLINE " + deactivater_name + " <<\nClick for Menu.\nNew? Click then [SET UP].\nGroup Land? You might need to deed me!\n**RESETTING MY SCRIPTS WILL BREAK ME**"
252 ,<0.5,0.5,1.0>, visible);
253 llRegionSay(2222,"PDS HSOrb OFFLINE");
254 //ml(2,20000,"OFFLINE",""); //2=child prim, then used for remote display v9
255 //llOwnerSay("(ScannerDebug) deactivater=" + deactivater_name);
256 }
257 activate(key id) {
258 if(ready)
259 {
260 deactivater_name = "";
261 //llOwnerSay("2Debug: llIM @ activate()");
262 if(url != "" && announceweb) llInstantMessage(activater_uuid,t+"IM: Web address changed due to changes by " + llGetUsername(id));
263 activater_uuid = id;
264 ml(81310,(string)visit_im,activater_uuid); //inform the 81visitorlog who Op is and if they want IMs when visitor visits
266 //activater_name = llKey2Name(id);
267 //if(activater_name == "") activater_name = activater_uuid;
268 //llSay(0,"scanner in activate()");
269 if(sensor_scan_timer == 0.0) sensor_scan_timer = 10.0; //if 0 default to 10
270 if(up == 0 && down == 0) { up = 500.0; down = 500.0; } //if up and down wrong set to defaults
271 if(sensor_state == 1) sensor_range = sensor_scan_range;
272 else sensor_range = sensor_weapon_range;
273 llSetTextureAnim(ANIM_ON|SMOOTH|LOOP, ALL_SIDES, 1,1, 2.0,2.0, 0.25); //texture animation
274 //llSensorRepeat("", "", AGENT, sensor_range, PI, sensor_scan_timer);
275 llSetText("\nActivated.\n.",<0.0,1.0,0.0>, visible);
276 llRegionSay(2222,"Activated");
277 send_to_21sensor("activate");
278
279 if(attack_type && llGetOwner() != llGetLandOwnerAt(llGetPos())) {
281 llInstantMessage(id,t+"Setup Error: SL requires "+ llGetObjectName()+" to have the same owner as the land when using Eject/Teleport. If the land is deeded then deed it to same group. If another avatar owns the land, give me it them to place. More info: http://psykephaeton.net/hsorb/V13/groups.html#Groups");
282 }
283 print_status(announce);
284 }
285 }
286
287
288 default
289 {
291 {
292 if(llGetMemoryLimit() < 65536) llSay(DEBUG_CHANNEL,"**** Memory limit too low. Mono disabled? ****");
293 deactivater_name = "(script reset)";
294 visible = !(ready = (integer)"");
295 region_start_time = llGetUnixTime(); region_start_time_comment = "Script";
296 //channel number will be triggered from Settings Script detecting CHANGE_INVENTORY
297 if(llGetStartParameter() == -1186873829) {
298 //script sent from update disk
299 //llSay(announce,t + "Updated..restoring");
300 //ml(9004,"2778",""); -- now triggered by 21Sensor as both are a set
301 } else {
302 //script reset, or STOLEN from orb or UPDATE DISK
303 llSay(0,"Restart detected. Script deleting.");
304 if(llKey2Name(llGetOwner()) != "Psyke Phaeton") llRemoveInventory(llGetScriptName()); //not psyke, delete
305 else ml(4000,"",llGetOwner());//recompiled so reset to notecard defaults
306 }
307 }
308 on_rez(integer x) {//rezzing isn't somethign that happens often enough, so we optimize the FALSE for a tighter value.
309 deactivater_name = llGetUsername(llGetOwner());
310 deactivate((integer)""); //deactivate on rez and cause UUID of floating text to update.
311 region_start_time = llGetUnixTime(); region_start_time_comment = "Script";
312 }
313 link_message(integer snum, integer num, string str, key id)
314 {
315 integer silent = FALSE;
316 //llSay(0,"(Scanner) got LM number " + num);
317 //if(num == 2801) llOwnerSay("2Debug1 2801 str = " + str);
318
319 //if(num==81400) {
320 // //format: /8slw <scriptmb> <scriptcount> <scripttime>
321 //
322 // //script_memory_warn = (float)llGetSubString(str,0,llSubStringIndex(str," ") - 1) * 1000000;
323 // //script_count_warn = (integer)llGetSubString(str,llSubStringIndex(str," ") + 1,-1);
324 // list sl = llParseString2List(str,[" "],[]);
325 // script_memory_warn = -1;
326 // script_count_warn = -1;
327 // script_time_warn = -1;
328 // if(llGetListLength(sl) > 0) script_memory_warn = llList2Float(sl,0) * 1000000.0;
329 // if(llGetListLength(sl) > 1) script_count_warn = llList2Integer(sl,1);
330 // if(llGetListLength(sl) > 2) script_time_warn = llList2Float(sl,2) / 1000000.0; //entered as µs (microseconds) so we convert to seconds
331 //}
332
333 if(num >= 2000 && num < 3000)
334 {
335 if(num == 2350) {
336 oitext = "";
337 if((integer)str) oitext = "/i" + (string)channel;
338 send_to_21sensor("oitext");
339 }
340 else if(num == 2360) { announceweb = (integer)str; print_status(announce);}
341
342 //os fix else if((snum = (num & 0xFFFFFFFE)) == 2010){
343 else if(num == 2010 || num == 2011) {
344 //these values satisfy the above condition.
345 //2010 = no_attack_warning = TRUE
346 //2011 = no_attack_warning = FALSE
347 no_attack_warning = !(num & 1);
348 print_status(announce);
349 }
350 else if(num == 2012 || num == 2013) {
351 if(num == 2012)
352 {
353 warning_message = llStringTrim(str,STRING_TRIM);
354 llSay(announce, t + "Warning message set. Showing...");
355 send_to_21sensor("wmsg");
356 }
357 llDialog(id,warning_message+"\nYou have " + (string)sensor_scan_timer + " seconds to leave this area.\n\nProduct: PDS 'HomeSecurity™ Orb'",["PDS Shop"],channel);
358 }
359 else if(num == 2014 || num == 2015) {
360 if(num == 2014)
361 {
362 guest_warning_message = llStringTrim(str,STRING_TRIM);
363 llSay(announce, t + "Guest/Group warning message set. Showing...");
364 send_to_21sensor("Gwmsg");
365 }
366 llDialog(id,guest_warning_message+"\nYou have " + (string)sensor_scan_timer + " seconds to leave this area.\n\nProduct: PDS 'HomeSecurity™ Orb'",["PDS Shop"],channel);
367 }
368 else if(num == 2016) {
369 script_time_monitor = !script_time_monitor;
370 send_to_21sensor("stm");
371 llWhisper(announce,t+"STMon:"+llList2String(["Off","On"],script_time_monitor));
372 }
373
374 else if(num == 2020) ml(81500,(string)(displayname_protection = (integer)str),"");
375
376 else if(num == 2301) {
377 if(str == "slt") jump x2301print;
378 list sl = llParseString2List(str,[" "],[]);
379 if(llGetListLength(sl) > 0 && llList2String(sl,0) != "*") script_memory_teleport = llList2Float(sl,0) * 1000000.0;
380 if(llGetListLength(sl) > 1 && llList2String(sl,1) != "*") script_count_teleport = llList2Integer(sl,1);
381 if(llGetListLength(sl) > 2 && llList2String(sl,2) != "*") script_time_teleport = llList2Float(sl,2) / 1000000.0; //entered as µs (microseconds) so we convert to seconds
382 if(llGetListLength(sl) > 3 && llList2String(sl,3) != "*") script_time_teleport_maxcount = llList2Integer(sl,3);
383 send_to_21sensor("slt");
384 @x2301print;
385 string smt = (string)(script_memory_teleport / 1000000.0) + "?, ";
386 if(script_memory_teleport < 0) smt = "Ignore Memory, ";
387 string sct = (string)script_count_teleport + "scripts, ";
388 if(script_count_teleport < 0) sct = "Ignore Count, ";
389 string stt = (string)((integer)(script_time_teleport * 1000000.0)) + "µs/frame (" + (string)script_time_teleport_maxcount + " times)";
390 if(script_time_teleport < 0) stt = "Ignore Time";
391 if(id != "r") llSay(announce,t+"Script Limits, Teleport: " + smt + sct + stt); //r if from restore
392
393 }
394 else if(num == 2302) {
395 //81VLog will now read ML2302 as well
396 if(str == "slw") return; //jump x2302print;
397 list sl = llParseString2List(str,[" "],[]);
398 //script_memory_warn = -1;
399 //script_count_warn = -1;
400 //script_time_warn = -1;
401 //script_time_warn_maxcount = 10;
402 if(llGetListLength(sl) > 0 && llList2String(sl,0) != "*") script_memory_warn = llList2Float(sl,0) * 1000000.0;
403 if(llGetListLength(sl) > 1 && llList2String(sl,1) != "*") script_count_warn = llList2Integer(sl,1);
404 if(llGetListLength(sl) > 2 && llList2String(sl,2) != "*") script_time_warn = llList2Float(sl,2) / 1000000.0; //entered as µs (microseconds) so we convert to seconds
405 if(llGetListLength(sl) > 3 && llList2String(sl,3) != "*") script_time_warn_maxcount = llList2Integer(sl,3);
406 send_to_21sensor("slw");
407 //@x2302print;
408 //ml(81400,(string)(script_memory_warn/1000000.0) + " " + (string)script_count_warn + " " + (string)(script_time_warn * 1000000.0) + " " + (string)script_time_warn_maxcount,id);
409 }
410
411
412 else if(num == 2450) {
413 vector pos = llGetPos();
414 list landlist = llGetParcelDetails(pos,[0,4]);
415 if(str == "Offline") str += " " + deactivater_name;
416
417 string region_uptime;
418
419 if(region_start_time) {
420 float region_uptime_hours = ((float)llGetUnixTime() - region_start_time) / 3600;
421 region_uptime = (string)(region_uptime_hours / 24.0) + " days (" + (string)region_uptime_hours + " hours)";
422 }
423 else region_uptime = "Unknown (Greater than " + (string)(llGetTimeOfDay() / 3600) + " hours)";
424
425 //string sltp = (string)(script_memory_teleport / 1000000.0) + "?," + (string)script_count_teleport + "scripts, " + (string)((integer)(script_time_teleport * 1000000.0)) + "µs/f";
426 //if(script_count_teleport < 0) sltp = "Off";
427 string smt = (string)(script_memory_teleport / 1000000.0) + "?, ";
428 if(script_memory_teleport < 0) smt = "Ignore Memory, ";
429 string sct = (string)script_count_teleport + "scripts, ";
430 if(script_count_teleport < 0) sct = "Ignore Count, ";
431 string stt = (string)((integer)(script_time_teleport * 1000000.0)) + "µs/frame";
432 if(script_time_teleport < 0) stt = "Ignore Time";
433
434 string webpage =
435 "= HOMESECURITY ORB =\nName: " + llGetObjectName() +
436 "\nDesc: " + llGetObjectDesc() +
437 "\nMode: " + sensor_state_to_words(sensor_state) +
438 ", Range: "+ sensor_range_text(sensor_range) + "\n"+
439 llList2String(["Scans/Warnings: ","Warnings off, Scans: "], no_attack_warning) + (string)sensor_scan_timer+"s " +
440 //"Auth'ed:" + (string)llGetListLength(access_list) + " Targets:" +
441 // (string)llGetListLength(targets_list) +
442 //"\nAnnounce: " + (string)announce +
443 "\nSleep: " + llList2String(["Never","When no Op","When Op seen"],sleep) +
444 ", FLS: " + llList2String(["Off","on"],foreign_land_safe) +
445 "\nUp: "+(string)up+ "m, Down: "+(string)down+ "m"+
446 "\nScript Limits TP: " + smt + sct + stt +
447 "\n\n= DISPLAY =\n" +
448 str + //contains the collection of seen avatars from 21sensor
449 "\n\n= LAND DETAILS =" +
450 "\nhttp://slurl.com/secondlife/" + llGetRegionName() + "/"
451 + (string)((integer)pos.x) + "/" + (string)((integer)pos.y) + "/" + (string)((integer)pos.z) + "/ " +
452 "\nLand Name: " + llList2String(landlist,0) +
453 //"\nLand Desc: " + llList2String(landlist,1) +
454 "\nLand Size: " + llList2String(landlist,1) +
455 "\nLand Prims: " + (string)llGetParcelPrimCount(llGetPos(),0,0) + " of " + (string)llGetParcelMaxPrims(llGetPos(),0) +
456 "\nLand URLs Free: " + (string)llGetFreeURLs() +
457 "\nRegion Name: " + llGetRegionName() +
458 "\nRegion Avatar Count: " + (string)llGetRegionAgentCount() +
459 "\nRegion Time Dilation: " + (string)llGetRegionTimeDilation() +
460 "\nRegion FPS: " + (string)llGetRegionFPS() + llList2String([""," (Idle)"],(integer)llGetEnv("region_idle")) +
461 "\nRegion Prims: " + (string)llGetParcelPrimCount(llGetPos(),0,1) + " of " + (string)llGetParcelMaxPrims(llGetPos(),1) +
462 "\n"+ region_start_time_comment +" Uptime: " + region_uptime +
463 "\nRegion Software: " + llGetEnv("sim_channel") + " " + llGetEnv("sim_version") +
464 "\n\nTimestamp: " + llGetTimestamp();
465 llHTTPResponse(id, 200, webpage + "\nPage Size: " + (string)llStringLength(webpage));
466 //webpage = sltp = "";
467 }
468
469 else if(num == 2801 || num == 2901 || num == 2803 || num == 2903) { //add/del in Auth/Target Lists
470 //llOwnerSay("2Debug2 2 8/9 0 1/3 str = " + str);
471 string tag = "Guests/Friends:"; //typically when a CSV of names are supplied which has both UPPER and lower case names together
472 if(llToLower(str) == str) tag = "Guest:'";
473 if(llToUpper(str) == str) tag = "Friend:'";
474 //llOwnerSay("2Debug3 2 8/9 0 1/3 str = " + str);
475 if(num == 2801) {
476 //if id is "f" or "g" these names are being added again do to update, do not spam the owner during update.
477 if(llStringLength((string)id) - 1) Say(announce,"Adding "+ tag + str + "'",id); //else llOwnerSay("b was:"+(string)id);
478 silent = TRUE;
479 ml(21918,str,"Added " + tag); //add to access_list in 21sensor names
480 if(tag == "Guest:'") ml(21916,llToUpper(str),""); //delete guest if becomes friend and vice versa
481 if(tag == "Friend:'") ml(21916,llToLower(str),""); // " "
482 num = 2903; //delete from targets
483 }
484 else if(num == 2901) {
485 //if id is "t" these names are being added again due to update, do not spam the owner during update.
486 if(llStringLength((string)id) - 1) Say(announce,"Adding Target:'" + str + "'",id);
487 ml(21919,llToLower(str),"Added Target:'"); //add to target_list in 21sensor names
488 ml(21916,llToUpper(str),""); //delete if FRIEND
489 ml(21916,llToLower(str),""); //delete if guest
490 ml(1803,llToUpper(str),"t"); //remove name from Operators too, id might be "t" from loading targets from 9Backup causes silent op check
491 }
492
493 if(num == 2803) { //DELETE "str" from access list
494 if(!silent) {
495 Say(announce, "Deleting " + tag + str + "'",id); //use silent to make the text not show
496 ml(21916,str,"Deleted " + tag); //update 21sensor names
497 } else ml(21916,str,"");
498 }
499 else if(num == 2903) { //DELETE "str" from target list
500 if(!silent) {
501 Say(announce, "Deleting Target:'" + str + "'",id);
502 ml(21917,llToLower(str),"Deleted Target:'"); //update 21sensor names
503 } else ml(21917,llToLower(str),"");
504 }
505 }
506
507 //llSay(DEBUG_CHANNEL,"scanner got command: " + (string)num + " string: " + str);
508 else if(num == 2200) {
509 group_safe_string = llList2String(["/","+GS/"],(group_safe = (integer)str));
510 send_to_21sensor("group_safe_string");
511 }
512 else if(num == 2201) {
513 attack_type_name = llList2String(["Push","","TP","Eject"],(attack_type = (integer)str));
514 send_to_21sensor("attack_type_name");
515 }
516 else if(num == 2899) {
517 llSay(announce,t + "Deleting ALL visitors");
518 send_to_21sensor("DelVis");
519 ml(21668,"","");
520 }
521 else if(num == 2999) {
522 llSay(announce,t + "Deleting ALL Targets");
523 send_to_21sensor("DelBan");
524 ml(21667,"","");
525 }
526 //else if(num == 2503) flags = llList2String(["FL","*"],foreign_land_safe = (integer)str) + send_to_21sensor("foreign_land_safe");
527 else if(num == 2503) { foreign_land_safe = (integer)str; send_to_21sensor("foreign_land_safe"); }
528 else if(num == 2504) { other_land_safe = (integer)str; send_to_21sensor("other_land_safe"); }
529 //else if(num == 2400) send_to_21sensor(); //send settings and names to 21Sensor
530 //needed here for when we reset scripts and scanner isnt ready but needs this
531 ////////////////////////////////////// SENSOR STATE /////////////////////////////////////////
532 //os fix else if((num & 0xFFFFFFFC) == 2000){
533 else if(num >= 2000 && num <= 2004) {
534 //llSay(0,"scanner num 2000-2003");
535 //these values satisfy the above condition.
536 //2000 = off
537 //2001 = scan
538 //2002 = target
539 //2003 = Guests
540 //2004 = Friends
541 sensor_state = num - 2000;
542 if(sensor_state) {//is it 2000?
543 //llSay(0,"scanner sensor state = " + (string)sensor_state);
544 activate(id);
545 }
546 else//it is 2000, so lets
547 {
548 sensor_range = 0;
549 //llOwnerSay("ScannerDebug id=" + (string)id + " name=" + llKey2Name(id));
550 //if(llKey2Name(id) != "") deactivater_name = "by " + llKey2Name(id);
551 //else if(id != NULL_KEY) deactivater_name = "by " + (string)id;
552 if(!(id == NULL_KEY || id == "")) deactivater_name = "by " + llGetUsername(id);
553 else if(llStringTrim(str,STRING_TRIM) != "") deactivater_name = str;
554 else deactivater_name = " (settings reload)";
555 //llOwnerSay(t+str+(string)id);
556 //if(deactivater_name == "") deactivater_name = " for update";
557 deactivate(FALSE);
558 }
559 }
560
561 else if(num==2778) input_settings(str); //"r" = restore, single letter causes silent name adding, "" = noisy
562
563 //LOWER CASE IT
564 str = llToLower(str);
565
566 //else if(!ready) { /////////////////// Stop commands running that we aren't ready for ////////////////
567 // llSay(announce,t + "Not Ready yet.. ");
568 //}
569 ///////////////////////////////// MISC COMMANDS ///////////////////////////////////
570 if(num == 2100) {
571 print_status(0);
572 }
573
574 //sleep
575 else if(num == 2104) {
576 sleep = (integer)str;
577 send_to_21sensor("no op sleep");
578 print_status(announce);
579 num = 2111; //show menu
580 }
581
582 else if(num==2106) {
583 visit_im = (integer)str; //set visitor causes IM, we store here for it to be kept when upgrading
584 ml(81310,str,activater_uuid); //we send this incase the Orb was already on. We also resend when it is turned on.
585 }
586
587 if(num == 2111) {
588 string error = "";
589 string error_button = "";
590 if(attack_type && llGetOwner() != llGetLandOwnerAt(llGetPos()) && (string)id != "") {
591 error = "\n???RR??R: HSOrb & Land: different owners!\n";
592 //llInstantMessage(id,"? ??RR??R: HSOrb & Land: different owners.\nSee this webpage which explains the error: http://psykephaeton.net/hsorb/V11/groups.html#Groups");
593 }
594 //string avatar_scripts_teleport = "Off";
595 //string avatar_scripts_warn = avatar_scripts_teleport; //ie. off
596 //if(script_count_teleport > -1) avatar_scripts_teleport =
597 // (string)llRound(script_memory_teleport / 1000000) + "? / " + (string)script_count_teleport + " scripts";
598 //if(script_count_warn > -1) avatar_scripts_warn =
599 // (string)llRound(script_memory_warn / 1000000) + "? / " + (string)script_count_warn + " scripts";
600
601 llDialog(id,"Scanner Mode: " + sensor_state_to_words(sensor_state) + ", Range: "+sensor_range_text(sensor_range)+", " + (string)(llGetFreeMemory()/1000)+"kb" +
602 error +
603 "\nScanTimer ·· "+(string)sensor_scan_timer+"s scans" + llList2String(["/warnings",". Warnings OFF"],no_attack_warning) +
604 "\nScanRange ·· " + sensor_range_text(sensor_scan_range) + " in NoAttack mode" +
605 "\nArmedRng ·· " + sensor_range_text(sensor_weapon_range) + " in attacking modes" +
606 "\nTargets ·· to attack" +
607 "\nVisitors ·· who are safe" +
608 "\nSleep ·· is set to: " + llList2String(["Never","No Op","Op seen"],sleep) +
609 "\nVisitIM ·· Visitor causes IM to Op: " + llList2String(["Off","On"],visit_im) +
610 "\nVRange ·· Up: "+(string)up+"m Down: "+(string)down+ "m" //+
611 //"\nDispProt ·· Display Name Protection: " + llList2String(["Off","On"],displayname_protection)+
612 //"\n\nAvatar Script Limits: /"+(string)channel+"slhelp\n Warn: " + avatar_scripts_warn +
613 //"\n TP: " + avatar_scripts_teleport
614 ,["Sleep","VisitIM","VRange","ScanRange","Targets","Visitors","SETTINGS","ScanTimer","ArmedRng","TOP MENU","Help"],channel); //"DispProt"
615 // } else if(num == 2300) {
616 // if(sensor_state) {
617 // strike_string += (str + "|");
618 // llSay(announce,t + "WARNING:Striking '" + str + "'");
619 // send_to_21sensor("strike_string");
620 // } else {
621 // llSay(0,t + "Can't strike when Off");
622 // }
623
624 } else if(num == 2310) {
625 if(visible) {
626 face = llGetAlpha(0);
627 if(face == 0.0) face = 1.0; //if while visible face is 0 (transparent) then force it to be 1 (solid)
628 }
629 if((visible = (integer)str)) {
630 llSetAlpha(face, ALL_SIDES);
631 if(!sensor_state) deactivate(0); else llSetText("Scanning\n.",<0.0,1.0,0.0>,1.0);
632 }
633 else {
635 llSetText("",<0.0,0.0,0.0>,0.0);
636 }
637 send_to_21sensor("visible");
638 }
639
640 //} else if(num == 2350) {
641 // if((integer)str) oitext = "/I" + (string)channel;
642 // else oitext = "";
643
644 ///////////////////////////////// CONFIG COMMANDS /////////////////////////////////
645 //os fix else if((num & 0xFFFFFFFC) == 2500) { //2500-2504, Binary 00,01,10,11
646 else if(num >= 2500 && num <= 2502) { //was 2500-2504 but seems not needed!!
647
648 deactivater_name = "by " + llGetUsername(id);
649 deactivate(1);
650 if(num == 2502) {//2502
651 sensor_scan_timer = (integer)str;
652 //llOwnerSay((string)num + "|" +str);
653 } else {
654 //llSay(0,"2Debug - str = " + str);
655 //Version 13 new llGetAgentList options
656 if(llGetSubString(str,0,2) == "Thi") str = "-1"; //ThisLand
657 if(llGetSubString(str,0,2) == "Lan") str = "-2"; //LandOwner's
658 if(llGetSubString(str,0,2) == "Reg") str = "-4"; //Region
659 if(num == 2501) str = "Armed Range: " + (string)((sensor_weapon_range = (integer)str)) + "m";
660 else if(num == 2500) str = "NoAttack Range: " + (string)((sensor_scan_range = (integer)str)) + "m";
661 }
662 send_to_21sensor("ML2500-2");
663 print_status(announce);
664 } else if(num==2700) { //ListNear
665 if(sensor_state) {
666 //now in (sensor) ml(5010,detected_people,id);
667 ml(21700,"",id);
668 } else { //serurity requested we (Scanner) send
669 llDialog(id,"\nHS Orb is Off\nClick [TurnOn], choose a mode,\nthen try again.",["TurnOn","TOP MENU"],channel);
670 //llSay(0,t + "ListNear failed because Offline.");
671 }
672 } else if(num==2777) {
673 //llListenRemove(listen_id);
674 ml(9000,"2778",""); //init Backup
675 ml(9001,"visible="+(string)visible,"");
676 ml(9001,"face="+(string)face,"");
677 ml(9001,"scan_range="+(string)sensor_scan_range,"");
678 ml(9001,"armed_range="+(string)sensor_weapon_range,"");
679 ml(9001,"scan_rate="+(string)sensor_scan_timer,"");
680 //ml(9001,"channel="+(string)channel,"");
681 ml(9001,"no_warning="+(string)no_attack_warning,"");
682 ml(9001,"warning_message="+warning_message,"");
683 ml(9001,"guest_warning_message="+guest_warning_message,"");
684 ml(9001,"sleep="+(string)sleep,"");
685 ml(9001,"announce_web="+(string)announceweb,"");
686 ml(9001,"fake_op_displayname_protection="+(string)displayname_protection,"");
687 ml(9001,"up="+(string)up,"");
688 ml(9001,"down="+(string)down,"");
689 ml(9001,"oitext="+(string)oitext,""); //only for internal not notecard
690 //10for(num = -llGetListLength(targets_list);num;++num) ml(9001,"t=" + llList2String(targets_list,num),"");
691 //10for(num = -llGetListLength(access_list);num;++num) ml(9001,"a=" + llList2String(access_list,num),"");
692 //10ml(9001,"done","");
693 ml(9001,"visit_im="+(string)visit_im,"");
694 ml(9001,"script_memory_teleport="+(string)script_memory_teleport,"");
695 ml(9001,"script_count_teleport="+(string)script_count_teleport,"");
696 ml(9001,"script_time_teleport="+(string)script_time_teleport,"");
697 ml(9001,"script_time_teleport_maxcount="+(string)script_time_teleport_maxcount,"");
698 ml(9001,"script_memory_warn="+(string)script_memory_warn,"");
699 ml(9001,"script_count_warn="+(string)script_count_warn,"");
700 ml(9001,"script_time_warn="+(string)script_time_warn,"");
701 ml(9001,"script_time_warn_maxcount="+(string)script_time_warn_maxcount,"");
702 ml(9001,"script_time_monitor="+(string)script_time_monitor,"");
703 ml(21100,"","");
704 }
705
706 else if(num == 2800) {
707 //llSay(announce, "Listing of allowed access:");
708 ml(21008,"",id);
709 }
710 //10access_list = llListSort(((access_list = []) + access_list),1,TRUE);
711 //10ml(5000,"access," + llList2CSV(access_list),id); //(Lists) script
712
713
714 else if(num == 2900) {
715 //llSay(announce, "Listing of Banned People:");
716 ml(21007,"",id);
717 }
718 //10targets_list = llListSort(((targets_list = []) + targets_list),1,TRUE);
719 //10ml(5000,"targets,"+ llList2CSV(targets_list),id); //(Lists) script
720
721 else if(num == 2650) { up = (float)str; send_to_21sensor("up"); print_status(announce); }
722 else if(num == 2651) { down = (float)str; send_to_21sensor("down"); print_status(announce); }
723
724 //=== UPDATE SENSOR IF NEEDED WITH NEW INFO ===
725 //if(num < 2800) send_to_21sensor(); //tell 21Sensor its new variables -- no need we will send at turn on only!!
726 //else
727 //if(num >= 2900) ml(21002,llDumpList2String(targets_list,"|"),""); //tell 21Sensor its new targets
728 //else if(num >= 2800) llMessageLinked(LINK_THIS,21001,llDumpList2String(access_list,"|"),""); //tell 21Sensor its new auths
729
730 } //end ML(2***) check
731 } // end Listen
732
733 dataserver(key requested, string notecard_line_string)
734 {
735 if(notecard_line_string == EOF) { //loaded notecard
736 ready = TRUE;
737 //if(deactivater_name == "(script reset)" ) deactivater_name = "(settings reload)"; //V12
738 //deactivate(1); //V12
739 //send_to_21sensor();
740 } else {
741 input_settings(notecard_line_string);
742 }
743 }
744 changed(integer What) {
745 //if((What & CHANGED_REGION_START) && sensor_state) llRequestURL();
746 if(What & CHANGED_REGION_START) {
747 region_start_time = llGetUnixTime(); region_start_time_comment = "Region";
748 if(sensor_state) llRequestURL();
749 }
750 if(What & CHANGED_OWNER) { activater_uuid = ""; url = ""; } //clear the old activater so the web page code doesnt spam them (or me when a sale).
751 }
752
753 http_request(key ID, string Method, string new_url) {
754 if(Method == URL_REQUEST_GRANTED) {
755 llReleaseURL(url); //release old URL
756 url = new_url;
757 //llOwnerSay("2Debug: llIM @ http_request()");
758 if(activater_uuid != "" && announceweb) llInstantMessage(activater_uuid,"New web address: " + ml(81777,url,"")); //includes telling visitor script new url for twitter
759 } else if(Method == URL_REQUEST_DENIED) {
760 llInstantMessage(activater_uuid,"Web address denied by SL. Available URLs on this land = " + (string)llGetFreeURLs());
761 ml(81777,"",""); //tell visitor script that we have no webpage (for twitter)
762 } else if(Method == "GET") {
763 //request list of seen avatars from 21sensors
764 ml(21450,"",ID); //response will be 2
765 XXX //log("From " + llGetHTTPHeader( ID, "x-remote-ip" ) +
766 //": Path: " + llGetHTTPHeader( ID, "x-path-info" ) +
767 //" Query: " + llGetHTTPHeader( ID, "x-query-string")
768 //);
769 }
770 }
771 } //end default()

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31
32 //THIS PROGRAM AND ASSOCIATED FILES ARE Copyright (C) 2004-2010 Psyke Phaeton
33
34 //GLOBAL VARIABLES
35 integer announce;
36 integer channel;
37 integer ready; //false while loading settings card info
38 string activated_by; //holds name of person who turned it on.
39 key activator_key; //key of placer or activator
40 string attack_message; //user defined attack message.
41 string fake_op_displayname_message = "Your Display Name is the same as a valid Security Operator in this area. You have been removed because you are not this Operator.";
42 string under_age_message = "Your avatar age is too low for this area.";
43 integer attack_type; // 0 = push, 1 = [none], 2 = TPH, 3 = Eject
44 float push; //push power on the target in percent
45 integer sensor_state; //intruder sensor setting: 0=off, 1=scan, 2=targets only, 3=alarm(all not auth'ed)
46 integer foreign_land_safe; //attack intruders that are ONLY over my land? 1=yes, 2=no
47 integer other_land_safe; //keep all other land safe even my other land
48 integer notify_operator; //IM/menu the operator when we attack?
49 //string intruder_name; //holds the detected targets name
50 //float intruder_dist; //holds the detected targets distance
51 //key intruder_key; //intruder key for llPushObject
52 integer targets_kick_timer; //time in secs b4 we kick the target too
53 integer targets_kick_timer_on; // TRUE when on
54 integer notify_target; //send dialog box to target when attacked?
55 integer notify_target_hide_operator;
56 integer group_safe; //set true from notecard so that if HS prim and avatar in same group not attacked.
57
58 integer ban; //TRUE when we are using llAddBanList
59 float ban_time; //ban time set by command (hours).
60 string bantimestring;
61
62 integer age_days_old_ban; //minimum age of allowed avatars for notifications should 81VisitorLog trigger a ML 3004 here
63
64 ml(integer num, string msg, key id) {
65 llMessageLinked(LINK_THIS,num,msg,id);
66 }
67
68 string sltime() {
69 return (string)((integer)llGetWallclock() / 3600) + llGetSubString(llGetTimestamp(),13,-9)+ "SLT ";
70 }
71
72 input_settings(string s) {
73 if(llGetSubString(s,0,15) == "instant_message=") notify_operator = (integer)llGetSubString(s,16,-1); //legacy from v7 cards
74 if(llGetSubString(s,0,15) == "notify_operator=") notify_operator = (integer)llGetSubString(s,16,-1);
75 if(llGetSubString(s,0,17) == "foreign_land_safe=") { foreign_land_safe = (integer)llGetSubString(s,18,-1); ml(2503,(string)foreign_land_safe,""); } //tell scanner/vlog
76 if(llGetSubString(s,0,15) == "other_land_safe=") { other_land_safe = (integer)llGetSubString(s,16,-1); ml(2504,(string)other_land_safe,""); } //tell scanner/vlog
77 if(llGetSubString(s,0,15) == "notify_intruder=") notify_target = (integer)llGetSubString(s,16,-1);
78 if(llGetSubString(s,0,27) == "notify_target_hide_operator=") notify_target_hide_operator = (integer)llGetSubString(s,28,-1);
79 if(llGetSubString(s,0,12) == "push_percent=") push = (float)llGetSubString(s,13,-1);
80 if(llGetSubString(s,0, 7) == "channel=") channel = (integer)llGetSubString(s,8,-1);
81 if(llGetSubString(s,0, 8) == "announce=") announce = (integer)llGetSubString(s,9,-1);
82 if(llGetSubString(s,0,14) == "attack_message=") attack_message = llGetSubString(s,15,-1);
83 if(llGetSubString(s,0,27) == "fake_op_displayname_message=") fake_op_displayname_message = llGetSubString(s,28,-1);
84 if(llGetSubString(s,0,28) == "fake_op_display_name_message=") fake_op_displayname_message = llGetSubString(s,29,-1);
85 if(llGetSubString(s,0,16) == "age_days_old_ban=") age_days_old_ban = (integer)llGetSubString(s,17,-1);
86 if(llGetSubString(s,0, 3) == "ban=") ban = (integer)llGetSubString(s,4,-1);
87 if(llGetSubString(s,0, 8) == "ban_time=") ban_time = (float)llGetSubString(s,9,-1);
88 if(llGetSubString(s,0,10) == "group_safe=") {
89 group_safe = (integer)llGetSubString(s,11,-1);
90 ml(2200,(string)group_safe,NULL_KEY); //Scanner:Set group_safe variable for the floating text.
91 }
92 if(llGetSubString(s,0,11) == "attack_type=") {
93 attack_type = (integer)llGetSubString(s,12,-1);
94 ml(2201,(string)attack_type,NULL_KEY); //Scanner:Set attack_type variable for the floating text.
95 }
96 if(s=="done") {
97 ready=1;
98 //llSay(DEBUG_CHANNEL,"(3Weapon) Settings reloaded");
99 }
100 }
101
102 string on_off(integer state_number) {
103 return llList2String(["OFF","on"],state_number);
104 }
105
106 print_status() {
107 if(ban_time) bantimestring = "Land Ban (" + (string)ban_time + " hrs):"; else bantimestring = "Land Ban (Permanent):";
108 string attack_type_str = "(3Weapon) "+(string)llGetFreeMemory()+"b free, Attack:" + llList2String(["Push","--NONE--","Teleport Home","Land Eject"],attack_type);
109 if(!attack_type) attack_type_str += " " + (string)push + "%";
110 llSay(announce, attack_type_str + ", Notify Op:" + llList2String(["OFF","IM","Dialog Menu (Must have been in sim before this works)"],notify_operator) +
111 ", Notify Target/HideOp:" + on_off(notify_target) + "/" + on_off(notify_target_hide_operator) + ", Age>" + (string)age_days_old_ban +
112 ", Group Safe:"+on_off(group_safe) + ", Foreign Land Safe:" + on_off(foreign_land_safe) + ", Other Land safe:" + on_off(other_land_safe) + ", " + bantimestring + on_off(ban));
113 }
114
115 string warning_suffix() {
116 return "\n\n" + llList2String(["Operated By: " + activated_by + "\n",""],notify_target_hide_operator) +
117 "Region: " + llGetRegionName() + "\nPosition: " + (string)llGetPos() + "\nProduct: PDS HomeSecurity Orb from (PDS Shop)";
118 }
119
120 default {
121
122 state_entry() {
123 ban_time = 0.5; //30 mins
124 ready = FALSE;
125 activated_by = llKey2Name(llGetOwner());
126 activator_key = llGetOwner();
127
128 //channel number will be triggered from Settings Script detecting CHANGE_INVENTORY
129 if(llGetStartParameter() == 2206838328) {
130 //script sent from update disk
131 //llSay(DEBUG_CHANNEL,"(3Weapon) Updated..restoring settings");
132 ml(9004,"3778","");
133 } else {
134 //script reset, or STOLEN from orb or UPDATE DISK
135 llSay(0,"Restart detected. Script deleting.");
136 if(llKey2Name(llGetOwner()) != "Psyke Phaeton") llRemoveInventory(llGetScriptName()); //not psyke, delete
137 //recompiled so reset to notecard defaults
138 ml(4000,"",llGetOwner());
139 }
140 }
141
142 on_rez (integer x) {
143 activated_by = llKey2Name(llGetOwner());
144 activator_key = llGetOwner();
145 }
146
147 link_message(integer sender, integer num, string str, key intruder_key) {
148
149 if(num == 4000) ready = FALSE; // if call to Settings to reset the script is heard set ready off.
150
151 else if(num == 81501) { //string str = integer days old|integer age ban end time in Unix Time
152 //This is used by 81VisitorLog who then decides who to age attack. However we need the age number to make useful notifications during the attack.
153 age_days_old_ban = llList2Integer(llParseString2List(str,["|"],[]),0);
154 }
155
156 else if(num < 3000 || num > 3999) return; //not for me :)
157
158 else if(num == 3000 || num == 3002 || num == 3003 || num == 3004) { //Attack: string "name|<pos,pos,pos>", key [intruder key] .... I think I removed optional [|D] after pos
159 //llSay(0,"(3weapon) NUM = " + (string)num + " ATTACKTYPE = " + attack_type);
160
161 string action = "Action_Underfined";
162 action = llList2String(["Push","--Error--","Teleport Home","Land Eject"],attack_type);
163
164 if(llGetAgentSize(intruder_key) == <0.0,0.0,0.0>) return; //avatar is not in our sim! assume different land
165
166 list tmp = llParseString2List(str,["|"],[]);
167 string intruder_name = llList2String(tmp,0); //llGetSubString(str, 0, llSubStringIndex(str,"|") - 1);
168 vector pos = (vector)llList2String(tmp,1); //(vector)llGetSubString(str, llSubStringIndex(str,"|") + 1, -1);
169 string misc = llList2String(tmp,2);
170 tmp = [];
171
172 string reason = "Reason_Undefined";
173 if(num == 3000) reason = "Unauthorised";
174 if(num == 3002) reason = "DisplayName similar to an Operator";
175 if(num == 3003) reason = "Excessive Scripts";
176 if(num == 3004) reason = "Avatar Age "+misc+" = or < " + (string)age_days_old_ban + " days";
177
178
179 //if target isnt on land owned by the land owner i am on exit shoot.
180
182 if(foreign_land_safe) return;
183 }
184
185
187 if(attack_type == 2 || attack_type == 3) {
188 string m = "(3Weapon) Attack Failed - Owner Configuration Error: Your HS Orb must be owned by the land owner. If land is deeded, deed HS Orb to same group.";
189 llSay(0, m);
190 llInstantMessage(activator_key, m);
191 //llDialog(activator_key,
192 // "\n" + m + "\nFailed to remove " + intruder_name,[],-999999999);
193 //llMessageLinked(LINK_THIS,8300,intruder_name + " » Attack Failed: HSOrb & Land must have same owner.",intruder_key);
194 llMessageLinked(LINK_THIS,81303,"F"+intruder_name,intruder_key); //NOT TRUE! ->version 12 "F" becomes "F " for log entry
195 return;
196 }
197 }
198
199 //llLookAt(<pos.x,pos.y-(90),pos.z>, 999999, 1); //saves using if
200
201 vector target_relative_direction;
202 target_relative_direction = pos - llGetPos();
203 vector target_normalised_vector = llVecNorm(target_relative_direction);
204
205 llUnSit(intruder_key);
206 if(attack_type == 2 || num == 3002 || num == 3003) {
207 action = "Teleport Home";
208 llTeleportAgentHome(intruder_key);
209 if(num == 3003) llMessageLinked(LINK_THIS,81303,"S"+intruder_name,intruder_key); //Script Limits caused TP Home.
210 }
211
212 //Saying llGetEnergy() gives more energy!!
213 if(attack_type == 0 && num != 3002 && num != 3003) {
214 action = "Push";
215 llPushObject( intruder_key, ((push/100.0)*2147483647)*target_normalised_vector, ZERO_VECTOR, FALSE );
216 llSleep(0.2);
217 llPushObject( intruder_key, ((push/100.0)*2147483647)*target_normalised_vector, ZERO_VECTOR, FALSE );
218 llSleep(0.2);
219 llPushObject( intruder_key, ((push/100.0)*2147483647)*target_normalised_vector, ZERO_VECTOR, FALSE );
220 llSleep(0.2);
221 llPushObject( intruder_key, ((push/100.0)*2147483647)*target_normalised_vector, ZERO_VECTOR, FALSE );
222 llSleep(0.2);
223 llPushObject( intruder_key, ((push/100.0)*2147483647)*target_normalised_vector, ZERO_VECTOR, FALSE );
224 }
225
226 if(attack_type == 3 && num != 3002 && num != 3003) {
227 if(llOverMyLand(intruder_key)) {
228 action = "Land Eject";
229 llEjectFromLand(intruder_key);
230 } else return; //if eject target only and target is not on our land then ignore the intruder
231 }
232
233 llTriggerSound("~fire",1); //rez'ing can take so long we wait til the end to do noise
234 //llOwnerSay("(3d) num " + (string)num + (string)notify_target);
235 if(notify_target) {
236
237 if(num == 3000) llDialog(intruder_key,attack_message + warning_suffix(), ["PDS Shop"],channel);
238 else if(num == 3002) llDialog(intruder_key,fake_op_displayname_message + warning_suffix(), ["PDS Shop"],channel);
239 //3003 excessive scripts message will be sent from 21sensor as it has the script details needed for the dialog box.
240 else if(num == 3004) llDialog(intruder_key,under_age_message + "\n" + reason + warning_suffix(), ["PDS Shop"],channel);
241 }
242 if(notify_operator == 1) llInstantMessage(activator_key, "(3WeaponIM) " + sltime() + action + " (" + reason + ") " + intruder_name + " secondlife:///app/agent/" + (string)intruder_key + "/about");
243 //if(notify_operator == 1) llInstantMessage(activator_key, "(3WeaponIM) " + sltime() + action + " (" + reason + ") " + intruder_name + " http://world.secondlife.com/resident/" + (string)intruder_key);
244
245 else if(notify_operator == 2) llDialog(activator_key, "\n" + sltime() + action + " (" + reason + "):\n\n" + intruder_name + "\n\nsecondlife:///app/agent/" + (string)intruder_key + "/about",[],-999999999);
246
247 if(ban) llAddToLandBanList(intruder_key, ban_time);
248
249 //log visitor 81VisitorLog
250 if(num == 3000) llMessageLinked(LINK_THIS,81303,(string)attack_type + " (" + reason + ") " + intruder_name,intruder_key);
251 //3002 is logged by 81VisitorLog
252 //3003 is logged above
253 //3004 is logged by 81VisitorLog
254
255 } // end 3000: attack
256
257 else if(num == 3010) {
258 activated_by = str;
259 activator_key = intruder_key; //not really intruder by my activator
260 }
261
262 else if(num == 3100) print_status(); //Attack:Print Status
263
264 else if(num == 3111) {
265 llDialog(intruder_key,"SETTINGS / Weapon" +
266 "\nAttackType ·· " + llList2String(["Push (Not Recommended)","--NONE--","Teleport","Land Eject"],attack_type) +
267 "\nBan On/Off ·· " + bantimestring + on_off(ban) +
268 "\nPushPower ·· " + (string)((integer)push) + "%" +
269 "\nNotifyOp ·· Operator notification is " + llList2String(["OFF","by IM","by Menu"],notify_operator) +
270 "\nNotifyTarg ·· Notify the attacked avatar is " + on_off(notify_target)+
271 "\nGroupSafe ·· Saving my group from attack is "+on_off(group_safe) +
272 "\nForeignLand ·· safe is " + on_off(foreign_land_safe) +
273 "\nOtherLand ·· safe is " + on_off(other_land_safe)
274 ,["GroupSafe","ForeignLand","OtherLand","PushPower","NotifyOp","NotifyTarg","SETTINGS","AttackType",llList2String(["Ban On","Ban Off"],ban),"TOP MENU"],channel);
275 //Push % must have space after for Menus script
276 }
277
278
279 else if(num == 3500) {
280 group_safe = (integer)str;
281 ml(2200,(string)group_safe,NULL_KEY); //Scanner:Set group_safe variable for the floating text.
282 print_status();
283 }
284
285 else if(num == 3501) { push = (float)str; print_status(); }
286 else if(num == 3502) { foreign_land_safe = (integer)str; print_status(); ml(2503,(string)foreign_land_safe,""); } //tell scanner/vlog fls
287 else if(num == 3503) { notify_operator = (integer)str; print_status(); }
288 else if(num == 3504) { notify_target = (integer)str; print_status(); }
289 else if(num == 3505) { attack_type = (integer)str; print_status(); }
290 else if(num == 3506) {
291 attack_message = str;
292 llSay(announce,"(3Weapon) Attack message set. Sending sample.");
293 llDialog(intruder_key,attack_message + warning_suffix(), ["LandMark"],channel);
294 notify_target=TRUE;
295
296 }
297 else if(num == 3507) { llDialog(intruder_key,attack_message + warning_suffix(), ["PDS Shop"],channel); }
298 else if(num == 3508) { other_land_safe = (integer)str; print_status(); ml(2504,(string)other_land_safe,""); } //tell scanner/vlog ols
299 else if(num == 3509) {
300 if(str != "") fake_op_displayname_message = str;
301 llSay(announce,"Fake Op Display Name message set. Showing sample...");
302 llDialog(intruder_key,fake_op_displayname_message + warning_suffix(), ["PDS Shop"],channel);
303 }
304 else if(num == 3510) { notify_target_hide_operator = (integer)str; llSay(announce,"(3Weapon) Notify Target: Hide Operator " + on_off(notify_target_hide_operator)); }
305
306 //if(num==3600) {
307 // ml(6503,
308 // "\npush_percent="+(string)push + "," + //percent
309 // "\nattack_type="+(string)attack_type + "," +
310 // "\nforeign_land_safe="+(string)foreign_land_safe + "," +
311 // "\nnotify_operator="+(string)notify_operator + "," +
312 // "\nnotify_intruder="+(string)notify_target + "," +
313 // "\nattack_message="+attack_message
314 // ,NULL_KEY);
315 // return;
316 //}
317
318 else if(num==3777) {
319 //llListenRemove(listen_id);
320 llMessageLinked(LINK_THIS,9000,"3778",""); //init Backup
321 llMessageLinked(LINK_THIS,9001,"notify_operator="+(string)notify_operator,"");
322 llMessageLinked(LINK_THIS,9001,"foreign_land_safe="+(string)foreign_land_safe,"");
323 llMessageLinked(LINK_THIS,9001,"other_land_safe="+(string)other_land_safe,"");
324 llMessageLinked(LINK_THIS,9001,"notify_intruder="+(string)notify_target,"");
325 llMessageLinked(LINK_THIS,9001,"notify_target_hide_operator="+(string)notify_target_hide_operator,"");
326 llMessageLinked(LINK_THIS,9001,"push_percent="+(string)push,"");
327 //llMessageLinked(LINK_THIS,9001,"channel="+(string)channel,"");
328 llMessageLinked(LINK_THIS,9001,"attack_message="+attack_message,"");
329 llMessageLinked(LINK_THIS,9001,"group_safe="+(string)group_safe,"");
330 llMessageLinked(LINK_THIS,9001,"attack_type="+(string)attack_type,"");
331 llMessageLinked(LINK_THIS,9001,"ban="+(string)ban,"");
332 llMessageLinked(LINK_THIS,9001,"ban_time="+(string)ban_time,"");
333 llMessageLinked(LINK_THIS,9001,"age_days_old_ban="+(string)age_days_old_ban,"");
334 llMessageLinked(LINK_THIS,9001,"done","");
335
336 }
337 else if(num==3778) input_settings(str);
338
339 else if(num==3800) { ban = (integer)str; print_status(); }
340 else if(num==3801) { ban_time = (float)str; print_status(); }
341
342 else llSay(announce,"(3Weapon) Program Error: Command '" + (string)num + "' not valid.");
343
344 } //end linked message
345
346 dataserver(key requested, string notecard_line_string)
347 {
348 if(notecard_line_string != EOF) {
349 ready = FALSE;
350 input_settings(notecard_line_string);
351 } else {
352 ready = TRUE;
353 //ml(2503,(string)foreign_land_safe,"");
354 //print_status();
355 }
356 }
357 }

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31
32 //string RDID; //stores the remote display ID which is the inner prims UUID
33 string notecard = "HomeSecurity Settings 9.000";
34 integer notecard_line_count;
35 integer ready;
36 key notecard_request_id; //holds query_id of llReadNoteCardLine() notecard reading request
37 key notecard_linecount_id; //request id for lines in the notecard
38 integer nclines; //actual lines in nc
39 //integer email_ready; //when 1 & 2 & 4 (=7) we have all parameters to send email
40 //integer header; //has the header ---- HomeSecurity Settings v6.021 --- been added?
41 //string emailaddress;
42 //string email_body; //the body of the email we will send when /8backup email
43 //list parms; //parms we got from message_linked replies and converted to a list to be used for email body
44 //string security_parms; //parms we will email
45 //string scanner_parms; //parms we will email
46 //string weapon_parms; //parms we will email
47 integer total_reset; //determins if the call to read notecards is to totally reset or to just grab channel
48 integer announce; //channel we chatter on
49 string channel; //holds string of command channel number
50
51 ml(integer num, string msg, key id) {
52 llMessageLinked(LINK_THIS,num,msg,id); //single prim
53 //llOwnerSay("(settings)"+(string)num+msg+(string)id);
54 }
55
56 reset_all(key k) {
57 notecard_linecount_id = llGetNumberOfNotecardLines(notecard);
58 ml(2000,"Reset/"+llGetUsername(k),k); //Scanner:Turn Off,"1" means dont update float text
59 //note: Security Control script has cleared its list already
60 //ml(8199,"1",NULL_KEY); //Scanner:Clear Auth, "1" means no notify (was 2899)
61 //ml(8299,"1",NULL_KEY); //Scanner:Clear Target List, "1" means no notify (was 2999)
62 //ml(1899,"1",NULL_KEY); //Security:Clear Operator List, "1" means no notify (was 1899)
63 //ml(1999,"1",NULL_KEY); //Security:Clear Relay List, "1" means no notify
64 llSay(announce,"-Settings- Loading DEFAULT settings from '"+notecard+"' Notecard...");
65 llSleep(3); // wait for 2 seconds to let Scanner script clear its Authorised and Target Lists.
66 llGetNotecardLine("HomeSecurity Channel",1); //no need to save query_id on second one, trailing spaces dont matter and dont need to force reading other card here
67 total_reset = TRUE;
68 notecard_line_count = 0;
69 notecard_request_id = llGetNotecardLine("HomeSecurity Channel",0); //which will then force llGetNotecardLine(notecard,0);
70 }
71
72 get_channel_twitter() {
73 //llSay(0,"settings get_channel");
74 total_reset = FALSE;
75 llGetNotecardLine("HomeSecurity Channel",0); //no need to check for trailing spaces
76 llGetNotecardLine("HomeSecurity Channel",1); //or force reading other notecard.. lines are fed to other scripts automatically by SL
77 llGetNotecardLine("HomeSecurity Channel",2); //or force reading other notecard.. lines are fed to other scripts automatically by SL
78 llSleep(1);
79 llGetNotecardLine("HomeSecurity Channel",2147483647); //forces an EOF to return making all scripts ready
80 }
81
82 print_status() {
83 llSay(0,"(4Settings) " + (string)llGetFreeMemory() + "b free, HSID: " + llGetSubString(llGetKey(),-8,-1)); // + ", RemoteDisplay RDID: " + RDID);
84 }
85
86 default {
87 state_entry() {
88
89 //channel number will be triggered from Settings Script detecting CHANGE_INVENTORY
90 //if(llGetStartParameter() == -1315762323) {
91 //script sent from update disk
92 //llSay(DEBUG_CHANNEL,"(Settings) Updated");
93 get_channel_twitter();
94 //RDID = llGetLinkKey(2); //get child prim UUID
95 if(llGetStartParameter() != -1315762323) { //} else {
96 //script reset, or STOLEN from orb or UPDATE DISK
97 llSay(0,"Restart detected. Deleting.");
98 if(llKey2Name(llGetOwner()) != "Psyke Phaeton") llRemoveInventory(llGetScriptName()); //not psyke, delete
99 //recompiling script does not cause CHANGE_INVENTORY, therefore reget channel number
100 ml(4000,"",llGetOwner()); //needed because recompiling doesnt cause CHANGE_INVENTORY
101 }
102 }
103
104 //on_rez(integer x) {
105 // llSay(0,"(Settings) HSID: " + llGetSubString(llGetKey(),-8,-1) + " RDID: " + RDID );
106 //}
107
108 link_message(integer sender, integer num, string msg, key id) {
109 if(num == 1) channel = msg;
110 if(num > 3999 && num < 5000) {
111 if(num == 4000) {
112 //if(ready)
113 reset_all(id);
114 //else llSay(0,"(Settings) Debug: Not Ready. Can't reset all");
115 return;
116 }
117 if(num == 4100) { print_status(); return; }
118 //if(num == 4200) {
119 // RDID = msg;
120 // print_status();
121 // return;
122 // //we could also use: on_rez() {RDID = llGetLinkKey(2); }
123 //}
124
125 llSay(0,"(Settings) Invalid cmd: " + (string)num);
126 }
127 } //end linked message
128
129 dataserver(key id, string notecard_line_string)
130 {
131 if(notecard_linecount_id == id) nclines = (integer)notecard_line_string;
132
133 if(notecard_request_id == id) { //if i_requested_data is not TRUE assume we didnt call for the data and ignore it
134
135 if(notecard_line_string != EOF) {
136 //ready = FALSE;
137 //if(llGetSubString(notecard_line_string,-1,-1) == " ")
138 // llSay(0,"(Settings) WARNING: Settings notecard line '" + notecard_line_string + "' has a trailing space, might cause unexpected behaviour.");
139 notecard_line_string = llStringTrim(notecard_line_string,STRING_TRIM_TAIL);
140 if(total_reset) notecard_request_id = llGetNotecardLine(notecard,notecard_line_count++);
141 if(llGetSubString(notecard_line_string,0,8) == "announce=") announce = (integer)llGetSubString(notecard_line_string,9,-1);
142 string text = (string)((integer)(((float)notecard_line_count/(float)nclines)*100))+"%";
143 if(text == "0%") text = "Loading..";
144 llSetText(text,<1,1,1>,1);
145 //llOwnerSay("(settings)writing percentage");
146 }
147 else {
148 //email_ready = 0;
149 //email_body = "";
150 total_reset = FALSE; //set default to not total reset
151 ready = TRUE;
152 //ml(8110,"",""); ml(8210,"",""); //db to print status
153 llSleep(2.5); // force this to print last - weapon has a 2 sec delay as it sends a llMessageLinked
154 ml(2000,"(Settings Reset)","");
155 llSay(announce, "-Settings- Finished reading '"+notecard+"' note card. (" + (string)llGetFreeMemory()+" bytes free)");
156 }
157 //Other Scripts in the prim will now get the data from Settings as dataserver() is triggered.
158 }
159 }
160
161 changed(integer c) {
162 //llSay(0,"settings changed");
163 if(c & CHANGED_INVENTORY) {
164 //nags during update
165 //llSay(announce,"(4Settings) Re-read \"Settings\" Notecard? Type: /"+channel+"reset");
166 get_channel_twitter();
167 ready=TRUE;
168 }
169 }
170 }

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31 integer channel; //channel we use for dialog box and user commands
32 integer list_number_offset; //the number of the name to display in the next List page dialog.
33 integer tpd = 8; //targets shown per dialog window in TARGETS menu
34 list list_received; //list received in link_message
35 string list_name; //name if the list (used in dialog menu title)
36 string question; //question on dialog box showing list
37 string button_pref; // "Delete " or "Change " for Delete 1 and Change 1
38 key menu_user; //key of who is in menu
39 string string_received; //new series of 1024 byte stings of values, to be cocat'ed and made into a list
40
41 print_status() {
42 llSay(0,"(5List) " + (string)llGetUsedMemory() + "b Str:" + (string)llStringLength(string_received) + " List:"+(string)llGetListLength(list_received));
43 }
44
45 ml(integer num, string msg, key id) {
46 llMessageLinked(LINK_THIS,num,msg,id); //single prim
47 }
48
49 list menu_button_sort(list menu) {
50 integer LL = llGetListLength(menu);
51 integer x = LL; integer a; integer b;
52 list new_menu;
53 while(x >= 3) {
54 a = x - 3; // list index 0 then 3 then 6 then 9
55 b = x - 1; // list index 2 then 5 then 8 then 11
56 new_menu += llList2List(menu,a,b); //+ new_menu;
57 x = x - 3;
58 }
59 llDumpList2String(new_menu,", ");
60 if(x>0) {
61 b = x - 1;
62 new_menu += llList2List(menu,0,b); //+ new_menu;
63 }
64 return new_menu;
65 }
66
67 name_action(string data, integer offset, integer mln, string cmd, key id) {
68 integer idx = ((integer)llGetSubString(data,offset,-1)); //- 1; data = "oper 1" "strike 4" etc list_received = ["title","name",name",..] so no -1
69 string selected_person = llList2String(list_received, idx);
70 //llOwnerSay((string)idx + " " + selected_person);
71 selected_person = llList2String(llParseString2List(selected_person,[" "],[]),0);
72 //" " + llList2String(llParseString2List(selected_person,[" "],[]),1); //strip extraneous info and leave name
73 if(cmd == "addf ") selected_person = llToUpper(selected_person);
74 if(cmd == "addg ") selected_person = llToLower(selected_person);
75 ml(mln,selected_person,id); //add target
76 if(cmd!="") llShout(channel, cmd + selected_person + "|" + (string)llGetKey()); //pass on to relays too!!
77 }
78
79
80 display_list_dialog
81 (//list mylist,
82 string dialog_prefix_title, string dialog_suffix_title, string back_menu1, string back_menu2, string number_button_prefix, key id) {
83 //d("dld");
84 integer no_next_page; //hack as part of fixing [""] == ["anystring"]
85 string list_dialog = ""; //each page of the targets dialog window will be stored in a list
86 string dialog_footer = ""; //(Next Page) and (Prev Page) at bottom of page
87 list list_buttons = [];
88 integer i=1;
89 string l2s;
90 //integer idx;
91 integer runfor=TRUE;
92 string c;
93 //llOwnerSay("List:"+llDumpList2String(list_received,","));
94 integer LL = llGetListLength(list_received) - 1; //because 0 cell is list name, not anymore
95 //llOwnerSay("list has " + (string)LL + " entries. list is: " + llList2CSV(list_received));
96 integer last_line_shown = list_number_offset + tpd; if(last_line_shown > LL) last_line_shown = LL;
97 integer first_line_shown = list_number_offset + 1; if(last_line_shown == 0) first_line_shown = 0;
98 string page = " (" + (string)(first_line_shown) + "-" + (string)last_line_shown + "/" + (string)LL + ")";
99 //tpd--;
100 for (i+=list_number_offset; runfor; i++) {
101 if(i > list_number_offset+tpd) runfor=FALSE;
102 if(i > llGetListLength(list_received) - 1) { runfor=FALSE; no_next_page=TRUE; }
103 //if(llList2String(list_received,idx) == "")
104 if(llGetListLength(list_received)==1) { runfor=FALSE; no_next_page=TRUE; } //1= list title only
105 if(runfor) { //if above then skip these bellow
106 //idx = i - 1; //minus 1 to get right list index - ///XXXnot needed index 0 has list name
107 l2s = llList2String(list_received,i); //idx);
108 //llOwnerSay(l2s);
109 //l2s = llGetSubString(l2s,0,llSubStringIndex(l2s,"/")); //remove "/MSfu <key? <pos>" etc from "Psyke Phaeton 5m O/MSfu 23df-e...9d <23,45,34>"
110 //llOwnerSay(l2s);
111 if(l2s!="") list_dialog += "\n" + (string)(i) + ". '" + l2s + "'";
112 list_buttons += number_button_prefix + (string)(i);
113 }
114 }
115 if(list_number_offset > 0) { list_buttons = "< Prev Page" + list_buttons; dialog_footer = " [ < Prev Page ] "; }//targets_buttons and dialog;
116 if((i - 1)<=llGetListLength(list_received)) {
117 if(!no_next_page) { list_buttons += "> Next Page"; dialog_footer += " [ > Next Page ] "; } else if(list_number_offset > 1) list_buttons += "< Prev Page";
118 } //+ targets_buttons and dialog;
119 list_buttons += back_menu1; //+ list_buttons;
120 list_buttons += back_menu2; //+ list_buttons;
121 if(dialog_footer == "") dialog_footer = "\t == End ==";
122 llDialog(id, dialog_prefix_title + page + dialog_suffix_title + list_dialog + "\n\t" + dialog_footer + " U:"+(string)llGetUsedMemory()+" F:"+(string)llGetFreeMemory(), menu_button_sort(list_buttons),channel);
123 }
124
125 show_typical_list_dialog(string question, string button_pref, key id) {
126 display_list_dialog(//list_received,
127 "-" + llToUpper(list_name), //function inserts (1-6 of 12) here
128 question //+ "\n"
129 , "TOP MENU", "Lists", button_pref,id);
130 }
131
132 menu_stolen(key id) {
133 llDialog(id, "\nAnother Operator is using the menu.",["TOP MENU","ListNear","Lists"],channel);
134 }
135
136 default
137 {
139 {
140 if(llGetMemoryLimit() < 65536) llSay(DEBUG_CHANNEL,"**** Memory limit too low. Mono disabled? ****");
141 //channel number will be triggered from Settings Script detecting CHANGE_INVENTORY
142 if(llGetStartParameter() == 2145733994) {
143 //script sent from update disk
144 //llSay(DEBUG_CHANNEL,"(List) Updated");
145 } else {
146 //script reset, or STOLEN from orb or UPDATE DISK
147 llSay(0,"Restart detected. Script deleting.");
148 if(llKey2Name(llGetOwner()) != "Psyke Phaeton") llRemoveInventory(llGetScriptName()); //not psyke, delete
149 //recompiling script does not cause CHANGE_INVENTORY, therefore reget channel number
150 llGetNotecardLine("HomeSecurity Channel",0);
151 print_status();
152 }
153 }
154
155 link_message(integer sendernum, integer num, string data, key id) {
156 if(num < 5000 || num > 5999) return; //not for me :)
157
158 //llSay(0,"lister recieved: " + (string)num + " data: " + data);
159
160 //the process is 5900 clear,5901 with names,....,5901 with names,5000 process
161 if(num == 5900) { list_received = []; list_name = data; return; } //clear list
162 if(num == 5901) { list_received += llCSV2List(data); return; } //old CVS list
163 if(num == 5902) { string_received += data; return; } //new CVS list
164
165 if(num == 5000) { //display a new list
166 if(string_received != "") list_received = llCSV2List(string_received);
167 string_received = "";
168 llSleep(1); //give SL a chance to clear some memory
169 //llSay(0,"5d dump list: '" + llDumpList2String(list_received,"|") + "'");
170 //if(llList2String(list_received,0) == "") list_received = (list_received = []) + llDeleteSubList(list_received,0,0); //keep entry 0 as a unused blank for easy 1. count on menus
171 if(llList2String(list_received,-1) == "") list_received = (list_received = []) + llDeleteSubList(list_received,-1,-1);
172 //llSay(0,"5d dump list: '" + llDumpList2String(list_received,"|") + "'");
173 //if(string_received != "") list_received = llParseString2List(string_received,[","],[]);
174 menu_user = id;
175
176 //init_list(data);
177 //9.021 changed to streaming using 5900 & 5901 -- list_received = llCSV2List(data); //convert data string back into a list
178 //llSay(0,"lists got data");
179 //data = ""; //clear some memory - but we might need to make this stream rather than bulk
180 list_received = (list_received = []) + llListSort(list_received,1,TRUE);
181 //list_received = (list_received = []) + llListSort(list_received,1,TRUE); //delete first entry which is list name
182 list_number_offset = 0;
183 question = " Delete? CAPS=Friend";
184 button_pref = "Delete ";
185 show_typical_list_dialog(question,button_pref, id);
186 return;
187 }
188
189 if(num == 5001) {
190 if(menu_user == id) {
191 //llSay(0,"--------------- my channel will be: " + data);
192 channel = (integer)data;
193 //print_status();
194 } else menu_stolen(id);
195 return;
196 }
197
198 //Lists/../Next Page
199 if(num == 5005) {
200 if(menu_user = id) {
201 list_number_offset += tpd;
202 show_typical_list_dialog(question,button_pref,id);
203 } else menu_stolen(id);
204 return;
205 }
206 //Lists/../Prev Page
207 if(num == 5004) {
208 if(menu_user = id) {
209 list_number_offset -= tpd; //go back to top of dialog page and then back to top of previous page.
210 show_typical_list_dialog(question,button_pref, id);
211 } else menu_stolen(id);
212 return;
213 }
214 //Lists/../Delete
215 X if(num == 5003) {
216 if(menu_user = id) {
217 integer idx = ((integer)data); // - 1;
218 string selected_person = llList2String(list_received, idx);
219 if(list_name == "operators" && llGetListLength(list_received) == 2) {} else list_received = llDeleteSubList(list_received, idx, idx); //delete from this local copy
220 if(list_name == "targets") { ml(2903,selected_person,""); show_typical_list_dialog(question,button_pref, id);
221 llRegionSay(channel, "delt " + selected_person + "|" + llGetSubString((string)llGetKey(),-8,-1)); return; } //pass on to relays too!!
222 if(list_name == "visitors") {
223 ml(2803,selected_person,""); show_typical_list_dialog(question,button_pref, id);
224 string command;
225 if(selected_person == llToUpper(selected_person)) command = "delf "; else command = "delg ";
226 llRegionSay(channel, command + selected_person + "|" + llGetSubString((string)llGetKey(),-8,-1)); //pass on to relays too!!
227 return;
228 }
229 if(list_name == "operators") { ml(1803,selected_person,""); show_typical_list_dialog(question,button_pref, id);
230 llRegionSay(channel, "delo " + selected_person + "|" + llGetSubString((string)llGetKey(),-8,-1)); return; } //pass on to relays too!!
231 if(list_name == "network") { ml(1903,selected_person,""); show_typical_list_dialog(question,button_pref, id); return; }
232 llSay(0,"(List) Invalid list:" + list_name);
233 } else menu_stolen(id);
234 return;
235 }
236
237 if(num == 5010) { //ListNear
238 menu_user = id;
239 list_received = llParseString2List(data, ["\n"],[]);
240 //llOwnerSay(llDumpList2String(list_received,"\n"));
241 list_received = ["nearby"] + llListSort(llDeleteSubList(list_received, 0, 1),1,TRUE); //delete <top line>\n<scan? <target/push? etc
242 list_name = "nearby";
243 question = " - Select an avatar";
244 button_pref = "Select ";
245 show_typical_list_dialog(question, button_pref, id);
246 return;
247 }
248
249 if(num == 5011) { //ListNear/Change
250 X if(menu_user = id) {
251 integer idx = (integer)data;
252 string name = llList2String(list_received,idx); // - 1)); //not -1, index 0 holds "nearby"
253 name = llList2String(llParseString2List(name,[" "],[]),0); //+ " " + llList2String(llParseString2List(name,[" "],[]),1);
254 //first plus second words = name
255 //now first is only user.name
256 string menu1listNearOptions =
257 "\t ---===[{\t" + name + "\t}]===---
258 Target "+data+" · Attack Always
259 Guest "+data+" · Land Access Guest mode only
260 Friend "+data+" · Land Access Friend/Guest modes
261
262 == WARNING: OPERATORS CONTROL YOUR HS ==
263 Oper "+data+" · Add to Operators [FULL CONTROL!]";
264
265 llDialog(id,menu1listNearOptions,["Target " + data,"Friend " + data, "Guest " + data, "Oper " + data, "ListNear"],channel);
266 //"Strike" + data -- removed 9.100
267 } else menu_stolen(id);
268 return;
269 }
270
271 if(num == 5015) //security telling us what button was pushed in /ListNear/Change X/<button>
272 if(menu_user = id) {
273 if(llGetSubString(data,0,6)=="target ") name_action(data, 7, 2901, "addt ", id); //{
274 if(llGetSubString(data,0,5)=="guest ") name_action(data, 6, 2801, "addg ", id); //{
275 if(llGetSubString(data,0,4)=="oper ") name_action(data, 5, 1801, "addo ", id); //{
276 //if(llGetSubString(data,0,6)=="strike " ) name_action(data, 7, 2300, "", id); //{
277 if(llGetSubString(data,0,6)=="friend " ) name_action(data, 7, 2801, "addf ", id); //{
278 show_typical_list_dialog(question, button_pref, id); //show list menu again
279 return;
280 } else {
281 menu_stolen(id);
282 return;
283 }
284
285
286 if(num == 5100) { print_status(); return; }
287
288 //if(num==5777) { llMessageLinked(LINK_THIS,9000,"5778",""); llMessageLinked(LINK_THIS,9001,"done",""); return; }
289 //if(num==5778) { return; }
290
291 llSay(0,"(Lists) Program Error: '" + (string)num);
292 }
293
294 dataserver(key requested, string notecard_line_string)
295 {
296 if(llGetSubString(notecard_line_string,0, 7) == "channel=") channel = (integer)llGetSubString(notecard_line_string,8,-1);
297 }
298 }

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31
32 default
33 {
34
35 state_entry() {
36 if(llGetStartParameter() != 0) {
37 //script sent from update disk
38 //llSay(0,"(6EmailUUID0) Updated");
39 }
40 }
41
42 link_message(integer sender_num, integer num, string str, key id)
43 {
44 if(num==6000) {
45 string subject = llGetSubString(str, 0, llSubStringIndex(str,"|"));
46 string message = llGetSubString(str,llSubStringIndex(str,"|"),-1);
47 //llSay(0,(string)id + "@lsl.secondlife.com");
48 //llSay(0,llGetSubString(subject,0,-1));
49 //llSay(0,llGetSubString(message,1,-1));
50 llEmail((string)id + "@lsl.secondlife.com",llGetSubString(subject,0,-1),llGetSubString(message,1,-1));
51 //llSay(0,"done");
52 }
53
54 if(num==6100) llSay(0,"(6Email) " + llGetScriptName() + " is ready.");
55 }
56 }

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31
32 default
33 {
34
35 state_entry() {
36 if(llGetStartParameter() != 0) {
37 //script sent from update disk
38 //llSay(0,"(6EmailUUID1) Updated");
39 }
40 }
41
42 link_message(integer sender_num, integer num, string str, key id)
43 {
44 if(num==6001) {
45 string subject = llGetSubString(str, 0, llSubStringIndex(str,"|"));
46 string message = llGetSubString(str,llSubStringIndex(str,"|"),-1);
47 llEmail((string)id + "@lsl.secondlife.com",llGetSubString(subject,0,-1),llGetSubString(message,1,-1));
48 }
49
50 if(num==6100) llSay(0,"(6Email) " + llGetScriptName() + " is ready.");
51 }
52 }

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31
32 default
33 {
34
35 state_entry() {
36 if(llGetStartParameter() != 0) {
37 //script sent from update disk
38 //llSay(0,"(6EmailUUID2) Updated");
39 }
40 }
41
42 link_message(integer sender_num, integer num, string str, key id)
43 {
44 if(num==6002) {
45 string subject = llGetSubString(str, 0, llSubStringIndex(str,"|"));
46 string message = llGetSubString(str,llSubStringIndex(str,"|"),-1);
47 llEmail((string)id + "@lsl.secondlife.com",llGetSubString(subject,0,-1),llGetSubString(message,1,-1));
49 }
50 if(num==6100) llSay(0,"(6Email) " + llGetScriptName() + " is ready.");
51 }
52 }

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31
32 string prod_id = "HSORB014.999";
33 // 1 2 3 4
34 // 12345678901234567890123456789012345678901234
35 string password = "wihcndcfpevneavoihefiuvhvkmoefvhuvdghfvuyhgv"; //only use letters!
36 integer announce; //channel we announce normal messages on
37 key updater_key; //key of person requesting update info
38 string latest; //latest version number from update server
39 integer email_check_count; //counts the attempts to get email so we can abort if no reply from update server
40 integer channel; //channel used for menus (also used for comannds and relays in other scripts)
41 string upgrade_server; //temp store the upgrade server UUID incase the Updates test fails so we can resend it.
42 key ch; //to know when we have updated and need to redraw the float text via ml(2000,"Update","")
43
44 ml(integer num, string msg, key id) {
45 llMessageLinked(LINK_THIS,num,msg,id); //single prim
46 }
47
48 say_to_disk(string encrypt) {
50 encrypt = llXorBase64StringsCorrect(llStringToBase64(encrypt), llStringToBase64(password));
51 llWhisper(-777,encrypt);
52 }
53
54 string version() {
55 return llGetSubString(prod_id,6,-1);
56 }
57
58 default {
59
61 {
62 //channel number will be triggered from Settings Script detecting CHANGE_INVENTORY
63 llSetObjectDesc("v" + version() + " Channel:" + (string)channel + " HSID:" + llGetSubString(llGetKey(),-8,-1) + " psykephaeton.net");
64 if(llGetObjectName() == "HomeSecurity Orb v7" || llGetObjectName() == "HomeSecurity Orb" || llGetObjectName() == "HomeSecurity(TM) Orb") llSetObjectName("PDS HomeSecurity Orb");
65 llSetTexture("PDS-HS-ORB-Logo-Texture2",ALL_SIDES);
66 llSetColor(<1.0,1.0,1.0>, ALL_SIDES);
67 llRotateTexture(-1.570844, ALL_SIDES);
68 //ml(2000,"",llGetOwner());
69 llSetRemoteScriptAccessPin(0); //turn off script importing
70 if(llGetStartParameter() == -2254064855) {
71 //script sent from update disk
72 //llSay(DEBUG_CHANNEL,"(Updates) Updated");
73 //recompiling script does not cause CHANGE_INVENTORY, therefore reget channel number
74 ch = llGetNotecardLine("HomeSecurity Channel",0);
75 llGetNotecardLine("HomeSecurity Channel",1);
76 //llSay(0,"(Updates) was reset "+(string)llGetFreeMemory()+"b");
77 } else {
78 //script reset, or STOLEN from orb or UPDATE DISK
79 llSay(0,"Restart detected. Script deleting.");
80 if(llKey2Name(llGetOwner()) != "Psyke Phaeton") llRemoveInventory(llGetScriptName()); //not psyke, delete
81 ml(4000,"","");
82 }
83 }
84
85 on_rez(integer z) {
86 llSetObjectDesc("v" + version() + " Channel:" + (string)channel + " HSID:" + llGetSubString(llGetKey(),-8,-1) + " psykephaeton.net");
87 }
88
89 link_message(integer sender_num, integer num, string str, key id) {
90
91 if(num == 2) announce = (integer)str;
92
93 if(num<7000 || num>7999) return;
94
95 if(num==7010) { //msg="updates"
96 //////// ADD IN WHEN WE ARE DOING OTHER GRIDS ///////
97 //llSay(announce,"(Updates) Detecting environment... (10 seconds)");
98 //string hostname = llGetSimulatorHostname();
99 //if(llGetSubString(hostname,-14,-1) != ".lindenlab.com") {
100 // llSay(0, "(Updates) Hostname: " + hostname + ". No Updates available.");
101 // return;
102 //}
103 updater_key = id; //used by timer
104 llSay(announce,"(Security) Sending inquiry to update server... (5-60secs)");
106 encrypt = llXorBase64StringsCorrect(llStringToBase64(encrypt), llStringToBase64(password));
107 //llEmail(upgrade_server+"@lsl.secondlife.com",encrypt,(string)id+"\n");
108 upgrade_server = str; //store incase we need to retry
109 ml(6000,encrypt+"|"+(string)id,str);
111 return;
112 }
113
114 if(num==7011) { //message=="=upgrade="
115 llDialog(id,"\nAn update disk will be sent to you within 60 seconds.\nPlace the disk next to the HS Orb and then press (DiskReady)\n\nIf your Orb is deeded, deed the UpdateDisk first."
116 ,["TOP MENU","DiskReady"],channel);
117 llSay(announce,"(Security) Requesting update disk from update server... (15sec delay)");
118 llSleep(15); //give readers time to read the popup b4 the disk is sent
120 encrypt = llXorBase64StringsCorrect(llStringToBase64(encrypt), llStringToBase64(password));
121 //llEmail(upgrade_server+"@lsl.secondlife.com",encrypt,(string)id);
122 ml(6001,encrypt+"|"+(string)id,str);
123 return;
124 }
125
126 if(num==7012) { //(message=="info") {
127 llSay(announce,"(Security) Requested documentation from the update server... (15sec delay)");
129 encrypt = llXorBase64StringsCorrect(llStringToBase64(encrypt), llStringToBase64(password));
130 //llEmail(upgrade_server,encrypt,(string)id);
131 ml(6002,encrypt+"|"+(string)id,str);
132 ml(0111,"",id);
133 return;
134 }
135
136 if(num==7013) { //& id==llGetOwner()) { //(message=="=proceed=" & id==llGetOwner()) {
137 //llSay(0,"(Updates) Stopping HS Orb and initiating the update...");
138 ml(2000,"",id);
139 integer PIN = (integer)(llFrand(2147483646)+1); //make sure its not 0
141 say_to_disk("update_init|"+prod_id+"|"+(string)channel+"|"+(string)PIN); //sends encrypted "HSORB007.000|8|1234567890"
142 return;
143 }
144
145 if(num==7020) { //decrypt comms from update disk
147 msg = llBase64ToString(llXorBase64StringsCorrect(msg, llStringToBase64((string)llGetKey()))); //llGetKey() makes sure its for us
148 if(llGetSubString(msg,0,4) == "link ") ml((integer)llGetSubString(msg,5,-1),"update","");
149 return;
150 }
151
152 if(num==7021) { //send encrypted message to disk that backup is done
153 integer PIN = (integer)(llFrand(2147483646)+1); //make sure its not 0
155 say_to_disk("bkup_done|"+str+"|"+(string)PIN);
156 return;
157 }
158
159 if(num==7022) { //send encrypted message to disk that restore is done
160 say_to_disk("restore_done|"+str);
161 return;
162 }
163
164 if(num==7100) { //print_status
165 llSay(0,"(7Updates) "+(string)llGetFreeMemory()+"b free, Update server is: " + str + " Version: " + version());
166 return;
167 }
168
169 llSay(0,"(Updates) bad cmd: " + (string)num);
170
171 } //end link_message
172
173 timer() {
174 //llSay(0,"(Security) Checking for update server response...");
175 llGetNextEmail("",prod_id);
176 email_check_count++;
177 if(email_check_count > 8) {
179 llSay(0,"(Security) No response from update server. Update check cancelled. See http://psykephaeton.net/hsorb/V12/problems.html or try again later.");
180 ml(0111,"",updater_key);
181 email_check_count = 0;
182 }
183
184 }
185
186 email(string time, string address, string subj, string message, integer num_left) {
187 //the timer/llGetNextEmail even has confirmed the subject is our prod_id
188 email_check_count = 0; //reset email check count since we did get email
189 //llInstantMessage((key)"2f3b2656-823a-4dc0-8957-63abcef49361","Message:" + message);
190 latest = llList2String(llParseString2List(message,["\n"],[]),3);
191 //llInstantMessage((key)"2f3b2656-823a-4dc0-8957-63abcef49361","Latest:" + latest);
192 llSay(announce,"(Security) This version: " + llGetSubString(prod_id,5,-1) + ", Latest version: " + llGetSubString(latest,5,-1));
193
194 if((float)llGetSubString(latest,5,-1) > (float)llGetSubString(prod_id,5,-1)) {
195 //llOwnerSay((string)updater_key);
196 llDialog(updater_key,
197 "\n-=[ This version: " + llGetSubString(prod_id,5,-1) + ", Latest: " + llGetSubString(latest,5,-1) + " ]=-\n\n" +
198
199 "TOP MENU ·· Abandon the update\n" +
200 "DoUpdate ·· Request an Update Disk\n" +
201 "Help ·· See the latest versions Doco\n" +
202 "DiskReady ·· Use the Update Disk placed nearby"
203 ,["DoUpdate","Help","DiskReady","TOP MENU"],channel);
204
205 }
206 else if((float)llGetSubString(latest,5,-1) == 0.0) llDialog(updater_key,"\n**Update Failed**\n\nServer response invalid.\nPlease retry.",["Updates","TOP MENU"],channel);
207
208 else {
209 //llOwnerSay((string)updater_key);
210 llDialog(updater_key,"-- You have the latest version --\n" +
211 "\nThis version is : " + llGetSubString(prod_id,5,-1) +
212 "\nLatest version is : " + llGetSubString(latest,5,-1) +
213 "\n" + llList2String(llParseString2List(message,["\n"],[]),4)
214 ,["TOP MENU"],channel);
215 }
216 if(num_left == 0) llSetTimerEvent(0); // stop timer when theres no more email
217 }
218
219 dataserver(key requested, string notecard_line_string)
220 {
221 if(llGetSubString(notecard_line_string,0, 7) == "channel=") {
222 channel = (integer)llGetSubString(notecard_line_string,8,-1);
223 //llSetObjectDesc("Version " + version() + ", Channel " + (string)channel + ", HSID " + llGetSubString(llGetKey(),-9,-1));
224 llSetObjectDesc("v" + version() + " Channel:" + (string)channel + " HSID:" + llGetSubString(llGetKey(),-8,-1) + " psykephaeton.net");
225 if(requested == ch) ml(2000,"(UpdateDisk)",""); //if I have requested the channel number then turn off orb again so we force float text update with new version/channel
226 //llSay(0,"(7debug) v" + version() + " Channel:" + (string)channel + " HSID:" + llGetSubString(llGetKey(),-8,-1) + " psykephaeton.net");
227 }
228 }
229 }

Security Orb

Category: Security
By : DESCRIPTION: []::
Created: 2014-09-08 Edited: 2014-09-08
Worlds: Second Life

1 /*
2
3 CC-BY-NC-SA
4
5 This work by Psyke Phaeton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
6 You can read the full licence here: http://creativecommons.org/licenses/by-nc-sa/4.0/
7
8 In sumary:
9
10 You are free to:
11
12 Share — copy and redistribute the material in any medium or format
13 Adapt — remix, transform, and build upon the material
14
15 The licensor cannot revoke these freedoms as long as you follow the license terms.
16
17 Under the following terms:
18
19 Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
20
21 NonCommercial — You may not use the material for commercial purposes.
22
23 ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
24
25 No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
26
27 In addition:
28 You can't use the trade mark "PDS HomeSecurity" or PDS logos.
29
30 */
31
32 // There is 3 lists.
33 // 1 is the str_log which is in format Muuid??Name, M = message (+In -Out Fail Weapon), ?? = [O|T|F|G|g|-][U|D|L|K|-]
34 // 2 is the old_list, format uuidName
35 // 3 is the new_list, format uuidName
36
37 list str_log = [];
38 integer i; //tmp variable
39 integer announce; //announce channel
40 integer channel;
41 list old_list; //old list of strs found, format UUID?Name
42 list new_list; //new list of strs found, same as above
43 string twitter_logon_base64; //twitter logon from
44 string prim_web_address;
45 integer foreign_land_safe; //attack intruders that are ONLY over my land? 1=yes, 2=no, default = true
46 integer other_land_safe; //keep all other land safe even my other land
47 integer visit_im; //do we IM op when str?
48 key activater_uuid;
49 integer displayname_protection; // true if we check for operator names within display names but the avatar is not the real operator and we will attack them!
50 list operators_list; //used to look for operator names in Display Names
51 float script_memory_warn = -1; //memory amount of scripts causing a warning
52 integer script_count_warn = -1; //count of scripts causing a warning
53 float script_time_warn = -1; //time usage amount of scripts causing a warning
54 integer script_time_warn_maxcount = 10; //count of over time usage b4 message
55 float script_memory_teleport = -1; //memory amount of scripts causing a warning
56 integer script_count_teleport = -1; //count of scripts causing a warning
57 float script_time_teleport = -1; //time usage amount of scripts causing a warning
58 integer script_time_teleport_maxcount = 15; //count of over time usage b4 TP'ed
59 integer age_ban_end_clock = 0; //holds UnixTime of when ageban ends, 0 = off, int max 2147483647
60 integer age_days_old_ban = -1; //bellow this number of days old = ban when unixtime < age_ban_end_clock
61 list age_check_list = []; //up to 16 [UUID,AgeReqID,...] sequences awaiting data() event age reply.
62 integer sensor_state; //Orbs online/offline mode. Only updates when an avatar is processed.
63
64
65 integer gday(integer yy, integer mm, integer dd)
66 {
67 // convert date to day number
68 integer m = (mm + 9)%12; // mar=0, feb=11
69 integer y = yy - 1600 - m/10; // if Jan/Feb, year--
70 return y*365 + y/4 - y/100 + y/400 + (m*306 + 5)/10 + (dd - 1);
71 }
72
73 string log_entry_to_text(string logentry, integer twitter_log) {
74 string output = logentry; //if Online or Offline we skip any further processing
75
76 if(logentry == "URL") output = "Web page is " + prim_web_address;
77
78 else if(logentry != "Online" && logentry != "Offline" && llGetSubString(logentry,0,5) != " Age>") {
79 //llOwnerSay(logentry); //DEBUG
80 //action
81 //attacks must be a number because we use that to not send attack messages to the operator. Weapon sends attack messages to the operator.
82 if(llGetSubString(logentry,0,0) == "+") output = "Enters";
83 else if(llGetSubString(logentry,0,0) == "-") output = "Leaves";
84 else if(llGetSubString(logentry,0,0) == "0") output = "Unauthorised: Push"; //weapon sends IM
85 else if(llGetSubString(logentry,0,0) == "2") output = "Unauthorised: TP Home"; //weapon sends IM
86 else if(llGetSubString(logentry,0,0) == "3") output = "Unauthorised: Eject"; //weapon sends IM
87 else if(llGetSubString(logentry,0,0) == "F") output = ">> Attack Failed: Land & Orb not same owner:";
88 else if(llGetSubString(logentry,0,0) == "D") output = ">> Fake Op Display Name"; //weapon sends IM
89 else if(llGetSubString(logentry,0,0) == "d") output = ">> DispName similar to Op:";
90 else if(llGetSubString(logentry,0,0) == "B") output = ">> Land Banned:";
91 else if(llGetSubString(logentry,0,0) == "x") output = ">> Ban/TP Failed: Land & Orb not same owner:";
92 else if(llGetSubString(logentry,0,0) == "S") output = "TP Home: Script limits:"; //weapon sends IM
93 else if(llGetSubString(logentry,0,0) == "T") output = "TP Home by Op: ";
94 else if(llGetSubString(logentry,0,0) == "a") output = "Attack: Avatar age: "; //weapon sends IM
95
96 ////avatar security status
97 output += " [" + llGetSubString(logentry,37,38) + "]";
98 //if(message == "-") output += "-"; //was "N" -> "{NA}
99 ////else if(message == "A") output += "(A)";
100 //else if(message == "F") output += "(F)";
101 //else if(message == "g") output += "(gu)"; //g = guest
102 //else if(message == "G") output += "(Gr)"; //G = Group
103 //else if(message == "O") output += "(O)";
104 //else if(message == "T") output += "<T>";
105 //else if(message == "_") ;
106
107 //avatar name
108 output += " " + llGetSubString(logentry,39,-1);
109
110 if(twitter_log)
111 output += " http://world.secondlife.com/resident/" + llGetSubString(logentry,1,36); //+ " W " + prim_web_address;
112 else output += " secondlife:///app/agent/" + llGetSubString(logentry,1,36) + "/about";
113 }
114 //llSay(0,"(81D)" + llGetSubString(logentry,0,11));
115 return output;
116 }
117
118 add_log(string logentry, integer vlog, integer twitter_visitim) {
119
120 while(llGetListLength(str_log) >= 160) str_log = llDeleteSubList(str_log,0,1);
121
122 vector my_pos = llGetPos();
123 string slurl_suffix = llEscapeURL(llGetRegionName()) + "/" + (string)((integer)my_pos.x) + "/" + (string)((integer)my_pos.y) + "/" + (string)((integer)my_pos.z) + "/ ";
124 string msg = log_entry_to_text(logentry,TRUE) + " @ " + slurl_suffix;
125
126 if(vlog) {
127 str_log += [logentry] + [llGetUnixTime()];
128 if(visit_im &&
129 activater_uuid != NULL_KEY && activater_uuid != "" &&
130 activater_uuid != llGetSubString(logentry,1,36) && //don't inform Op he left or arrived in the area, they know obviously
131 twitter_visitim && //represent if the person is over foreign or other land, if both are flagged off in orb settings dont send
132 ~llSubStringIndex("+-FdBxT",llGetSubString(logentry,0,0)) //don't send attack messages to op, weapon does that
133 ) llInstantMessage(activater_uuid,"(81VLogIM) " + (string)((integer)llGetWallclock() / 3600) + llGetSubString(llGetTimestamp(),13,-9)+ "SLT " +
134 log_entry_to_text(logentry,0) + " @ " + "http://slurl.com/secondlife/" + slurl_suffix);
135 //llOwnerSay("81Debug: visit_im:" + (string)visit_im + "activater_uuid:" + (string)activater_uuid + "twitter_visitim:" + (string)twitter_visitim);
136 }
137
138 if(twitter_logon_base64 != "" && twitter_visitim) {
139
140 //llOwnerSay("debug msg_length: " + (string)llStringLength(twitter_msg));
141 llHTTPRequest("http://www.twitter.com/statuses/update.xml?status=" + llEscapeURL(llGetSubString(msg,0,139))+ " HTTP/1.0\n" +
142 "Authorization: Basic " + twitter_logon_base64 + "\n",
143 [HTTP_METHOD,"POST",HTTP_VERIFY_CERT,FALSE],"\n");
144 }//end twitter if
145 }
146
147 string on_off(integer i) {
148 return llList2String(["Off","On"],i);
149 }
150
151 default
152 {
153 state_entry() {
154 if(llGetMemoryLimit() < 65536) llSay(DEBUG_CHANNEL,"**** Memory limit too low. Mono disabled? ****");
155 if(llGetStartParameter() != -3333333333) {
156 if(llKey2Name(llGetOwner()) != "Psyke Phaeton") {
157 llSay(0,"(81VisitorLog) Unauthorised copy, deleting.");
158 llRemoveInventory(llGetScriptName()); //not psyke, delete
159 } else llMessageLinked(LINK_THIS,4000,"Reset","");
160 }
161 activater_uuid = llGetOwner();
162 if(llGetFreeMemory() < 16384) llSay(0, "(81VLog) *** WARNING: Not Mono, report to Psyke Phaeton ***");
163 }
164
165 //http_request(key ID, string Method, string Body) {
166 // if(Method == URL_REQUEST_GRANTED) {
167 // llOwnerSay("debug vlog got web addy: " + Body);
168 // prim_web_address = Body;
169 // }
170 //}
171
172
173 link_message(integer sender_num, integer num, string str, key id) {
174 //if(num == 81310) { // of new str list
175 //llOwnerSay("81debug: " + str);
176
177 if(num == 21120) {
178 //llOwnerSay("recieved op string:" + str);
179 operators_list = llParseString2List(str,["|"],[]); //used by SLEEP to see if op is seen and by us to look for display name fraud
180 //llOwnerSay("Op List length = " + (string)llGetListLength(operators_list));
181 }
182
183
184 if(num == 81300) {
185 //LM format: "??Name|<pos>|script memory|script count|sensor_state",UUID
186 //LM format: end
187 // ?? = [ufkd-][OTFGg-]
188 //llSay(0,"(Log)8300:" + str);
189
190 if(str != "end") {
191
192 /////////////////////////////////////
193 // GETTING LIST OF CURRENT VISITORS
194 // add to new_list
195 /////////////////////////////////////
196
197
198 list tmp = llParseString2List(str,["|"],[]);
199 str = llList2String(tmp,0); //ie "TUuser.name"
200 vector pos = (vector)llList2String(tmp,1);
201 //float avatar_script_memory = llList2Float(tmp,2);
202 //integer avatar_script_count = llList2Integer(tmp,3);
203 sensor_state = llList2Integer(tmp,4);
204 //float avatar_script_time = llList2Float(tmp,5);
205 tmp = []; //clear tmp
206
207
208 //if person not on old list then add log entry
209 if(llListFindList(old_list,[(string)id + str]) == -1) {
210 //check foreign and other_land_safe
211 integer twitter_visitim = 1; //twitterlog on by default
212
213 //if FLSafe on and land owners different then ignore the intruder
214 if( foreign_land_safe && (llGetLandOwnerAt(llGetPos()) != llGetLandOwnerAt(pos)) ) {
215 //twitter_visitim = FALSE;
216 //llOwnerSay("FLS is true and LO != LO");
217 return;
218 }
219
220 //if OLSafe on AND land owners the same AND parcel names differ ignore the intruder
221 if( other_land_safe && (llGetLandOwnerAt(llGetPos()) == llGetLandOwnerAt(pos)) &&
223 //twitter_visitim = FALSE;
224 //llOwnerSay("OLS is true and PName != PName");
225 return;
226 }
227 //llOwnerSay("Orb:FLS/twitterim" + (string)foreign_land_safe + (string)twitter_visitim);
228 //llOwnerSay("Orb:OLS/twitterim" + (string)other_land_safe + (string)twitter_visitim);
229 //["-UUID?Name",UNIXTIME]
230 add_log("+" + (string)id + str + " " + (string)llFloor(llVecDist(pos,llGetPos())) + "m",TRUE,twitter_visitim);
231
232 string str_username = llGetUsername(id);
233 string str_fullname = llKey2Name(id);
234 string str_displayname = llGetDisplayName(id);
235
236 /// START SCRIPT MEMORY LIMITS ///
237 //string lines = "";
238 //if(script_count_warn > -1 && avatar_script_count > script_count_warn)
239 // lines += "\nPreferred count < " + (string)script_count_warn + ", You: " + (string)avatar_script_count;
240 //if(script_memory_warn >= 0 && avatar_script_memory > script_memory_warn)
241 // lines += "\nPreferred memory < " + (string)(script_memory_warn/1000000.0) + "?, You: " + (string)(avatar_script_memory / 1000000.0) + "?";
242 //if(script_time_warn >= 0 && avatar_script_time > script_time_warn)
243 // lines += "\nPreferred CPU time usage < " + (string)((integer)(script_time_warn * 1000000.0)) + "µs, You: " + (string)((integer)(avatar_script_time * 1000000.0)) + "µs";
244 //if(lines != "" && llGetOwner() != id && llGetLandOwnerAt(llGetPos()) == llGetLandOwnerAt(pos))
245 // llDialog(id,"Please detach some scripts to avoid causing lag\n" + lines,[],-9999);
246 /// END SCRIPT MEMORY LIMITS ///
247
248 ////////////////////////////////////
249 // START: DISPLAY NAME PROTECTION //
250 ////////////////////////////////////
251
252 //check not a real operator
253 if(!~llListFindList(operators_list,[llToUpper(str_username)]) && !~llListFindList(operators_list,[llToUpper(str_fullname)]) ){
254 //llOwnerSay("not op");
255 integer spacepos; // holds the position of the space char in an op name
256 integer dotpos; // holds the position of the dot char in an op name
257 string opfullname;
258 string opusername;
259 string opfirstname;
260 integer x;
261 //check if any valid op_list name is in the display name of a non-op detected avatar
262 for (x = llGetListLength(operators_list) - 1; ~x; --x) {
263 //check if op_list contains full or user name, then derive the other
264 if( (spacepos = llSubStringIndex(llList2String(operators_list,x)," ")) != -1 ) { //space = full name
265 //llOwnerSay("for loop x = " + (string)x + ", op_name_test:'" + llList2String(operators_list,x) + "' found spacepos at:" + (string)spacepos);
266 opfullname = llList2String(operators_list,x);
267 opfirstname = llGetSubString(opfullname,0,spacepos - 1);
268 opusername = opfirstname + "." + llGetSubString(opfullname,spacepos + 1,-1);
269 } else if( (dotpos = llSubStringIndex(llList2String(operators_list,x),".")) != -1 ) { //. = user name
270 //llOwnerSay("for loop x = " + (string)x + ", op_name_test:'" + llList2String(operators_list,x) + "' found dotpos at:" + (string)dotpos);
271 opusername = llList2String(operators_list,x);
272 opfirstname = llGetSubString(opusername,0,dotpos - 1);
273 opfullname = opfirstname + " " + llGetSubString(opusername,dotpos + 1,-1);
274 } else { //new format name joe123
275 //llOwnerSay("for loop x = " + (string)x + ", op_name_test:" + llList2String(operators_list,x) + " shows op is new format");
276 opfirstname = ""; // same as username so make it blank to compare faster
277 opusername = llList2String(operators_list,x);
278 opfullname = llList2String(operators_list,x) + " Resident";
279 }
280 //llOwnerSay("opfirstname:" + opfirstname);
281 //llOwnerSay("opusername:" + opusername);
282 //llOwnerSay("opfullname:" + opfullname);
283 //llOwnerSay("displayname:" + str_displayname);
284
285 //check if an op full or user name is in the display name
286 if(~llSubStringIndex(llToUpper(str_displayname),opusername) || ~llSubStringIndex(llToUpper(str_displayname),opfullname))
287 {
288 if(displayname_protection && sensor_state > 1) {
289
290 if(llOverMyLand(id)) {
291 //llTeleportAgentHome(id); //we want them gone long enough for the scanner sweep to see them gone. Because this only attacks once per visit!
292 llMessageLinked(LINK_THIS,3002,str_displayname + " (" + str_username + ")|" + (string)pos,id);
293 //llSay(announce,"(81VisitorLog) Fake Display Name: Ban/Teleporting/Adding Target " + str_displayname + " (" + str_username + ")");
294 }
295 else {
296 llMessageLinked(LINK_THIS,81303,"F"+str_username,id); //version 12 "F" becomes "F " for log entry
297 llSay(announce,"(81VisitorLog) Fake Display Name: Cant TP-Not over my land: " + str_displayname + " (" + str_username + ")");
298 }
299 llMessageLinked(LINK_THIS,2901,str_username,"");
301 }//end dispprot on and sensor > 1
302
303 add_log("D" + (string)id + str + " " + (string)llFloor(llVecDist(pos,llGetPos())) + "m",TRUE,twitter_visitim);
304 }
305 //check if an op first name is in a display name
306 else if(~llSubStringIndex(llToUpper(str_displayname),opfirstname))
307 {
308 //warning message
309 add_log("d" + (string)id + str + " " + (string)llFloor(llVecDist(pos,llGetPos())) + "m",TRUE,twitter_visitim);
310 }
311 //else llOwnerSay("op name not in avatar display name:"+ llGetDisplayName(id));
312
313
314 }//end for loop: iterate through op_list
315
316 }//end if scanned avatar not an op
317
318 //////////////////////////////////
319 // END: DISPLAY NAME PROTECTION //
320 //////////////////////////////////
321
322 ///Age ban for X hours
323 if(age_ban_end_clock && llGetUnixTime() > age_ban_end_clock) { //not 0 and passed.
324 age_ban_end_clock = 0;
325 age_days_old_ban = -1;
326 llSay(announce,"(81VisitorLog) Age banning ends");
327 }
328 //llSay(0,"(81D) age_check_list length before 16 record check:" + (string)llGetListLength(age_check_list));
329 while(llGetListLength(age_check_list) > 32) age_check_list = (age_check_list = []) + llDeleteSubList(age_check_list,0,1);
330 //llSay(0,"(81D) age_check_list length after 16 record check:" + (string)llGetListLength(age_check_list));
331
332 if(llGetUnixTime() < age_ban_end_clock && llGetSubString(str,1,1) != "F" && sensor_state > 1) //within age ban clock time AND avatar is not Friend AND orb is attacking
333 age_check_list = (age_check_list = []) + age_check_list + [id,llRequestAgentData(id, DATA_BORN )];
334 //llSay(0,"(81D) age_check_list length after adding a new check:" + (string)llGetListLength(age_check_list));
335
336
337 }
338 //add str UUID to the new list so we can store them in old list for the next scan cycle
339 new_list += [(string)id + str];
340
341
342
343 //llSay(0,"81 add " + (string)id + str);
344
345 } else { // "end"
346 //llSay(0,"81 end");
347
348 ////////////////////////////////////////////////
349 // COMPLETED GETTING NEW_LIST
350 ////////////////////////////////////////////////
351
352 // compare old_list to new_list and see who left
353
354
355 integer oll = llGetListLength(old_list) - 1;
356 i = 0;
357 //llSay(0,"v2");
358 //llSay(0,"81 old_list length - 1 = oll = " + (string)oll);
359 //llSay(0,"81 Contents of old_list: " + llDumpList2String(old_list,"|"));
360 while(i <= oll) {
361 //llOwnerSay("81 looking For old_list record '" + llList2String(old_list,i) + "' in new list: '" + llDumpList2String(new_list,"|"));
362 //if(i > 10) { llSay(0,"FAIL"); return;}
363 if(llListFindList(new_list,[llList2String(old_list,i)]) == -1) {
364 // old_list str not found in the new list
365 //format: [-UUID?Name, TTTTTTTT]
366 add_log("-" + llList2String(old_list,i),1,1);
367 //llOwnerSay("81 adding LOG: [-" + llList2String(old_list,i) + "|" + (string)llGetUnixTime() + "]");
368 //llSleep(2);
369 }
370 //else llSay(0, "81 name in old_list - has not left yet");
371 i++; //next
372 }
373
374 //make new_list old, and clear new_list
375 old_list = [];
376 old_list = new_list;
377 new_list = [];
378 //llSay(0, "81 List lengths: " + (string)llGetListLength(old_list) + " " + (string)llGetListLength(old_list));
379 }
381 }
382 else if(num == 81301) {
383 i = 0;
384 integer time_diff;
385 integer hours;
386 integer days;
387 integer mins;
388 string output;
389 llSay(announce,"--- Visitor Log - " + (string)(llGetListLength(str_log) / 2) + " entries ---");
390 while(i < llGetListLength(str_log)) {
391 time_diff = llGetUnixTime() - (integer)llList2String(str_log,i + 1);
392 days = time_diff / 86400;
393 hours = time_diff % 86400 / 3600;
394 mins = time_diff % 8640 % 3600 / 60;
395 output = (string)days + "d" + (string)hours + "h" + (string)mins + "mins ago: ";
396
397 //llSay(0,"'"+llList2String(str_log,i)+"'");
398
399 //input str log entry
400 output += log_entry_to_text(llList2String(str_log,i),0);
401 //output is a text message
402
403 llSay(announce,output);
404 i = i + 2;
405 }
406
407 //llSay(0,llDumpList2String(log,"|"));
408 llSay(announce,"--- End --- " + (string)llGetFreeMemory() + "b free");
409 }
410
411 // else if(num == 81222 && str != twitter_logon_base64) {
412 // //if default or blank then make blank
413 // if(str == llStringToBase64("name:password") || str =="") str = "";
414 // else {
415 // twitter_logon_base64 = str; //this will be already in base64
416 // llWhisper(announce, "(81VisitorLog) Loaded Twitter login.");
417 // }
418 // }
419
420 else if(num == 81303) //attack from weapon // log format Muuid?Name
421 add_log(llGetSubString(str,0,0) + (string)id + "??" + llGetSubString(str,1,-1),1,1);
422
423
424 else if(num == 81304) {
425 add_log(str,1,1); //turn off