· 8 years ago · Nov 01, 2017, 05:26 PM
1{
2 "D:bin",
3 "{\
4 \"F:archiver\",\
5 \"\\\"print(\\\\\\\"Debian CC Archiver v0.1 by 1Ridav\\\\\\\")\\\\\\\
6tArgs = {...}\\\\\\\
7local function getPath(input)\\\\\\\
8if string.sub(input, 1, 1)==\\\\\\\"/\\\\\\\" then path=input else\\\\\\\
9path=(\\\\\\\"/\\\\\\\" .. shell.dir() .. \\\\\\\"/\\\\\\\" .. input) end\\\\\\\
10return path\\\\\\\
11end\\\\\\\
12if tArgs[2] then\\\\\\\
13tArgs[2]=getPath(tArgs[2])\\\\\\\
14end\\\\\\\
15\\\\\\\
16local FFormat = \\\\\\\".arch\\\\\\\"\\\\\\\
17local nFile, nDir, size = 0, 0\\\\\\\
18\\\\\\\
19if #tArgs < 3 then \\\\\\\
20 print(\\\\\\\"Usage:\\\\\\\"\\\\\\\
21 ..\\\\\\\"\\\\\\\\narchive zip <DIR> <ZIPname> [DIRtoSkip] [DIRtoSkip]\\\\\\\"\\\\\\\
22 ..\\\\\\\"\\\\\\\\narchive unzip <ZIPname> <DIR>\\\\\\\")\\\\\\\
23end\\\\\\\
24\\\\\\\
25local function fopen(path, mode)\\\\\\\
26 local f = fs.open(path, mode)\\\\\\\
27 if not f then \\\\\\\
28 print(\\\\\\\"ERROR: Could not open \\\\\\\"..path..\\\\\\\" with mode \\\\\\\\\\\\\\\"\\\\\\\"..mode..\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\")\\\\\\\
29 exit()\\\\\\\
30 end\\\\\\\
31 return f\\\\\\\
32end\\\\\\\
33\\\\\\\
34local function skip(df)\\\\\\\
35 for i = 3, #tArgs do\\\\\\\
36 if tArgs[i] == fs.getName(df) then\\\\\\\
37 return true\\\\\\\
38 end\\\\\\\
39 end\\\\\\\
40 for i = 4, #tArgs do\\\\\\\
41 if tArgs[i] == fs.getName(df) then\\\\\\\
42 return true\\\\\\\
43 end\\\\\\\
44 end\\\\\\\
45 return false\\\\\\\
46end\\\\\\\
47\\\\\\\
48local function zip(file)\\\\\\\
49 print(\\\\\\\"zipping: \\\\\\\".. file)\\\\\\\
50 local f = fopen(file, \\\\\\\"r\\\\\\\")\\\\\\\
51 local z = textutils.serialize(f.readAll())\\\\\\\
52 f.close()\\\\\\\
53 return z\\\\\\\
54end\\\\\\\
55\\\\\\\
56local function ZIP(path)\\\\\\\
57 local list = fs.list(path)\\\\\\\
58 local array = {}\\\\\\\
59 local t, name, d = 0, \\\\\\\"\\\\\\\", 0\\\\\\\
60 \\\\\\\
61 for i = 2, #list * 2, 2 do\\\\\\\
62 t = i/2\\\\\\\
63 local tpath = path..\\\\\\\"/\\\\\\\"..list[t]\\\\\\\
64 if fs.isDir(tpath) then\\\\\\\
65 if not skip(tpath) then\\\\\\\
66 name = \\\\\\\"D:\\\\\\\"..list[t]\\\\\\\
67 array[i] = ZIP(tpath)\\\\\\\
68 nDir = nDir + 1\\\\\\\
69 end\\\\\\\
70 else\\\\\\\
71 name = \\\\\\\"F:\\\\\\\"..list[t]\\\\\\\
72 array[i] = zip(tpath)\\\\\\\
73 nFile = nFile + 1\\\\\\\
74 end\\\\\\\
75 array[i - 1] = name\\\\\\\
76 end\\\\\\\
77 \\\\\\\
78 return textutils.serialize(array)\\\\\\\
79end\\\\\\\
80\\\\\\\
81local function unzip(text, path)\\\\\\\
82 print(\\\\\\\"unzipping: \\\\\\\"..path)\\\\\\\
83 local f = fopen(path, \\\\\\\"w\\\\\\\")\\\\\\\
84 f.write(textutils.unserialize(text))\\\\\\\
85 f.close()\\\\\\\
86end\\\\\\\
87\\\\\\\
88local function UNZIP(text, path)\\\\\\\
89 local array = textutils.unserialize(text)\\\\\\\
90 local unz, dp\\\\\\\
91 local d = 0\\\\\\\
92 for i = 2, #array, 2 do\\\\\\\
93 if string.sub(array[i-1], 1, 1) == \\\\\\\"D\\\\\\\" then\\\\\\\
94 dp = string.sub(array[i-1], 3, #array[i-1])\\\\\\\
95 fs.makeDir(path..\\\\\\\"/\\\\\\\"..dp)\\\\\\\
96 UNZIP(array[i], path..\\\\\\\"/\\\\\\\"..dp)\\\\\\\
97 nDir = nDir + 1\\\\\\\
98 elseif string.sub(array[i-1], 1, 1) == \\\\\\\"F\\\\\\\" then\\\\\\\
99 local p = string.sub(array[i-1], 3, #array[i-1])\\\\\\\
100 unzip(array[i], path..\\\\\\\"/\\\\\\\"..p)\\\\\\\
101 nFile = nFile + 1\\\\\\\
102 end\\\\\\\
103 end\\\\\\\
104end\\\\\\\
105\\\\\\\
106local function result()\\\\\\\
107 print(\\\\\\\"\\\\\\\\nDone\\\\\\\"\\\\\\\
108 ,\\\\\\\"\\\\\\\\n size: \\\\\\\"\\\\\\\
109 ,size, \\\\\\\" B \\\\\\\"\\\\\\\
110 ,math.floor(size/1024), \\\\\\\" KB\\\\\\\"\\\\\\\
111 ,\\\\\\\"\\\\\\\\n Files: \\\\\\\", nFile\\\\\\\
112 ,\\\\\\\"\\\\\\\\n Folders: \\\\\\\", nDir\\\\\\\
113 )\\\\\\\
114end\\\\\\\
115\\\\\\\
116if tArgs[1] == \\\\\\\"zip\\\\\\\" then\\\\\\\
117 if fs.exists(tArgs[2]) and fs.isDir(tArgs[2]) then\\\\\\\
118 local zipped = ZIP(shell.resolve(tArgs[2]))\\\\\\\
119 local f = fs.open(tArgs[3]..FFormat, \\\\\\\"w\\\\\\\")\\\\\\\
120 f.write(zipped)\\\\\\\
121 f.close()\\\\\\\
122 zipped = nil\\\\\\\
123 size = fs.getSize(tArgs[3]..FFormat)\\\\\\\
124 result() \\\\\\\
125 end\\\\\\\
126 \\\\\\\
127elseif tArgs[1] == \\\\\\\"unzip\\\\\\\" then\\\\\\\
128 local f = fopen(tArgs[2], \\\\\\\"r\\\\\\\")\\\\\\\
129 if not fs.exists(tArgs[3]) then \\\\\\\
130 fs.makeDir(tArgs[3]) \\\\\\\
131 end\\\\\\\
132 UNZIP(f.readAll(), tArgs[3])\\\\\\\
133 size = fs.getSize(tArgs[2])\\\\\\\
134 result()\\\\\\\
135end\\\"\",\
136 \"F:cat\",\
137 \"\\\"local tArgs = {...}\\\\\\\
138\\\\\\\
139if #tArgs >= 1 then\\\\\\\
140 path = shell.resolve(tArgs[1])\\\\\\\
141 if fs.isReadOnly(path) and not security.getSU() then\\\\\\\
142 -- prevent users from seeing unauthorized code\\\\\\\
143 -- they should only be able to see their own files and ones in /var/log\\\\\\\
144 exception.throw(\\\\\\\"SecurityException\\\\\\\", path)\\\\\\\
145 return\\\\\\\
146 end\\\\\\\
147 if not fs.exists(path) or fs.isDir(path) then\\\\\\\
148 gui.printAppInfo(\\\\\\\"cat\\\\\\\", \\\\\\\"file does not exist\\\\\\\")\\\\\\\
149 else\\\\\\\
150 textutils.pagedPrint(kernel.printFile(path))\\\\\\\
151 end\\\\\\\
152else\\\\\\\
153 gui.printAppInfo(\\\\\\\"cat\\\\\\\", \\\\\\\"filename not specified\\\\\\\")\\\\\\\
154end\\\\\\\
155\\\"\",\
156 \"F:convert\",\
157 \"\\\"local args = {...}\\\\\\\
158\\\\\\\
159local function checksys(txt)\\\\\\\
160 if txt == \\\\\\\"kernel\\\\\\\" or txt == \\\\\\\"gui\\\\\\\" or txt == \\\\\\\"app\\\\\\\" or txt == \\\\\\\"log\\\\\\\" or txt == \\\\\\\"config\\\\\\\" or txt == \\\\\\\"manual\\\\\\\" or txt == \\\\\\\"search\\\\\\\" or txt == \\\\\\\"tpm\\\\\\\" or txt == \\\\\\\"exception\\\\\\\" or string.find(txt, \\\\\\\"boot/\\\\\\\") or string.find(txt, \\\\\\\"system/\\\\\\\") or string.find(txt, \\\\\\\"/startup\\\\\\\") then\\\\\\\
161 --gui.printAppWarning(\\\\\\\"kernel\\\\\\\", \\\\\\\"attempt to perform restricted operations\\\\\\\")\\\\\\\
162 return true\\\\\\\
163 end\\\\\\\
164end\\\\\\\
165\\\\\\\
166if #args < 1 or not fs.exists(shell.resolveProgram(args[1])) or fs.isDir(shell.resolve(args[1])) then\\\\\\\
167 gui.printAppInfo(\\\\\\\"config\\\\\\\", \\\\\\\"file not specified\\\\\\\")\\\\\\\
168 return\\\\\\\
169end\\\\\\\
170\\\\\\\
171if not checksys(shell.resolveProgram(args[1])) then\\\\\\\
172 if os.loadAPI(shell.resolveProgram(args[1])) then\\\\\\\
173 config.save(_G[args[1]], textutils.serialize(args[1]))\\\\\\\
174 os.unloadAPI(args[1])\\\\\\\
175 gui.printAppSuccess(\\\\\\\"config\\\\\\\", \\\\\\\"conversion succeeded\\\\\\\")\\\\\\\
176 end\\\\\\\
177else\\\\\\\
178 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
179end\\\"\",\
180 \"F:credits\",\
181 \"\\\"shell.run(\\\\\\\"/bin/man credits\\\\\\\")\\\"\",\
182 \"F:df\",\
183 \"\\\"local tArgs = {...}\\\\\\\
184local sz = fs.getSize(shell.dir())\\\\\\\
185local fspc = fs.getFreeSpace(shell.dir())\\\\\\\
186\\\\\\\
187gui.printAppInfo(\\\\\\\"type\\\\\\\", fs.getDrive(shell.dir()))\\\\\\\
188if search.findValue(tArgs, \\\\\\\"-sB\\\\\\\") then\\\\\\\
189 gui.printAppInfo(\\\\\\\"size\\\\\\\", tostring(sz)..\\\\\\\" B\\\\\\\")\\\\\\\
190 gui.printAppInfo(\\\\\\\"free space\\\\\\\", tostring(fspc)..\\\\\\\" B\\\\\\\")\\\\\\\
191elseif search.findValue(tArgs, \\\\\\\"-sKB\\\\\\\") then\\\\\\\
192 gui.printAppInfo(\\\\\\\"size\\\\\\\", tostring(sz/1024)..\\\\\\\" KB\\\\\\\")\\\\\\\
193 gui.printAppInfo(\\\\\\\"free space\\\\\\\", tostring(fspc/1024)..\\\\\\\" KB\\\\\\\")\\\\\\\
194end\\\\\\\
195\\\"\",\
196 \"F:edit\",\
197 \"\\\"-- Get file to edit\\\\\\\
198local tArgs = { ... }\\\\\\\
199if #tArgs == 0 then\\\\\\\
200 print( \\\\\\\"Usage: edit <path>\\\\\\\" )\\\\\\\
201 return\\\\\\\
202end\\\\\\\
203\\\\\\\
204-- Error checking\\\\\\\
205local sPath = shell.resolve( tArgs[1] )\\\\\\\
206local bReadOnly = fs.isReadOnly( sPath )\\\\\\\
207if fs.exists( sPath ) and fs.isDir( sPath ) then\\\\\\\
208 print( \\\\\\\"Cannot edit a directory.\\\\\\\" )\\\\\\\
209 return\\\\\\\
210end\\\\\\\
211\\\\\\\
212if bReadOnly and not security.getSU() then\\\\\\\
213 -- prevent users from seeing unauthorized code\\\\\\\
214 -- they should only be able to see their own files and ones in /var/log\\\\\\\
215 exception.throw(\\\\\\\"SecurityException\\\\\\\", sPath)\\\\\\\
216 return\\\\\\\
217end\\\\\\\
218\\\\\\\
219local x,y = 1,1\\\\\\\
220local w,h = term.getSize()\\\\\\\
221local scrollX, scrollY = 0,0\\\\\\\
222\\\\\\\
223local tLines = {}\\\\\\\
224local bRunning = true\\\\\\\
225\\\\\\\
226-- Colours\\\\\\\
227local highlightColour, keywordColour, commentColour, textColour, bgColour\\\\\\\
228if term.isColour() then\\\\\\\
229 bgColour = colours.black\\\\\\\
230 textColour = colours.white\\\\\\\
231 highlightColour = colours.yellow\\\\\\\
232 keywordColour = colours.yellow\\\\\\\
233 commentColour = colours.green\\\\\\\
234 stringColour = colours.red\\\\\\\
235else\\\\\\\
236 bgColour = colours.black\\\\\\\
237 textColour = colours.white\\\\\\\
238 highlightColour = colours.white\\\\\\\
239 keywordColour = colours.white\\\\\\\
240 commentColour = colours.white\\\\\\\
241 stringColour = colours.white\\\\\\\
242end\\\\\\\
243\\\\\\\
244-- Menus\\\\\\\
245local bMenu = false\\\\\\\
246local nMenuItem = 1\\\\\\\
247local tMenuItems = {}\\\\\\\
248if not bReadOnly then\\\\\\\
249 table.insert( tMenuItems, \\\\\\\"Save\\\\\\\" )\\\\\\\
250end\\\\\\\
251if shell.openTab then\\\\\\\
252 table.insert( tMenuItems, \\\\\\\"Run\\\\\\\" )\\\\\\\
253end\\\\\\\
254if peripheral.find( \\\\\\\"printer\\\\\\\" ) then\\\\\\\
255 table.insert( tMenuItems, \\\\\\\"Print\\\\\\\" )\\\\\\\
256end\\\\\\\
257table.insert( tMenuItems, \\\\\\\"Exit\\\\\\\" )\\\\\\\
258\\\\\\\
259local sStatus = \\\\\\\"Press Ctrl to access menu\\\\\\\"\\\\\\\
260if string.len( sStatus ) > w - 5 then\\\\\\\
261 sStatus = \\\\\\\"Press Ctrl for menu\\\\\\\"\\\\\\\
262end\\\\\\\
263\\\\\\\
264local function load( _sPath )\\\\\\\
265 tLines = {}\\\\\\\
266 if fs.exists( _sPath ) then\\\\\\\
267 local file = io.open( _sPath, \\\\\\\"r\\\\\\\" )\\\\\\\
268 local sLine = file:read()\\\\\\\
269 while sLine do\\\\\\\
270 table.insert( tLines, sLine )\\\\\\\
271 sLine = file:read()\\\\\\\
272 end\\\\\\\
273 file:close()\\\\\\\
274 end\\\\\\\
275 \\\\\\\
276 if #tLines == 0 then\\\\\\\
277 table.insert( tLines, \\\\\\\"\\\\\\\" )\\\\\\\
278 end\\\\\\\
279end\\\\\\\
280\\\\\\\
281local function save( _sPath )\\\\\\\
282 -- Create intervening folder\\\\\\\
283 local sDir = _sPath:sub(1, _sPath:len() - fs.getName(_sPath):len() )\\\\\\\
284 if not fs.exists( sDir ) then\\\\\\\
285 fs.makeDir( sDir )\\\\\\\
286 end\\\\\\\
287\\\\\\\
288 -- Save\\\\\\\
289 local file = nil\\\\\\\
290 local function innerSave()\\\\\\\
291 file = fs.open( _sPath, \\\\\\\"w\\\\\\\" )\\\\\\\
292 if file then\\\\\\\
293 for n, sLine in ipairs( tLines ) do\\\\\\\
294 file.write( sLine .. \\\\\\\"\\\\\\\\n\\\\\\\" )\\\\\\\
295 end\\\\\\\
296 else\\\\\\\
297 error( \\\\\\\"Failed to open \\\\\\\".._sPath )\\\\\\\
298 end\\\\\\\
299 end\\\\\\\
300 \\\\\\\
301 local ok, err = pcall( innerSave )\\\\\\\
302 if file then \\\\\\\
303 file.close()\\\\\\\
304 end\\\\\\\
305 return ok, err\\\\\\\
306end\\\\\\\
307\\\\\\\
308local tKeywords = {\\\\\\\
309 [\\\\\\\"and\\\\\\\"] = true,\\\\\\\
310 [\\\\\\\"break\\\\\\\"] = true,\\\\\\\
311 [\\\\\\\"do\\\\\\\"] = true,\\\\\\\
312 [\\\\\\\"else\\\\\\\"] = true,\\\\\\\
313 [\\\\\\\"elseif\\\\\\\"] = true,\\\\\\\
314 [\\\\\\\"end\\\\\\\"] = true,\\\\\\\
315 [\\\\\\\"false\\\\\\\"] = true,\\\\\\\
316 [\\\\\\\"for\\\\\\\"] = true,\\\\\\\
317 [\\\\\\\"function\\\\\\\"] = true,\\\\\\\
318 [\\\\\\\"if\\\\\\\"] = true,\\\\\\\
319 [\\\\\\\"in\\\\\\\"] = true,\\\\\\\
320 [\\\\\\\"local\\\\\\\"] = true,\\\\\\\
321 [\\\\\\\"nil\\\\\\\"] = true,\\\\\\\
322 [\\\\\\\"not\\\\\\\"] = true,\\\\\\\
323 [\\\\\\\"or\\\\\\\"] = true,\\\\\\\
324 [\\\\\\\"repeat\\\\\\\"] = true,\\\\\\\
325 [\\\\\\\"return\\\\\\\"] = true,\\\\\\\
326 [\\\\\\\"then\\\\\\\"] = true,\\\\\\\
327 [\\\\\\\"true\\\\\\\"] = true,\\\\\\\
328 [\\\\\\\"until\\\\\\\"]= true,\\\\\\\
329 [\\\\\\\"while\\\\\\\"] = true,\\\\\\\
330}\\\\\\\
331\\\\\\\
332local function tryWrite( sLine, regex, colour )\\\\\\\
333 local match = string.match( sLine, regex )\\\\\\\
334 if match then\\\\\\\
335 if type(colour) == \\\\\\\"number\\\\\\\" then\\\\\\\
336 term.setTextColour( colour )\\\\\\\
337 else\\\\\\\
338 term.setTextColour( colour(match) )\\\\\\\
339 end\\\\\\\
340 term.write( match )\\\\\\\
341 term.setTextColour( textColour )\\\\\\\
342 return string.sub( sLine, string.len(match) + 1 )\\\\\\\
343 end\\\\\\\
344 return nil\\\\\\\
345end\\\\\\\
346\\\\\\\
347local function writeHighlighted( sLine )\\\\\\\
348 while string.len(sLine) > 0 do \\\\\\\
349 sLine = \\\\\\\
350 tryWrite( sLine, \\\\\\\"^%-%-%[%[.-%]%]\\\\\\\", commentColour ) or\\\\\\\
351 tryWrite( sLine, \\\\\\\"^%-%-.*\\\\\\\", commentColour ) or\\\\\\\
352 tryWrite( sLine, \\\\\\\"^\\\\\\\\\\\\\\\".-[^\\\\\\\\\\\\\\\\]\\\\\\\\\\\\\\\"\\\\\\\", stringColour ) or\\\\\\\
353 tryWrite( sLine, \\\\\\\"^\\\\\\\\'.-[^\\\\\\\\\\\\\\\\]\\\\\\\\'\\\\\\\", stringColour ) or\\\\\\\
354 tryWrite( sLine, \\\\\\\"^%[%[.-%]%]\\\\\\\", stringColour ) or\\\\\\\
355 tryWrite( sLine, \\\\\\\"^[%w_]+\\\\\\\", function( match )\\\\\\\
356 if tKeywords[ match ] then\\\\\\\
357 return keywordColour\\\\\\\
358 end\\\\\\\
359 return textColour\\\\\\\
360 end ) or\\\\\\\
361 tryWrite( sLine, \\\\\\\"^[^%w_]\\\\\\\", textColour )\\\\\\\
362 end\\\\\\\
363end\\\\\\\
364\\\\\\\
365local tCompletions\\\\\\\
366local nCompletion\\\\\\\
367\\\\\\\
368local tCompleteEnv = _ENV\\\\\\\
369local function complete( sLine )\\\\\\\
370 local nStartPos = string.find( sLine, \\\\\\\"[a-zA-Z0-9_%.]+$\\\\\\\" )\\\\\\\
371 if nStartPos then\\\\\\\
372 sLine = string.sub( sLine, nStartPos )\\\\\\\
373 end\\\\\\\
374 if #sLine > 0 then\\\\\\\
375 return textutils.complete( sLine, tCompleteEnv )\\\\\\\
376 end\\\\\\\
377 return nil\\\\\\\
378end\\\\\\\
379\\\\\\\
380local function recomplete()\\\\\\\
381 local sLine = tLines[y]\\\\\\\
382 if not bMenu and not bReadOnly and x == string.len(sLine) + 1 then\\\\\\\
383 tCompletions = complete( sLine )\\\\\\\
384 if tCompletions and #tCompletions > 0 then\\\\\\\
385 nCompletion = 1\\\\\\\
386 else\\\\\\\
387 nCompletion = nil\\\\\\\
388 end\\\\\\\
389 else\\\\\\\
390 tCompletions = nil\\\\\\\
391 nCompletion = nil\\\\\\\
392 end\\\\\\\
393end\\\\\\\
394\\\\\\\
395local function writeCompletion( sLine )\\\\\\\
396 if nCompletion then\\\\\\\
397 local sCompletion = tCompletions[ nCompletion ]\\\\\\\
398 term.setTextColor( colours.white )\\\\\\\
399 term.setBackgroundColor( colours.grey )\\\\\\\
400 term.write( sCompletion )\\\\\\\
401 term.setTextColor( textColour )\\\\\\\
402 term.setBackgroundColor( bgColour )\\\\\\\
403 end\\\\\\\
404end\\\\\\\
405\\\\\\\
406local function redrawText()\\\\\\\
407 local cursorX, cursorY = x, y\\\\\\\
408 for y=1,h-1 do\\\\\\\
409 term.setCursorPos( 1 - scrollX, y )\\\\\\\
410 term.clearLine()\\\\\\\
411\\\\\\\
412 local sLine = tLines[ y + scrollY ]\\\\\\\
413 if sLine ~= nil then\\\\\\\
414 writeHighlighted( sLine )\\\\\\\
415 if cursorY == y and cursorX == #sLine + 1 then\\\\\\\
416 writeCompletion()\\\\\\\
417 end\\\\\\\
418 end\\\\\\\
419 end\\\\\\\
420 term.setCursorPos( x - scrollX, y - scrollY )\\\\\\\
421end\\\\\\\
422\\\\\\\
423local function redrawLine(_nY)\\\\\\\
424 local sLine = tLines[_nY]\\\\\\\
425 if sLine then\\\\\\\
426 term.setCursorPos( 1 - scrollX, _nY - scrollY )\\\\\\\
427 term.clearLine()\\\\\\\
428 writeHighlighted( sLine )\\\\\\\
429 if _nY == y and x == #sLine + 1 then\\\\\\\
430 writeCompletion()\\\\\\\
431 end\\\\\\\
432 term.setCursorPos( x - scrollX, _nY - scrollY )\\\\\\\
433 end\\\\\\\
434end\\\\\\\
435\\\\\\\
436local function redrawMenu()\\\\\\\
437 -- Clear line\\\\\\\
438 term.setCursorPos( 1, h )\\\\\\\
439 term.clearLine()\\\\\\\
440\\\\\\\
441 -- Draw line numbers\\\\\\\
442 term.setCursorPos( w - string.len( \\\\\\\"Ln \\\\\\\"..y ) + 1, h )\\\\\\\
443 term.setTextColour( highlightColour )\\\\\\\
444 term.write( \\\\\\\"Ln \\\\\\\" )\\\\\\\
445 term.setTextColour( textColour )\\\\\\\
446 term.write( y )\\\\\\\
447\\\\\\\
448 term.setCursorPos( 1, h )\\\\\\\
449 if bMenu then\\\\\\\
450 -- Draw menu\\\\\\\
451 term.setTextColour( textColour )\\\\\\\
452 for nItem,sItem in pairs( tMenuItems ) do\\\\\\\
453 if nItem == nMenuItem then\\\\\\\
454 term.setTextColour( highlightColour )\\\\\\\
455 term.write( \\\\\\\"[\\\\\\\" )\\\\\\\
456 term.setTextColour( textColour )\\\\\\\
457 term.write( sItem )\\\\\\\
458 term.setTextColour( highlightColour )\\\\\\\
459 term.write( \\\\\\\"]\\\\\\\" )\\\\\\\
460 term.setTextColour( textColour )\\\\\\\
461 else\\\\\\\
462 term.write( \\\\\\\" \\\\\\\"..sItem..\\\\\\\" \\\\\\\" )\\\\\\\
463 end\\\\\\\
464 end\\\\\\\
465 else\\\\\\\
466 -- Draw status\\\\\\\
467 term.setTextColour( highlightColour )\\\\\\\
468 term.write( sStatus )\\\\\\\
469 term.setTextColour( textColour )\\\\\\\
470 end\\\\\\\
471\\\\\\\
472 -- Reset cursor\\\\\\\
473 term.setCursorPos( x - scrollX, y - scrollY )\\\\\\\
474end\\\\\\\
475\\\\\\\
476local tMenuFuncs = { \\\\\\\
477 Save = function()\\\\\\\
478 if bReadOnly then\\\\\\\
479 sStatus = \\\\\\\"Access denied\\\\\\\"\\\\\\\
480 else\\\\\\\
481 local ok, err = save( sPath )\\\\\\\
482 if ok then\\\\\\\
483 sStatus=\\\\\\\"Saved to \\\\\\\"..sPath\\\\\\\
484 else\\\\\\\
485 sStatus=\\\\\\\"Error saving to \\\\\\\"..sPath\\\\\\\
486 end\\\\\\\
487 end\\\\\\\
488 redrawMenu()\\\\\\\
489 end,\\\\\\\
490 Print = function()\\\\\\\
491 local printer = peripheral.find( \\\\\\\"printer\\\\\\\" )\\\\\\\
492 if not printer then\\\\\\\
493 sStatus = \\\\\\\"No printer attached\\\\\\\"\\\\\\\
494 return\\\\\\\
495 end\\\\\\\
496\\\\\\\
497 local nPage = 0\\\\\\\
498 local sName = fs.getName( sPath )\\\\\\\
499 if printer.getInkLevel() < 1 then\\\\\\\
500 sStatus = \\\\\\\"Printer out of ink\\\\\\\"\\\\\\\
501 return\\\\\\\
502 elseif printer.getPaperLevel() < 1 then\\\\\\\
503 sStatus = \\\\\\\"Printer out of paper\\\\\\\"\\\\\\\
504 return\\\\\\\
505 end\\\\\\\
506\\\\\\\
507 local screenTerminal = term.current()\\\\\\\
508 local printerTerminal = {\\\\\\\
509 getCursorPos = printer.getCursorPos,\\\\\\\
510 setCursorPos = printer.setCursorPos,\\\\\\\
511 getSize = printer.getPageSize,\\\\\\\
512 write = printer.write,\\\\\\\
513 }\\\\\\\
514 printerTerminal.scroll = function()\\\\\\\
515 if nPage == 1 then\\\\\\\
516 printer.setPageTitle( sName..\\\\\\\" (page \\\\\\\"..nPage..\\\\\\\")\\\\\\\" ) \\\\\\\
517 end\\\\\\\
518 \\\\\\\
519 while not printer.newPage() do\\\\\\\
520 if printer.getInkLevel() < 1 then\\\\\\\
521 sStatus = \\\\\\\"Printer out of ink, please refill\\\\\\\"\\\\\\\
522 elseif printer.getPaperLevel() < 1 then\\\\\\\
523 sStatus = \\\\\\\"Printer out of paper, please refill\\\\\\\"\\\\\\\
524 else\\\\\\\
525 sStatus = \\\\\\\"Printer output tray full, please empty\\\\\\\"\\\\\\\
526 end\\\\\\\
527 \\\\\\\
528 term.redirect( screenTerminal )\\\\\\\
529 redrawMenu()\\\\\\\
530 term.redirect( printerTerminal )\\\\\\\
531 \\\\\\\
532 local timer = os.startTimer(0.5)\\\\\\\
533 sleep(0.5)\\\\\\\
534 end\\\\\\\
535\\\\\\\
536 nPage = nPage + 1\\\\\\\
537 if nPage == 1 then\\\\\\\
538 printer.setPageTitle( sName )\\\\\\\
539 else\\\\\\\
540 printer.setPageTitle( sName..\\\\\\\" (page \\\\\\\"..nPage..\\\\\\\")\\\\\\\" )\\\\\\\
541 end\\\\\\\
542 end\\\\\\\
543 \\\\\\\
544 bMenu = false\\\\\\\
545 term.redirect( printerTerminal )\\\\\\\
546 local ok, error = pcall( function()\\\\\\\
547 term.scroll()\\\\\\\
548 for n, sLine in ipairs( tLines ) do\\\\\\\
549 print( sLine )\\\\\\\
550 end\\\\\\\
551 end )\\\\\\\
552 term.redirect( screenTerminal )\\\\\\\
553 if not ok then\\\\\\\
554 print( error )\\\\\\\
555 end\\\\\\\
556 \\\\\\\
557 while not printer.endPage() do\\\\\\\
558 sStatus = \\\\\\\"Printer output tray full, please empty\\\\\\\"\\\\\\\
559 redrawMenu()\\\\\\\
560 sleep( 0.5 )\\\\\\\
561 end\\\\\\\
562 bMenu = true\\\\\\\
563 \\\\\\\
564 if nPage > 1 then\\\\\\\
565 sStatus = \\\\\\\"Printed \\\\\\\"..nPage..\\\\\\\" Pages\\\\\\\"\\\\\\\
566 else\\\\\\\
567 sStatus = \\\\\\\"Printed 1 Page\\\\\\\"\\\\\\\
568 end\\\\\\\
569 redrawMenu()\\\\\\\
570 end,\\\\\\\
571 Exit = function()\\\\\\\
572 bRunning = false\\\\\\\
573 end,\\\\\\\
574 Run = function()\\\\\\\
575 local sTempPath = \\\\\\\"/.temp\\\\\\\"\\\\\\\
576 local ok, err = save( sTempPath )\\\\\\\
577 if ok then\\\\\\\
578 local nTask = shell.openTab( sTempPath )\\\\\\\
579 if nTask then\\\\\\\
580 shell.switchTab( nTask )\\\\\\\
581 else\\\\\\\
582 sStatus=\\\\\\\"Error starting Task\\\\\\\"\\\\\\\
583 end\\\\\\\
584 fs.delete( sTempPath )\\\\\\\
585 else\\\\\\\
586 sStatus=\\\\\\\"Error saving to \\\\\\\"..sTempPath\\\\\\\
587 end\\\\\\\
588 redrawMenu()\\\\\\\
589 end\\\\\\\
590}\\\\\\\
591\\\\\\\
592local function doMenuItem( _n )\\\\\\\
593 tMenuFuncs[tMenuItems[_n]]()\\\\\\\
594 if bMenu then\\\\\\\
595 bMenu = false\\\\\\\
596 term.setCursorBlink( true )\\\\\\\
597 end\\\\\\\
598 redrawMenu()\\\\\\\
599end\\\\\\\
600\\\\\\\
601local function setCursor( newX, newY )\\\\\\\
602 local oldX, oldY = x, y\\\\\\\
603 x, y = newX, newY\\\\\\\
604 local screenX = x - scrollX\\\\\\\
605 local screenY = y - scrollY\\\\\\\
606 \\\\\\\
607 local bRedraw = false\\\\\\\
608 if screenX < 1 then\\\\\\\
609 scrollX = x - 1\\\\\\\
610 screenX = 1\\\\\\\
611 bRedraw = true\\\\\\\
612 elseif screenX > w then\\\\\\\
613 scrollX = x - w\\\\\\\
614 screenX = w\\\\\\\
615 bRedraw = true\\\\\\\
616 end\\\\\\\
617 \\\\\\\
618 if screenY < 1 then\\\\\\\
619 scrollY = y - 1\\\\\\\
620 screenY = 1\\\\\\\
621 bRedraw = true\\\\\\\
622 elseif screenY > h-1 then\\\\\\\
623 scrollY = y - (h-1)\\\\\\\
624 screenY = h-1\\\\\\\
625 bRedraw = true\\\\\\\
626 end\\\\\\\
627\\\\\\\
628 recomplete()\\\\\\\
629 if bRedraw then\\\\\\\
630 redrawText()\\\\\\\
631 elseif y ~= oldY then\\\\\\\
632 redrawLine( oldY )\\\\\\\
633 redrawLine( y )\\\\\\\
634 else\\\\\\\
635 redrawLine( y )\\\\\\\
636 end\\\\\\\
637 term.setCursorPos( screenX, screenY )\\\\\\\
638\\\\\\\
639 redrawMenu()\\\\\\\
640end\\\\\\\
641\\\\\\\
642-- Actual program functionality begins\\\\\\\
643load(sPath)\\\\\\\
644\\\\\\\
645term.setBackgroundColour( bgColour )\\\\\\\
646term.clear()\\\\\\\
647term.setCursorPos(x,y)\\\\\\\
648term.setCursorBlink( true )\\\\\\\
649\\\\\\\
650recomplete()\\\\\\\
651redrawText()\\\\\\\
652redrawMenu()\\\\\\\
653\\\\\\\
654local function acceptCompletion()\\\\\\\
655 if nCompletion then\\\\\\\
656 -- Find the common prefix of all the other suggestions which start with the same letter as the current one\\\\\\\
657 local sCompletion = tCompletions[ nCompletion ]\\\\\\\
658 local sFirstLetter = string.sub( sCompletion, 1, 1 )\\\\\\\
659 local sCommonPrefix = sCompletion\\\\\\\
660 for n=1,#tCompletions do\\\\\\\
661 local sResult = tCompletions[n]\\\\\\\
662 if n ~= nCompletion and string.find( sResult, sFirstLetter, 1, true ) == 1 then\\\\\\\
663 while #sCommonPrefix > 1 do\\\\\\\
664 if string.find( sResult, sCommonPrefix, 1, true ) == 1 then\\\\\\\
665 break\\\\\\\
666 else\\\\\\\
667 sCommonPrefix = string.sub( sCommonPrefix, 1, #sCommonPrefix - 1 )\\\\\\\
668 end\\\\\\\
669 end\\\\\\\
670 end\\\\\\\
671 end\\\\\\\
672\\\\\\\
673 -- Append this string\\\\\\\
674 tLines[y] = tLines[y] .. sCommonPrefix\\\\\\\
675 setCursor( x + string.len( sCommonPrefix ), y )\\\\\\\
676 end\\\\\\\
677end\\\\\\\
678\\\\\\\
679-- Handle input\\\\\\\
680while bRunning do\\\\\\\
681 local sEvent, param, param2, param3 = os.pullEvent()\\\\\\\
682 if sEvent == \\\\\\\"key\\\\\\\" then\\\\\\\
683 local oldX, oldY = x, y\\\\\\\
684 if param == keys.up then\\\\\\\
685 -- Up\\\\\\\
686 if not bMenu then\\\\\\\
687 if nCompletion then\\\\\\\
688 -- Cycle completions\\\\\\\
689 nCompletion = nCompletion - 1\\\\\\\
690 if nCompletion < 1 then\\\\\\\
691 nCompletion = #tCompletions\\\\\\\
692 end\\\\\\\
693 redrawLine(y)\\\\\\\
694\\\\\\\
695 elseif y > 1 then\\\\\\\
696 -- Move cursor up\\\\\\\
697 setCursor(\\\\\\\
698 math.min( x, string.len( tLines[y - 1] ) + 1 ),\\\\\\\
699 y - 1\\\\\\\
700 )\\\\\\\
701 end\\\\\\\
702 end\\\\\\\
703\\\\\\\
704 elseif param == keys.down then\\\\\\\
705 -- Down\\\\\\\
706 if not bMenu then\\\\\\\
707 -- Move cursor down\\\\\\\
708 if nCompletion then\\\\\\\
709 -- Cycle completions\\\\\\\
710 nCompletion = nCompletion + 1\\\\\\\
711 if nCompletion > #tCompletions then\\\\\\\
712 nCompletion = 1\\\\\\\
713 end\\\\\\\
714 redrawLine(y)\\\\\\\
715\\\\\\\
716 elseif y < #tLines then\\\\\\\
717 -- Move cursor down\\\\\\\
718 setCursor(\\\\\\\
719 math.min( x, string.len( tLines[y + 1] ) + 1 ),\\\\\\\
720 y + 1\\\\\\\
721 )\\\\\\\
722 end\\\\\\\
723 end\\\\\\\
724\\\\\\\
725 elseif param == keys.tab then\\\\\\\
726 -- Tab\\\\\\\
727 if not bMenu and not bReadOnly then\\\\\\\
728 if nCompletion and x == string.len(tLines[y]) + 1 then\\\\\\\
729 -- Accept autocomplete\\\\\\\
730 acceptCompletion()\\\\\\\
731 else\\\\\\\
732 -- Indent line\\\\\\\
733 local sLine = tLines[y]\\\\\\\
734 tLines[y] = string.sub(sLine,1,x-1) .. \\\\\\\" \\\\\\\" .. string.sub(sLine,x)\\\\\\\
735 setCursor( x + 2, y )\\\\\\\
736 end\\\\\\\
737 end\\\\\\\
738\\\\\\\
739 elseif param == keys.pageUp then\\\\\\\
740 -- Page Up\\\\\\\
741 if not bMenu then\\\\\\\
742 -- Move up a page\\\\\\\
743 local newY\\\\\\\
744 if y - (h - 1) >= 1 then\\\\\\\
745 newY = y - (h - 1)\\\\\\\
746 else\\\\\\\
747 newY = 1\\\\\\\
748 end\\\\\\\
749 setCursor(\\\\\\\
750 math.min( x, string.len( tLines[newY] ) + 1 ),\\\\\\\
751 newY\\\\\\\
752 )\\\\\\\
753 end\\\\\\\
754\\\\\\\
755 elseif param == keys.pageDown then\\\\\\\
756 -- Page Down\\\\\\\
757 if not bMenu then\\\\\\\
758 -- Move down a page\\\\\\\
759 local newY\\\\\\\
760 if y + (h - 1) <= #tLines then\\\\\\\
761 newY = y + (h - 1)\\\\\\\
762 else\\\\\\\
763 newY = #tLines\\\\\\\
764 end\\\\\\\
765 local newX = math.min( x, string.len( tLines[newY] ) + 1 )\\\\\\\
766 setCursor( newX, newY )\\\\\\\
767 end\\\\\\\
768\\\\\\\
769 elseif param == keys.home then\\\\\\\
770 -- Home\\\\\\\
771 if not bMenu then\\\\\\\
772 -- Move cursor to the beginning\\\\\\\
773 if x > 1 then\\\\\\\
774 setCursor(1,y)\\\\\\\
775 end\\\\\\\
776 end\\\\\\\
777\\\\\\\
778 elseif param == keys[\\\\\\\"end\\\\\\\"] then\\\\\\\
779 -- End\\\\\\\
780 if not bMenu then\\\\\\\
781 -- Move cursor to the end\\\\\\\
782 local nLimit = string.len( tLines[y] ) + 1\\\\\\\
783 if x < nLimit then\\\\\\\
784 setCursor( nLimit, y )\\\\\\\
785 end\\\\\\\
786 end\\\\\\\
787\\\\\\\
788 elseif param == keys.left then\\\\\\\
789 -- Left\\\\\\\
790 if not bMenu then\\\\\\\
791 if x > 1 then\\\\\\\
792 -- Move cursor left\\\\\\\
793 setCursor( x - 1, y )\\\\\\\
794 elseif x==1 and y>1 then\\\\\\\
795 setCursor( string.len( tLines[y-1] ) + 1, y - 1 )\\\\\\\
796 end\\\\\\\
797 else\\\\\\\
798 -- Move menu left\\\\\\\
799 nMenuItem = nMenuItem - 1\\\\\\\
800 if nMenuItem < 1 then\\\\\\\
801 nMenuItem = #tMenuItems\\\\\\\
802 end\\\\\\\
803 redrawMenu()\\\\\\\
804 end\\\\\\\
805\\\\\\\
806 elseif param == keys.right then\\\\\\\
807 -- Right\\\\\\\
808 if not bMenu then\\\\\\\
809 local nLimit = string.len( tLines[y] ) + 1\\\\\\\
810 if x < nLimit then\\\\\\\
811 -- Move cursor right\\\\\\\
812 setCursor( x + 1, y )\\\\\\\
813 elseif nCompletion and x == string.len(tLines[y]) + 1 then\\\\\\\
814 -- Accept autocomplete\\\\\\\
815 acceptCompletion()\\\\\\\
816 elseif x==nLimit and y<#tLines then\\\\\\\
817 -- Go to next line\\\\\\\
818 setCursor( 1, y + 1 )\\\\\\\
819 end\\\\\\\
820 else\\\\\\\
821 -- Move menu right\\\\\\\
822 nMenuItem = nMenuItem + 1\\\\\\\
823 if nMenuItem > #tMenuItems then\\\\\\\
824 nMenuItem = 1\\\\\\\
825 end\\\\\\\
826 redrawMenu()\\\\\\\
827 end\\\\\\\
828\\\\\\\
829 elseif param == keys.delete then\\\\\\\
830 -- Delete\\\\\\\
831 if not bMenu and not bReadOnly then\\\\\\\
832 local nLimit = string.len( tLines[y] ) + 1\\\\\\\
833 if x < nLimit then\\\\\\\
834 local sLine = tLines[y]\\\\\\\
835 tLines[y] = string.sub(sLine,1,x-1) .. string.sub(sLine,x+1)\\\\\\\
836 recomplete()\\\\\\\
837 redrawLine(y)\\\\\\\
838 elseif y<#tLines then\\\\\\\
839 tLines[y] = tLines[y] .. tLines[y+1]\\\\\\\
840 table.remove( tLines, y+1 )\\\\\\\
841 recomplete()\\\\\\\
842 redrawText()\\\\\\\
843 end\\\\\\\
844 end\\\\\\\
845\\\\\\\
846 elseif param == keys.backspace then\\\\\\\
847 -- Backspace\\\\\\\
848 if not bMenu and not bReadOnly then\\\\\\\
849 if x > 1 then\\\\\\\
850 -- Remove character\\\\\\\
851 local sLine = tLines[y]\\\\\\\
852 tLines[y] = string.sub(sLine,1,x-2) .. string.sub(sLine,x)\\\\\\\
853 setCursor( x - 1, y )\\\\\\\
854 elseif y > 1 then\\\\\\\
855 -- Remove newline\\\\\\\
856 local sPrevLen = string.len( tLines[y-1] )\\\\\\\
857 tLines[y-1] = tLines[y-1] .. tLines[y]\\\\\\\
858 table.remove( tLines, y )\\\\\\\
859 setCursor( sPrevLen + 1, y - 1 )\\\\\\\
860 redrawText()\\\\\\\
861 end\\\\\\\
862 end\\\\\\\
863\\\\\\\
864 elseif param == keys.enter then\\\\\\\
865 -- Enter\\\\\\\
866 if not bMenu and not bReadOnly then\\\\\\\
867 -- Newline\\\\\\\
868 local sLine = tLines[y]\\\\\\\
869 local _,spaces=string.find(sLine,\\\\\\\"^[ ]+\\\\\\\")\\\\\\\
870 if not spaces then\\\\\\\
871 spaces=0\\\\\\\
872 end\\\\\\\
873 tLines[y] = string.sub(sLine,1,x-1)\\\\\\\
874 table.insert( tLines, y+1, string.rep(' ',spaces)..string.sub(sLine,x) )\\\\\\\
875 setCursor( spaces + 1, y + 1 )\\\\\\\
876 redrawText()\\\\\\\
877\\\\\\\
878 elseif bMenu then\\\\\\\
879 -- Menu selection\\\\\\\
880 doMenuItem( nMenuItem )\\\\\\\
881\\\\\\\
882 end\\\\\\\
883\\\\\\\
884 elseif param == keys.leftCtrl or param == keys.rightCtrl or param == keys.rightAlt then\\\\\\\
885 -- Menu toggle\\\\\\\
886 bMenu = not bMenu\\\\\\\
887 if bMenu then\\\\\\\
888 term.setCursorBlink( false )\\\\\\\
889 else\\\\\\\
890 term.setCursorBlink( true )\\\\\\\
891 end\\\\\\\
892 redrawMenu()\\\\\\\
893\\\\\\\
894 end\\\\\\\
895 \\\\\\\
896 elseif sEvent == \\\\\\\"char\\\\\\\" then\\\\\\\
897 if not bMenu and not bReadOnly then\\\\\\\
898 -- Input text\\\\\\\
899 local sLine = tLines[y]\\\\\\\
900 tLines[y] = string.sub(sLine,1,x-1) .. param .. string.sub(sLine,x)\\\\\\\
901 setCursor( x + 1, y )\\\\\\\
902\\\\\\\
903 elseif bMenu then\\\\\\\
904 -- Select menu items\\\\\\\
905 for n,sMenuItem in ipairs( tMenuItems ) do\\\\\\\
906 if string.lower(string.sub(sMenuItem,1,1)) == string.lower(param) then\\\\\\\
907 doMenuItem( n )\\\\\\\
908 break\\\\\\\
909 end\\\\\\\
910 end\\\\\\\
911 end\\\\\\\
912\\\\\\\
913 elseif sEvent == \\\\\\\"paste\\\\\\\" then\\\\\\\
914 if not bMenu and not bReadOnly then\\\\\\\
915 -- Input text\\\\\\\
916 local sLine = tLines[y]\\\\\\\
917 tLines[y] = string.sub(sLine,1,x-1) .. param .. string.sub(sLine,x)\\\\\\\
918 setCursor( x + string.len( param ), y )\\\\\\\
919 end\\\\\\\
920 \\\\\\\
921 elseif sEvent == \\\\\\\"mouse_click\\\\\\\" then\\\\\\\
922 if not bMenu then\\\\\\\
923 if param == 1 then\\\\\\\
924 -- Left click\\\\\\\
925 local cx,cy = param2, param3\\\\\\\
926 if cy < h then\\\\\\\
927 local newY = math.min( math.max( scrollY + cy, 1 ), #tLines )\\\\\\\
928 local newX = math.min( math.max( scrollX + cx, 1 ), string.len( tLines[newY] ) + 1 )\\\\\\\
929 setCursor( newX, newY )\\\\\\\
930 end\\\\\\\
931 end\\\\\\\
932 end\\\\\\\
933 \\\\\\\
934 elseif sEvent == \\\\\\\"mouse_scroll\\\\\\\" then\\\\\\\
935 if not bMenu then\\\\\\\
936 if param == -1 then\\\\\\\
937 -- Scroll up\\\\\\\
938 if scrollY > 0 then\\\\\\\
939 -- Move cursor up\\\\\\\
940 scrollY = scrollY - 1\\\\\\\
941 redrawText()\\\\\\\
942 end\\\\\\\
943 \\\\\\\
944 elseif param == 1 then\\\\\\\
945 -- Scroll down\\\\\\\
946 local nMaxScroll = #tLines - (h-1)\\\\\\\
947 if scrollY < nMaxScroll then\\\\\\\
948 -- Move cursor down\\\\\\\
949 scrollY = scrollY + 1\\\\\\\
950 redrawText()\\\\\\\
951 end\\\\\\\
952 \\\\\\\
953 end\\\\\\\
954 end\\\\\\\
955\\\\\\\
956 elseif sEvent == \\\\\\\"term_resize\\\\\\\" then\\\\\\\
957 w,h = term.getSize()\\\\\\\
958 setCursor( x, y )\\\\\\\
959 redrawMenu()\\\\\\\
960 redrawText()\\\\\\\
961\\\\\\\
962 end\\\\\\\
963end\\\\\\\
964\\\\\\\
965-- Cleanup\\\\\\\
966term.clear()\\\\\\\
967term.setCursorBlink( false )\\\\\\\
968term.setCursorPos( 1, 1 )\\\"\",\
969 \"F:firststeps\",\
970 \"\\\"gui.printAppInfo(\\\\\\\"man\\\\\\\", kernel.findManual(\\\\\\\"firststeps\\\\\\\"))\\\"\",\
971 \"F:hostname\",\
972 \"\\\"gui.printAppInfo(\\\\\\\"net\\\\\\\", \\\\\\\"hostname is \\\\\\\"..os.getComputerLabel())\\\"\",\
973 \"F:lsh\",\
974 \"\\\"local bRunning = true\\\\\\\
975local tCommandHistory = {}\\\\\\\
976local tEnv = {\\\\\\\
977 [\\\\\\\"exit\\\\\\\"] = function()\\\\\\\
978 bRunning = false\\\\\\\
979 end,\\\\\\\
980 [\\\\\\\"_echo\\\\\\\"] = function( ... )\\\\\\\
981 return ...\\\\\\\
982 end,\\\\\\\
983}\\\\\\\
984\\\\\\\
985if not security.getSU() then\\\\\\\
986 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
987 return\\\\\\\
988end\\\\\\\
989\\\\\\\
990setmetatable( tEnv, { __index = _ENV } )\\\\\\\
991\\\\\\\
992local label = os.getComputerLabel() or os.getComputerID()\\\\\\\
993\\\\\\\
994term.setTextColour( colours.yellow )\\\\\\\
995print( os.version() )\\\\\\\
996print( \\\\\\\"Manual Lua code interpreter. Call exit() to abort.\\\\\\\" )\\\\\\\
997term.setTextColour( colours.white )\\\\\\\
998\\\\\\\
999while bRunning do\\\\\\\
1000 if security.getActiveUserStatus() then\\\\\\\
1001 term.setTextColour( colours.lime )\\\\\\\
1002 else\\\\\\\
1003 term.setTextColour( colours.orange )\\\\\\\
1004 end\\\\\\\
1005 write( _activeUser )\\\\\\\
1006 term.setTextColour( colours.lightGrey )\\\\\\\
1007 write( \\\\\\\"@\\\\\\\" )\\\\\\\
1008 term.setTextColour( colours.lightBlue )\\\\\\\
1009 write( label )\\\\\\\
1010 term.setTextColour( colours.lightGrey )\\\\\\\
1011 write( \\\\\\\"/\\\\\\\" )\\\\\\\
1012 term.setTextColour( colours.lightBlue )\\\\\\\
1013 write( shell.dir() )\\\\\\\
1014 if security.getActiveUserStatus() then\\\\\\\
1015 term.setTextColour( colours.lime )\\\\\\\
1016 else\\\\\\\
1017 term.setTextColour( colours.orange )\\\\\\\
1018 end\\\\\\\
1019 write( \\\\\\\" % \\\\\\\" )\\\\\\\
1020\\\\\\\
1021 term.setTextColour( colours.white )\\\\\\\
1022\\\\\\\
1023 local s = read( nil, tCommandHistory, function( sLine )\\\\\\\
1024 local nStartPos = string.find( sLine, \\\\\\\"[a-zA-Z0-9_%.]+$\\\\\\\" )\\\\\\\
1025 if nStartPos then\\\\\\\
1026 sLine = string.sub( sLine, nStartPos )\\\\\\\
1027 end\\\\\\\
1028 if #sLine > 0 then\\\\\\\
1029 return textutils.complete( sLine, tEnv )\\\\\\\
1030 end\\\\\\\
1031 return nil\\\\\\\
1032 end )\\\\\\\
1033 term.setTextColour( colours.lightGrey )\\\\\\\
1034 table.insert( tCommandHistory, s )\\\\\\\
1035 \\\\\\\
1036 local nForcePrint = 0\\\\\\\
1037 local func, e = load( s, \\\\\\\"lua\\\\\\\", \\\\\\\"t\\\\\\\", tEnv )\\\\\\\
1038 local func2, e2 = load( \\\\\\\"return _echo(\\\\\\\"..s..\\\\\\\");\\\\\\\", \\\\\\\"lua\\\\\\\", \\\\\\\"t\\\\\\\", tEnv )\\\\\\\
1039 if not func then\\\\\\\
1040 if func2 then\\\\\\\
1041 func = func2\\\\\\\
1042 e = nil\\\\\\\
1043 nForcePrint = 1\\\\\\\
1044 end\\\\\\\
1045 else\\\\\\\
1046 if func2 then\\\\\\\
1047 func = func2\\\\\\\
1048 end\\\\\\\
1049 end\\\\\\\
1050 \\\\\\\
1051 if func then\\\\\\\
1052 local tResults = { pcall( func ) }\\\\\\\
1053 if tResults[1] then\\\\\\\
1054 local n = 1\\\\\\\
1055 while (tResults[n + 1] ~= nil) or (n <= nForcePrint) do\\\\\\\
1056 local value = tResults[ n + 1 ]\\\\\\\
1057 if type( value ) == \\\\\\\"table\\\\\\\" then\\\\\\\
1058 local ok, serialised = pcall( textutils.serialise, value )\\\\\\\
1059 if ok then\\\\\\\
1060 print( serialised )\\\\\\\
1061 else\\\\\\\
1062 print( tostring( value ) )\\\\\\\
1063 end\\\\\\\
1064 else\\\\\\\
1065 print( tostring( value ) )\\\\\\\
1066 end\\\\\\\
1067 n = n + 1\\\\\\\
1068 end\\\\\\\
1069 else\\\\\\\
1070 printError( tResults[2] )\\\\\\\
1071 end\\\\\\\
1072 else\\\\\\\
1073 printError( e )\\\\\\\
1074 end\\\\\\\
1075 \\\\\\\
1076end\\\"\",\
1077 \"F:man\",\
1078 \"\\\"local tArgs = {...}\\\\\\\
1079\\\\\\\
1080if #tArgs < 1 then\\\\\\\
1081 gui.printAppInfo(\\\\\\\"man\\\\\\\", \\\\\\\"type 'ls system/man-pages' or 'manpages'\\\\\\\")\\\\\\\
1082else\\\\\\\
1083 gui.printAppInfo(\\\\\\\"man\\\\\\\", kernel.findManual(tArgs[1]))\\\\\\\
1084end\\\"\",\
1085 \"F:manedit\",\
1086 \"\\\"local tArgs = {...}\\\\\\\
1087\\\\\\\
1088if not security.getSU() then\\\\\\\
1089 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
1090 return\\\\\\\
1091end\\\\\\\
1092\\\\\\\
1093if #tArgs < 1 then\\\\\\\
1094 gui.printAppInfo(\\\\\\\"edit\\\\\\\", \\\\\\\"filename not specified\\\\\\\")\\\\\\\
1095 return\\\\\\\
1096end\\\\\\\
1097\\\\\\\
1098shell.run(\\\\\\\"/rom/programs/edit /etc/manuals/\\\\\\\"..tArgs[1])\\\"\",\
1099 \"F:manpages\",\
1100 \"\\\"shell.run(\\\\\\\"/rom/programs/list /etc/manuals\\\\\\\")\\\"\",\
1101 \"F:mkusr\",\
1102 \"\\\"local tArgs = {...}\\\\\\\
1103\\\\\\\
1104if #tArgs < 2 then\\\\\\\
1105 gui.printAppInfo(\\\\\\\"security\\\\\\\", \\\\\\\"specify username and password\\\\\\\")\\\\\\\
1106 return\\\\\\\
1107end\\\\\\\
1108\\\\\\\
1109if fs.exists(\\\\\\\"/etc/passwd/\\\\\\\"..tArgs[1]..\\\\\\\".dat\\\\\\\") and not fs.isDir(\\\\\\\"/etc/passwd/\\\\\\\"..tArgs[1]..\\\\\\\".dat\\\\\\\") then\\\\\\\
1110 gui.printAppInfo(\\\\\\\"security\\\\\\\", \\\\\\\"user already exists\\\\\\\")\\\\\\\
1111 return\\\\\\\
1112end\\\\\\\
1113\\\\\\\
1114if not security.getSU() then\\\\\\\
1115 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
1116 return\\\\\\\
1117end\\\\\\\
1118\\\\\\\
1119if security.passbyte(tArgs[1], tArgs[2]) then\\\\\\\
1120 gui.printAppSuccess(\\\\\\\"security\\\\\\\", \\\\\\\"user \\\\\\\"..tArgs[1]..\\\\\\\" registered\\\\\\\")\\\\\\\
1121 log.writeSecurity(\\\\\\\"user \\\\\\\"..tArgs[1]..\\\\\\\" registered\\\\\\\")\\\\\\\
1122 fs.makeDir(\\\\\\\"/home/\\\\\\\"..tArgs[1])\\\\\\\
1123else\\\\\\\
1124 gui.printAppInfo(\\\\\\\"security\\\\\\\", \\\\\\\"failed to register user\\\\\\\")\\\\\\\
1125 log.writeSecurity(\\\\\\\"failed to register user\\\\\\\")\\\\\\\
1126end\\\"\",\
1127 \"F:netutil1\",\
1128 \"\\\"-- testing\\\\\\\
1129net.openModems()\\\\\\\
1130net.setWorkstationStatus(true)\\\\\\\
1131print(tostring(net.getWorkstationStatus()))\\\"\",\
1132 \"F:passwd\",\
1133 \"\\\"local tArgs = {...}\\\\\\\
1134\\\\\\\
1135if #tArgs < 2 then\\\\\\\
1136 gui.printAppInfo(\\\\\\\"security\\\\\\\", \\\\\\\"specify username and password\\\\\\\")\\\\\\\
1137 return\\\\\\\
1138end\\\\\\\
1139\\\\\\\
1140if not security.getSU() then\\\\\\\
1141 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
1142 return\\\\\\\
1143end\\\\\\\
1144\\\\\\\
1145if fs.exists(\\\\\\\"/system/data/users/\\\\\\\"..tArgs[1]..\\\\\\\".dat\\\\\\\") and not fs.isDir(\\\\\\\"/system/data/users/\\\\\\\"..tArgs[1]..\\\\\\\".dat\\\\\\\") then\\\\\\\
1146 if security.passbyte(tArgs[1], tArgs[2]) then\\\\\\\
1147 gui.printAppSuccess(\\\\\\\"security\\\\\\\", \\\\\\\"password of \\\\\\\"..tArgs[1]..\\\\\\\" changed\\\\\\\")\\\\\\\
1148 log.writeSecurity(\\\\\\\"password of \\\\\\\"..tArgs[1]..\\\\\\\" changed\\\\\\\")\\\\\\\
1149 else\\\\\\\
1150 gui.printAppInfo(\\\\\\\"security\\\\\\\", \\\\\\\"failed to change password\\\\\\\")\\\\\\\
1151 log.writeSecurity(\\\\\\\"failed to change password\\\\\\\")\\\\\\\
1152 end\\\\\\\
1153else\\\\\\\
1154 gui.printAppInfo(\\\\\\\"security\\\\\\\", \\\\\\\"user does not exist\\\\\\\")\\\\\\\
1155end\\\"\",\
1156 \"F:rmusr\",\
1157 \"\\\"local tArgs = { ... }\\\\\\\
1158\\\\\\\
1159if #tArgs < 1 then\\\\\\\
1160 gui.printAppInfo( \\\\\\\"security\\\\\\\", \\\\\\\"username not specified\\\\\\\" )\\\\\\\
1161 return\\\\\\\
1162end\\\\\\\
1163\\\\\\\
1164if not security.getSU() or tArgs[1] == \\\\\\\"root\\\\\\\" then\\\\\\\
1165 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
1166 return\\\\\\\
1167end\\\\\\\
1168\\\\\\\
1169local pathA = \\\\\\\"/etc/passwd/\\\\\\\"..tArgs[1]..\\\\\\\".dat\\\\\\\"\\\\\\\
1170local pathB = \\\\\\\"/etc/passwd/.shadow/\\\\\\\"..tArgs[1]..\\\\\\\".usr\\\\\\\"\\\\\\\
1171local pathC = \\\\\\\"/home/\\\\\\\"..tArgs[1]\\\\\\\
1172\\\\\\\
1173if fs.exists(pathA) then\\\\\\\
1174 if gui.request(\\\\\\\"remove user record\\\\\\\") then\\\\\\\
1175 fs.delete( pathA )\\\\\\\
1176 if fs.exists(pathB) then\\\\\\\
1177 fs.delete( pathB )\\\\\\\
1178 end\\\\\\\
1179 fs.delete( pathC )\\\\\\\
1180 end\\\\\\\
1181else\\\\\\\
1182 gui.printAppInfo(\\\\\\\"security\\\\\\\", \\\\\\\"user does not exist\\\\\\\")\\\\\\\
1183end\\\"\",\
1184 \"F:script\",\
1185 \"\\\"local tArgs = {...}\\\\\\\
1186\\\\\\\
1187if #tArgs >= 1 then\\\\\\\
1188 shell.executeScript(shell.resolve(tArgs[1]))\\\\\\\
1189else\\\\\\\
1190 gui.printAppInfo(\\\\\\\"script\\\\\\\", \\\\\\\"filename not specified\\\\\\\")\\\\\\\
1191end\\\"\",\
1192 \"F:sh\",\
1193 \"\\\"local tArgs = {...}\\\\\\\
1194\\\\\\\
1195local parentShell = shell\\\\\\\
1196\\\\\\\
1197local bExit = false\\\\\\\
1198local sDir = (parentShell and parentShell.dir()) or \\\\\\\"\\\\\\\"\\\\\\\
1199local sPath = (parentShell and parentShell.path()) or \\\\\\\".:/rom/programs\\\\\\\"\\\\\\\
1200local tAliases = (parentShell and parentShell.aliases()) or {}\\\\\\\
1201local tProgramStack = {}\\\\\\\
1202\\\\\\\
1203local shell = {}\\\\\\\
1204local tEnv = {\\\\\\\
1205 [\\\\\\\"shell\\\\\\\"] = shell,\\\\\\\
1206}\\\\\\\
1207\\\\\\\
1208local function findArg(arg)\\\\\\\
1209 for _,v in ipairs(tArgs) do\\\\\\\
1210 if v == arg then\\\\\\\
1211 return true\\\\\\\
1212 end\\\\\\\
1213 end\\\\\\\
1214 return false\\\\\\\
1215end\\\\\\\
1216\\\\\\\
1217-- Colours\\\\\\\
1218local promptColour, textColour, bgColour\\\\\\\
1219if term.isColour() then\\\\\\\
1220 promptColour = colours.yellow\\\\\\\
1221 textColour = colours.white\\\\\\\
1222 bgColour = colours.black\\\\\\\
1223else\\\\\\\
1224 promptColour = colours.white\\\\\\\
1225 textColour = colours.white\\\\\\\
1226 bgColour = colours.black\\\\\\\
1227end\\\\\\\
1228\\\\\\\
1229\\\\\\\
1230local function run( _sCommand, ... )\\\\\\\
1231 local sPath = shell.resolveProgram( _sCommand )\\\\\\\
1232 if sPath ~= nil then\\\\\\\
1233 tProgramStack[#tProgramStack + 1] = sPath\\\\\\\
1234 local result = os.run( tEnv, sPath, ... )\\\\\\\
1235 tProgramStack[#tProgramStack] = nil\\\\\\\
1236 return result\\\\\\\
1237 else\\\\\\\
1238 printError( \\\\\\\"No such program\\\\\\\" )\\\\\\\
1239 return false\\\\\\\
1240 end\\\\\\\
1241end\\\\\\\
1242\\\\\\\
1243local function runLine( _sLine )\\\\\\\
1244 local tWords = {}\\\\\\\
1245 for match in string.gmatch( _sLine, \\\\\\\"[^ \\\\\\\\t]+\\\\\\\" ) do\\\\\\\
1246 table.insert( tWords, match )\\\\\\\
1247 end\\\\\\\
1248\\\\\\\
1249 local sCommand = tWords[1]\\\\\\\
1250 if sCommand then\\\\\\\
1251 return run( sCommand, unpack( tWords, 2 ) )\\\\\\\
1252 end\\\\\\\
1253 return false\\\\\\\
1254end\\\\\\\
1255\\\\\\\
1256-- Install shell API\\\\\\\
1257function shell.run( ... )\\\\\\\
1258 return runLine( table.concat( { ... }, \\\\\\\" \\\\\\\" ) )\\\\\\\
1259end\\\\\\\
1260\\\\\\\
1261function shell.exit()\\\\\\\
1262 bExit = true\\\\\\\
1263end\\\\\\\
1264\\\\\\\
1265function shell.dir()\\\\\\\
1266 return sDir\\\\\\\
1267end\\\\\\\
1268\\\\\\\
1269function shell.setDir( _sDir )\\\\\\\
1270 sDir = _sDir\\\\\\\
1271end\\\\\\\
1272\\\\\\\
1273function shell.path()\\\\\\\
1274 return sPath\\\\\\\
1275end\\\\\\\
1276\\\\\\\
1277function shell.setPath( _sPath )\\\\\\\
1278 sPath = _sPath\\\\\\\
1279end\\\\\\\
1280\\\\\\\
1281function shell.resolve( _sPath )\\\\\\\
1282 local sStartChar = string.sub( _sPath, 1, 1 )\\\\\\\
1283 if sStartChar == \\\\\\\"/\\\\\\\" or sStartChar == \\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\" then\\\\\\\
1284 return fs.combine( \\\\\\\"\\\\\\\", _sPath )\\\\\\\
1285 else\\\\\\\
1286 return fs.combine( sDir, _sPath )\\\\\\\
1287 end\\\\\\\
1288end\\\\\\\
1289\\\\\\\
1290function shell.resolveProgram( _sCommand )\\\\\\\
1291 -- Substitute aliases firsts\\\\\\\
1292 if tAliases[ _sCommand ] ~= nil then\\\\\\\
1293 _sCommand = tAliases[ _sCommand ]\\\\\\\
1294 end\\\\\\\
1295\\\\\\\
1296 -- If the path is a global path, use it directly\\\\\\\
1297 local sStartChar = string.sub( _sCommand, 1, 1 )\\\\\\\
1298 if sStartChar == \\\\\\\"/\\\\\\\" or sStartChar == \\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\" then\\\\\\\
1299 local sPath = fs.combine( \\\\\\\"\\\\\\\", _sCommand )\\\\\\\
1300 if fs.exists( sPath ) and not fs.isDir( sPath ) then\\\\\\\
1301 return sPath\\\\\\\
1302 end\\\\\\\
1303 return nil\\\\\\\
1304 end\\\\\\\
1305 \\\\\\\
1306 -- Otherwise, look on the path variable\\\\\\\
1307 for sPath in string.gmatch(sPath, \\\\\\\"[^:]+\\\\\\\") do\\\\\\\
1308 sPath = fs.combine( shell.resolve( sPath ), _sCommand )\\\\\\\
1309 if fs.exists( sPath ) and not fs.isDir( sPath ) then\\\\\\\
1310 return sPath\\\\\\\
1311 end\\\\\\\
1312 end\\\\\\\
1313 \\\\\\\
1314 -- Not found\\\\\\\
1315 return nil\\\\\\\
1316end\\\\\\\
1317\\\\\\\
1318function shell.programs( _bIncludeHidden )\\\\\\\
1319 local tItems = {}\\\\\\\
1320 \\\\\\\
1321 -- Add programs from the path\\\\\\\
1322 for sPath in string.gmatch(sPath, \\\\\\\"[^:]+\\\\\\\") do\\\\\\\
1323 sPath = shell.resolve( sPath )\\\\\\\
1324 if fs.isDir( sPath ) then\\\\\\\
1325 local tList = fs.list( sPath )\\\\\\\
1326 for n,sFile in pairs( tList ) do\\\\\\\
1327 if not fs.isDir( fs.combine( sPath, sFile ) ) and\\\\\\\
1328 (_bIncludeHidden or string.sub( sFile, 1, 1 ) ~= \\\\\\\".\\\\\\\") then\\\\\\\
1329 tItems[ sFile ] = true\\\\\\\
1330 end\\\\\\\
1331 end\\\\\\\
1332 end\\\\\\\
1333 end \\\\\\\
1334\\\\\\\
1335 -- Sort and return\\\\\\\
1336 local tItemList = {}\\\\\\\
1337 for sItem, b in pairs( tItems ) do\\\\\\\
1338 table.insert( tItemList, sItem )\\\\\\\
1339 end\\\\\\\
1340 table.sort( tItemList )\\\\\\\
1341 return tItemList\\\\\\\
1342end\\\\\\\
1343\\\\\\\
1344function shell.getRunningProgram()\\\\\\\
1345 if #tProgramStack > 0 then\\\\\\\
1346 return tProgramStack[#tProgramStack]\\\\\\\
1347 end\\\\\\\
1348 return nil\\\\\\\
1349end\\\\\\\
1350\\\\\\\
1351function shell.setAlias( _sCommand, _sProgram )\\\\\\\
1352 tAliases[ _sCommand ] = _sProgram\\\\\\\
1353end\\\\\\\
1354\\\\\\\
1355function shell.clearAlias( _sCommand )\\\\\\\
1356 tAliases[ _sCommand ] = nil\\\\\\\
1357end\\\\\\\
1358\\\\\\\
1359function shell.aliases()\\\\\\\
1360 -- Add aliases\\\\\\\
1361 local tCopy = {}\\\\\\\
1362 for sAlias, sCommand in pairs( tAliases ) do\\\\\\\
1363 tCopy[sAlias] = sCommand\\\\\\\
1364 end\\\\\\\
1365 return tCopy\\\\\\\
1366end\\\\\\\
1367\\\\\\\
1368-- Custom shell API functions\\\\\\\
1369\\\\\\\
1370function shell.executeScript(path)\\\\\\\
1371 if not fs.exists(path) or fs.isDir(path) then\\\\\\\
1372 return \\\\\\\"file does not exist\\\\\\\"\\\\\\\
1373 else\\\\\\\
1374 local t = luaex.iterateFileLines(path)\\\\\\\
1375 if string.find(t[1], \\\\\\\"@ @ !! TESSERACT SCRIPT HEADER\\\\\\\") or t[1] == \\\\\\\"@ @ !! TESSERACT SCRIPT HEADER\\\\\\\" then\\\\\\\
1376 for _,cmd in pairs(t) do\\\\\\\
1377 shell.run(cmd)\\\\\\\
1378 end\\\\\\\
1379 else\\\\\\\
1380 return \\\\\\\"script header is missing or corrupt\\\\\\\" \\\\\\\
1381 end\\\\\\\
1382 end\\\\\\\
1383end\\\\\\\
1384\\\\\\\
1385function shell.getActiveUserShell()\\\\\\\
1386 if fs.exists(\\\\\\\"/etc/passwd/.shadow/\\\\\\\".._G[\\\\\\\"_activeUser\\\\\\\"]..\\\\\\\".usr\\\\\\\") then\\\\\\\
1387 local ud = dofile(\\\\\\\"/etc/passwd/.shadow/\\\\\\\".._G[\\\\\\\"_activeUser\\\\\\\"]..\\\\\\\".usr\\\\\\\")\\\\\\\
1388 return ud.shell or \\\\\\\"/bin/sh\\\\\\\"\\\\\\\
1389 else\\\\\\\
1390 return \\\\\\\"/bin/sh\\\\\\\"\\\\\\\
1391 end\\\\\\\
1392end\\\\\\\
1393\\\\\\\
1394-- Run custom shells\\\\\\\
1395if findArg(\\\\\\\"--force\\\\\\\") or findArg(\\\\\\\"-f\\\\\\\") then\\\\\\\
1396 kernel.writeMessage(\\\\\\\"ignoring user shell settings\\\\\\\")\\\\\\\
1397elseif shell.getActiveUserShell() ~= \\\\\\\"/bin/sh\\\\\\\" then\\\\\\\
1398 shell.run(shell.getActiveUserShell())\\\\\\\
1399 kernel.shutdown(false)\\\\\\\
1400end\\\\\\\
1401 \\\\\\\
1402term.setBackgroundColor( bgColour )\\\\\\\
1403term.setTextColour( promptColour )\\\\\\\
1404print( os.version() )\\\\\\\
1405term.setTextColour( textColour )\\\\\\\
1406\\\\\\\
1407local label = os.getComputerLabel() or os.getComputerID()\\\\\\\
1408\\\\\\\
1409-- Read commands and execute them\\\\\\\
1410local tCommandHistory = {}\\\\\\\
1411while not bExit do\\\\\\\
1412 term.setBackgroundColor( bgColour )\\\\\\\
1413 if security.getSU() then\\\\\\\
1414 if security.getActiveUserStatus() then\\\\\\\
1415 term.setTextColour( colours.lime )\\\\\\\
1416 else\\\\\\\
1417 term.setTextColour( colours.orange )\\\\\\\
1418 end\\\\\\\
1419 else\\\\\\\
1420 term.setTextColour( colours.cyan )\\\\\\\
1421 end\\\\\\\
1422 write( _activeUser )\\\\\\\
1423 term.setTextColour( colours.lightGrey )\\\\\\\
1424 write( \\\\\\\"@\\\\\\\" )\\\\\\\
1425 term.setTextColour( colours.lightBlue )\\\\\\\
1426 write( label )\\\\\\\
1427 term.setTextColour( colours.lightGrey )\\\\\\\
1428 write( \\\\\\\"/\\\\\\\" )\\\\\\\
1429 term.setTextColour( colours.lightBlue )\\\\\\\
1430 write( shell.dir() )\\\\\\\
1431 if security.getSU() then\\\\\\\
1432 if security.getActiveUserStatus() then\\\\\\\
1433 term.setTextColour( colours.lime )\\\\\\\
1434 else\\\\\\\
1435 term.setTextColour( colours.orange )\\\\\\\
1436 end\\\\\\\
1437 write( \\\\\\\" # \\\\\\\" )\\\\\\\
1438 else\\\\\\\
1439 term.setTextColour( colours.cyan )\\\\\\\
1440 write( \\\\\\\" $ \\\\\\\" )\\\\\\\
1441 end\\\\\\\
1442 term.setTextColour( textColour )\\\\\\\
1443\\\\\\\
1444 local sLine = read( nil, tCommandHistory )\\\\\\\
1445 table.insert( tCommandHistory, sLine )\\\\\\\
1446 runLine( sLine )\\\\\\\
1447end\\\\\\\
1448\\\\\\\
1449-- Custom shutdown code goes here\\\"\",\
1450 \"F:systeminfo\",\
1451 \"\\\"local tArgs = {...}\\\\\\\
1452local err = true\\\\\\\
1453local function findArg(arg)\\\\\\\
1454 for _,v in ipairs(tArgs) do\\\\\\\
1455 if v == arg then\\\\\\\
1456 return true\\\\\\\
1457 end\\\\\\\
1458 end\\\\\\\
1459 return false\\\\\\\
1460end\\\\\\\
1461\\\\\\\
1462if findArg(\\\\\\\"--os-version\\\\\\\") then\\\\\\\
1463 err = false\\\\\\\
1464 gui.printAppInfo(\\\\\\\"systeminfo\\\\\\\", os.version())\\\\\\\
1465end\\\\\\\
1466if findArg(\\\\\\\"--shell-path\\\\\\\") then\\\\\\\
1467 err = false\\\\\\\
1468 gui.printAppInfo(\\\\\\\"systeminfo\\\\\\\", shell.path())\\\\\\\
1469end\\\\\\\
1470if findArg(\\\\\\\"--computer-info\\\\\\\") then\\\\\\\
1471 err = false\\\\\\\
1472 gui.printAppInfo(\\\\\\\"systeminfo\\\\\\\", \\\\\\\"ID \\\\\\\"..os.getComputerID())\\\\\\\
1473 gui.printAppInfo(\\\\\\\"systeminfo\\\\\\\", \\\\\\\"Computer labeled as \\\\\\\"..os.getComputerLabel())\\\\\\\
1474end\\\\\\\
1475if #tArgs < 1 or err then\\\\\\\
1476 gui.printAppInfo(\\\\\\\"systeminfo\\\\\\\", \\\\\\\"arguments not specified\\\\\\\")\\\\\\\
1477end\\\"\",\
1478 \"F:tpm-install\",\
1479 \"\\\"local tArgs = {...}\\\\\\\
1480local packages = config.load(\\\\\\\"/etc/tpm/package.dat\\\\\\\")\\\\\\\
1481local temp = config.load(\\\\\\\"/etc/tpm/packageInstalled.dat\\\\\\\")\\\\\\\
1482local found, value\\\\\\\
1483\\\\\\\
1484if not security.getSU() then\\\\\\\
1485 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
1486 return\\\\\\\
1487end\\\\\\\
1488\\\\\\\
1489if #tArgs < 1 then\\\\\\\
1490 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"package name not specified\\\\\\\")\\\\\\\
1491 return\\\\\\\
1492elseif not packages then\\\\\\\
1493 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"package.dat is missing or corrupt\\\\\\\")\\\\\\\
1494 log.writeMessage(\\\\\\\"package.dat unable to be traversed\\\\\\\")\\\\\\\
1495 return\\\\\\\
1496elseif not temp then\\\\\\\
1497 shell.executeScript(\\\\\\\"/etc/scripts/tpm-recache.tsf\\\\\\\")\\\\\\\
1498end\\\\\\\
1499\\\\\\\
1500found, value = search.traverseKey(temp, tArgs[1])\\\\\\\
1501if found and value then\\\\\\\
1502 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"package already installed\\\\\\\")\\\\\\\
1503 return\\\\\\\
1504end\\\\\\\
1505\\\\\\\
1506gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"traversing package.dat\\\\\\\")\\\\\\\
1507local ok, pack = search.traverseValue(packages, tArgs[1])\\\\\\\
1508if ok and pack then\\\\\\\
1509 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"found corresponding package\\\\\\\")\\\\\\\
1510 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"downloading API files [1/2]\\\\\\\")\\\\\\\
1511 local numapi = 1\\\\\\\
1512 local numbin = 1\\\\\\\
1513 local APIInstallFlag = false\\\\\\\
1514 for k,v in pairs(pack.apis) do\\\\\\\
1515 if tpm.downloadAPI(k, v) then\\\\\\\
1516 APIInstallFlag = true\\\\\\\
1517 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"downloaded API \\\\\\\"..k..\\\\\\\" [\\\\\\\"..tostring(numapi)..\\\\\\\"]\\\\\\\")\\\\\\\
1518 else\\\\\\\
1519 gui.printAppWarning(\\\\\\\"tpm\\\\\\\", \\\\\\\"failed to download API \\\\\\\"..k)\\\\\\\
1520 end\\\\\\\
1521 numapi = numapi + 1\\\\\\\
1522 end\\\\\\\
1523 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"downloading binaries [2/2]\\\\\\\")\\\\\\\
1524 for k,v in pairs(pack.bins) do\\\\\\\
1525 if tpm.downloadBinary(k, v) then\\\\\\\
1526 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"downloaded binary \\\\\\\"..k..\\\\\\\" [\\\\\\\"..tostring(numbin)..\\\\\\\"]\\\\\\\")\\\\\\\
1527 else\\\\\\\
1528 gui.printAppWarning(\\\\\\\"tpm\\\\\\\", \\\\\\\"failed to download binary \\\\\\\"..k)\\\\\\\
1529 end\\\\\\\
1530 numbin = numbin + 1\\\\\\\
1531 end\\\\\\\
1532 table.insert(temp, pack.name)\\\\\\\
1533 log.writeMessage(\\\\\\\"New package downloaded and installed\\\\\\\")\\\\\\\
1534 config.save(temp, \\\\\\\"/etc/tpm/packageInstalled.dat\\\\\\\")\\\\\\\
1535 gui.printAppSuccess(\\\\\\\"tpm\\\\\\\", \\\\\\\"package installed\\\\\\\")\\\\\\\
1536 if APIInstallFlag then\\\\\\\
1537 if gui.request(\\\\\\\"Assemblies were installed, restart\\\\\\\") then\\\\\\\
1538 kernel.reboot(false)\\\\\\\
1539 end\\\\\\\
1540 end\\\\\\\
1541else\\\\\\\
1542 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"unable to find id for \\\\\\\"..tArgs[1])\\\\\\\
1543end\\\"\",\
1544 \"F:tpm-list\",\
1545 \"\\\"local tArgs = {...}\\\\\\\
1546local packages = config.load(\\\\\\\"/etc/tpm/package.dat\\\\\\\")\\\\\\\
1547local packageInstalled = config.load(\\\\\\\"/etc/tpm/packageInstalled.dat\\\\\\\")\\\\\\\
1548\\\\\\\
1549if not security.getSU() then\\\\\\\
1550 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
1551 return\\\\\\\
1552end\\\\\\\
1553\\\\\\\
1554if not packages then\\\\\\\
1555 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"package.dat is missing or corrupt\\\\\\\")\\\\\\\
1556 log.writeMessage(\\\\\\\"package.dat unable to be traversed\\\\\\\")\\\\\\\
1557 return\\\\\\\
1558elseif not packageInstalled then\\\\\\\
1559 shell.executeScript(\\\\\\\"/etc/scripts/tpm-recache.tsf\\\\\\\")\\\\\\\
1560end\\\\\\\
1561\\\\\\\
1562if search.findValue(tArgs, \\\\\\\"available\\\\\\\") then\\\\\\\
1563 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"traversing package.dat\\\\\\\")\\\\\\\
1564 for k, v in pairs(packages) do\\\\\\\
1565 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"found package identifier \\\\\\\"..v.name)\\\\\\\
1566 end\\\\\\\
1567elseif search.findValue(tArgs, \\\\\\\"installed\\\\\\\") then\\\\\\\
1568 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"traversing packageInstalled.dat\\\\\\\")\\\\\\\
1569 for k, v in pairs(packageInstalled) do\\\\\\\
1570 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"found package identifier \\\\\\\"..v)\\\\\\\
1571 end\\\\\\\
1572else\\\\\\\
1573 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"specify listing type\\\\\\\")\\\\\\\
1574end\\\"\",\
1575 \"F:tpm-recache\",\
1576 \"\\\"if not security.getSU() then\\\\\\\
1577 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
1578 return\\\\\\\
1579end\\\\\\\
1580\\\\\\\
1581gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"redownloading package.dat\\\\\\\")\\\\\\\
1582if tpm.getPaste(\\\\\\\"/etc/tpm/package.dat\\\\\\\", \\\\\\\"0YScZtUc\\\\\\\", true) then\\\\\\\
1583 gui.printAppSuccess(\\\\\\\"tpm\\\\\\\", \\\\\\\"package cache updated\\\\\\\")\\\\\\\
1584 log.writeMessage(\\\\\\\"package cache updated\\\\\\\")\\\\\\\
1585else\\\\\\\
1586 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"failed to update package cache\\\\\\\")\\\\\\\
1587 log.writeMessage(\\\\\\\"failed to update package cache\\\\\\\")\\\\\\\
1588end\\\"\",\
1589 \"F:tpm-remove\",\
1590 \"\\\"local tArgs = {...}\\\\\\\
1591local packages = config.load(\\\\\\\"/etc/tpm/package.dat\\\\\\\")\\\\\\\
1592local temp = config.load(\\\\\\\"/etc/tpm/packageInstalled.dat\\\\\\\")\\\\\\\
1593local found, value\\\\\\\
1594\\\\\\\
1595if not security.getSU() then\\\\\\\
1596 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
1597 return\\\\\\\
1598end\\\\\\\
1599\\\\\\\
1600if #tArgs < 1 then\\\\\\\
1601 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"package name not specified\\\\\\\")\\\\\\\
1602 return\\\\\\\
1603elseif not packages then\\\\\\\
1604 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"package.dat is missing or corrupt\\\\\\\")\\\\\\\
1605 log.writeMessage(\\\\\\\"package.dat unable to be traversed\\\\\\\")\\\\\\\
1606 return\\\\\\\
1607elseif not temp then\\\\\\\
1608 shell.executeScript(\\\\\\\"/etc/scripts/tpm-recache.tsf\\\\\\\")\\\\\\\
1609end\\\\\\\
1610\\\\\\\
1611\\\\\\\
1612gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"traversing package.dat\\\\\\\")\\\\\\\
1613local ok, pack = search.traverseValue(packages, tArgs[1])\\\\\\\
1614if ok and pack then\\\\\\\
1615 found, value = search.traverseKey(temp, pack.name)\\\\\\\
1616 if found and value then\\\\\\\
1617 temp[value] = nil\\\\\\\
1618 else\\\\\\\
1619 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"package missing\\\\\\\")\\\\\\\
1620 return\\\\\\\
1621 end\\\\\\\
1622 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"found corresponding package\\\\\\\")\\\\\\\
1623 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"removing API files [1/2]\\\\\\\")\\\\\\\
1624 local numapi = 1\\\\\\\
1625 local numbin = 1\\\\\\\
1626 local APIRemovalFlag = false\\\\\\\
1627 for k,v in pairs(pack.apis) do\\\\\\\
1628 if fs.exists(tpm.toPackageAPI(k)) and not fs.isDir(tpm.toPackageAPI(k)) then\\\\\\\
1629 fs.delete(tpm.toPackageAPI(k))\\\\\\\
1630 APIRemovalFlag = true\\\\\\\
1631 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"removed API \\\\\\\"..k..\\\\\\\" [\\\\\\\"..tostring(numapi)..\\\\\\\"]\\\\\\\")\\\\\\\
1632 else\\\\\\\
1633 gui.printAppWarning(\\\\\\\"tpm\\\\\\\", \\\\\\\"failed to remove API \\\\\\\"..k)\\\\\\\
1634 end\\\\\\\
1635 numapi = numapi + 1\\\\\\\
1636 end\\\\\\\
1637 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"removing binaries [2/2]\\\\\\\")\\\\\\\
1638 for k,v in pairs(pack.bins) do\\\\\\\
1639 if fs.exists(tpm.toPackageBinary(k)) and not fs.isDir(tpm.toPackageBinary(k)) then\\\\\\\
1640 fs.delete(tpm.toPackageBinary(k))\\\\\\\
1641 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"removed binary \\\\\\\"..k..\\\\\\\" [\\\\\\\"..tostring(numbin)..\\\\\\\"]\\\\\\\")\\\\\\\
1642 else\\\\\\\
1643 gui.printAppWarning(\\\\\\\"tpm\\\\\\\", \\\\\\\"failed to remove binary \\\\\\\"..k)\\\\\\\
1644 end\\\\\\\
1645 numbin = numbin + 1\\\\\\\
1646 end\\\\\\\
1647 if APIRemovalFlag then\\\\\\\
1648 if gui.request(\\\\\\\"Assemblies were removed, restart\\\\\\\") then\\\\\\\
1649 kernel.reboot(false)\\\\\\\
1650 end\\\\\\\
1651 end\\\\\\\
1652 config.save(temp, \\\\\\\"/etc/tpm/packageInstalled.dat\\\\\\\")\\\\\\\
1653 log.writeMessage(\\\\\\\"Removed package \\\\\\\"..tArgs[1])\\\\\\\
1654 gui.printAppSuccess(\\\\\\\"tpm\\\\\\\", \\\\\\\"package removed\\\\\\\")\\\\\\\
1655else\\\\\\\
1656 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"unable to find id for \\\\\\\"..tArgs[1])\\\\\\\
1657end\\\"\",\
1658 \"F:tpm-repair\",\
1659 \"\\\"if not security.getSU() then\\\\\\\
1660 exception.throw(\\\\\\\"RestrictedOpsException\\\\\\\")\\\\\\\
1661 return\\\\\\\
1662end\\\\\\\
1663\\\\\\\
1664if not config.load(\\\\\\\"/etc/tpm/packageInstalled.dat\\\\\\\") then\\\\\\\
1665 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"packageInstalled.dat is missing or corrupt\\\\\\\")\\\\\\\
1666 if gui.request(\\\\\\\"Repair TPM data files\\\\\\\") then\\\\\\\
1667 config.save({}, \\\\\\\"/etc/tpm/packageInstalled.dat\\\\\\\")\\\\\\\
1668 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"package registry reconstructed\\\\\\\")\\\\\\\
1669 end\\\\\\\
1670else\\\\\\\
1671 gui.printAppInfo(\\\\\\\"tpm\\\\\\\", \\\\\\\"packageInstalled.dat is correctly readable\\\\\\\")\\\\\\\
1672end\\\"\",\
1673 \"F:tty\",\
1674 \"\\\"local x, y = term.getSize()\\\\\\\
1675gui.printAppInfo(\\\\\\\"tty\\\\\\\", \\\\\\\"terminal object size is \\\\\\\"..tostring(x)..\\\\\\\"x\\\\\\\"..tostring(y))\\\\\\\
1676\\\"\",\
1677 \"F:uname\",\
1678 \"\\\"gui.printAppInfo(\\\\\\\"security\\\\\\\", \\\\\\\"active username is \\\\\\\".._activeUser)\\\"\",\
1679}",
1680 "D:boot",
1681 "{\
1682 \"F:boot.conf\",\
1683 \"\\\"{\\\\\\\
1684 preferredBootloader = \\\\\\\"/boot/loaders/tesseract\\\\\\\",\\\\\\\
1685}\\\"\",\
1686 \"D:loaders\",\
1687 \"{\\\
1688 \\\"F:tesseract\\\",\\\
1689 \\\"\\\\\\\"local oldReadOnly = _G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"isReadOnly\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1690local oldMove = _G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"move\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1691local oldDelete = _G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"delete\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1692local oldHttpGet = _G[\\\\\\\\\\\\\\\"http\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"get\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1693local oldError = _G[\\\\\\\\\\\\\\\"error\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1694\\\\\\\\\\\\\\\
1695log.writeBootLog(\\\\\\\\\\\\\\\"Initialized system boot log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1696log.writeSyslog(\\\\\\\\\\\\\\\"Initialized primary system log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1697log.writeMessage(\\\\\\\\\\\\\\\"Initialized secondary system log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1698log.writeSecurity(\\\\\\\\\\\\\\\"Initialized security/access log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1699log.writeShutdown(\\\\\\\\\\\\\\\"Initialized shutdown log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1700log.writeAuth(\\\\\\\\\\\\\\\"Initialized authorization log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1701\\\\\\\\\\\\\\\
1702sleep(0.25)\\\\\\\\\\\\\\\
1703if http then\\\\\\\\\\\\\\\
1704 gui.printBootSuccess(\\\\\\\\\\\\\\\"HTTP detection succeeded\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1705else\\\\\\\\\\\\\\\
1706 gui.printBootWarning(\\\\\\\\\\\\\\\"HTTP detection failed\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1707end\\\\\\\\\\\\\\\
1708sleep(0.5)\\\\\\\\\\\\\\\
1709shell.run(\\\\\\\\\\\\\\\"/etc/autorun\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1710gui.printBootWarning(\\\\\\\\\\\\\\\"Enumerating user assemblies...\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1711kernel.loadUserAssemblies(false)\\\\\\\\\\\\\\\
1712sleep(0.25)\\\\\\\\\\\\\\\
1713gui.printBootWarning(\\\\\\\\\\\\\\\"Initiating security protocols\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1714_G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"isReadOnly\\\\\\\\\\\\\\\"] = function(path)\\\\\\\\\\\\\\\
1715 local find1 = shell.resolve(path)\\\\\\\\\\\\\\\
1716 if string.find(find1, \\\\\\\\\\\\\\\"boot\\\\\\\\\\\\\\\") or string.find(find1, \\\\\\\\\\\\\\\"etc\\\\\\\\\\\\\\\") or string.find(find1, \\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\") or string.find(find1, \\\\\\\\\\\\\\\"sbin\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
1717 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access system files!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1718 if security.getSU() or _IDENTIFIER then\\\\\\\\\\\\\\\
1719 log.writeSecurity(\\\\\\\\\\\\\\\"Superuser access verified.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1720 return false\\\\\\\\\\\\\\\
1721 else\\\\\\\\\\\\\\\
1722 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1723 return true\\\\\\\\\\\\\\\
1724 end\\\\\\\\\\\\\\\
1725 elseif find1 == \\\\\\\\\\\\\\\"startup\\\\\\\\\\\\\\\" or find1 == \\\\\\\\\\\\\\\"/startup\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
1726 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access bootloader!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1727 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1728 return true\\\\\\\\\\\\\\\
1729 end \\\\\\\\\\\\\\\
1730 return oldReadOnly(path)\\\\\\\\\\\\\\\
1731end\\\\\\\\\\\\\\\
1732_G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"move\\\\\\\\\\\\\\\"] = function(path1, path2)\\\\\\\\\\\\\\\
1733 local find2 = shell.resolve(path1)\\\\\\\\\\\\\\\
1734 if string.find(find2, \\\\\\\\\\\\\\\"boot\\\\\\\\\\\\\\\") or string.find(find2, \\\\\\\\\\\\\\\"etc\\\\\\\\\\\\\\\") or string.find(find2, \\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\") or string.find(find2, \\\\\\\\\\\\\\\"sbin\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
1735 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access system files!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1736 if security.getSU() or _IDENTIFIER then\\\\\\\\\\\\\\\
1737 log.writeSecurity(\\\\\\\\\\\\\\\"Superuser access verified.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1738 else\\\\\\\\\\\\\\\
1739 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1740 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1741 return nil\\\\\\\\\\\\\\\
1742 end\\\\\\\\\\\\\\\
1743 elseif find2 == \\\\\\\\\\\\\\\"startup\\\\\\\\\\\\\\\" or find2 == \\\\\\\\\\\\\\\"/startup\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
1744 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access bootloader!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1745 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1746 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1747 return nil\\\\\\\\\\\\\\\
1748 end \\\\\\\\\\\\\\\
1749 return oldMove(path1, path2)\\\\\\\\\\\\\\\
1750end\\\\\\\\\\\\\\\
1751_G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"delete\\\\\\\\\\\\\\\"] = function(path)\\\\\\\\\\\\\\\
1752 local find3 = shell.resolve(path)\\\\\\\\\\\\\\\
1753 if string.find(find3, \\\\\\\\\\\\\\\"boot\\\\\\\\\\\\\\\") or string.find(find3, \\\\\\\\\\\\\\\"etc\\\\\\\\\\\\\\\") or string.find(find3, \\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\") or string.find(find3, \\\\\\\\\\\\\\\"sbin\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
1754 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access system files!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1755 if security.getSU() or _IDENTIFIER then\\\\\\\\\\\\\\\
1756 log.writeSecurity(\\\\\\\\\\\\\\\"Superuser access verified.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1757 else\\\\\\\\\\\\\\\
1758 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1759 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1760 return nil\\\\\\\\\\\\\\\
1761 end\\\\\\\\\\\\\\\
1762 elseif find3 == \\\\\\\\\\\\\\\"startup\\\\\\\\\\\\\\\" or find3 == \\\\\\\\\\\\\\\"/startup\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
1763 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access bootloader!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1764 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1765 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1766 return nil\\\\\\\\\\\\\\\
1767 end \\\\\\\\\\\\\\\
1768 return oldDelete(path)\\\\\\\\\\\\\\\
1769end\\\\\\\\\\\\\\\
1770_G[\\\\\\\\\\\\\\\"http\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"get\\\\\\\\\\\\\\\"] = function(url, headers)\\\\\\\\\\\\\\\
1771 log.writeSecurity(\\\\\\\\\\\\\\\"Downloaded contents of \\\\\\\\\\\\\\\"..url)\\\\\\\\\\\\\\\
1772 return oldHttpGet(url, headers)\\\\\\\\\\\\\\\
1773end\\\\\\\\\\\\\\\
1774_G[\\\\\\\\\\\\\\\"error\\\\\\\\\\\\\\\"] = function(text, lvl)\\\\\\\\\\\\\\\
1775 local x = lvl or 2\\\\\\\\\\\\\\\
1776 local logger = fs.open(\\\\\\\\\\\\\\\"/etc/errorLog\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1777 logger.writeLine(tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"..text)\\\\\\\\\\\\\\\
1778 logger.close()\\\\\\\\\\\\\\\
1779 oldError(text, x or 1)\\\\\\\\\\\\\\\
1780end\\\\\\\\\\\\\\\
1781rawset(fs, \\\\\\\\\\\\\\\"_native\\\\\\\\\\\\\\\", {})\\\\\\\\\\\\\\\
1782rawset(fs, \\\\\\\\\\\\\\\"_native.check\\\\\\\\\\\\\\\", oldReadOnly)\\\\\\\\\\\\\\\
1783rawset(fs, \\\\\\\\\\\\\\\"_native.move\\\\\\\\\\\\\\\", oldMove)\\\\\\\\\\\\\\\
1784rawset(fs, \\\\\\\\\\\\\\\"_native.delete\\\\\\\\\\\\\\\", oldDelete)\\\\\\\\\\\\\\\
1785rawset(http, \\\\\\\\\\\\\\\"_synchronise\\\\\\\\\\\\\\\", oldHttpGet)\\\\\\\\\\\\\\\
1786rawset(os, \\\\\\\\\\\\\\\"_exception\\\\\\\\\\\\\\\", oldError)\\\\\\\\\\\\\\\
1787gui.printBootSuccess(\\\\\\\\\\\\\\\"Boot sequence stage 2 complete\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1788sleep(2)\\\\\\\\\\\\\\\
1789kernel.clear()\\\\\\\\\\\\\\\
1790shell.run(\\\\\\\\\\\\\\\"/etc/auth\\\\\\\\\\\\\\\")\\\\\\\"\\\",\\\
1791 \\\"F:tesseract-boot-splash\\\",\\\
1792 \\\"\\\\\\\"local function annotateLoading(txt, array, delay)\\\\\\\\\\\\\\\
1793 for _, v in ipairs(array) do\\\\\\\\\\\\\\\
1794 gui.printColoredTextLine(18, txt..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v)\\\\\\\\\\\\\\\
1795 sleep(delay or 1.5)\\\\\\\\\\\\\\\
1796 end\\\\\\\\\\\\\\\
1797end\\\\\\\\\\\\\\\
1798local oldReadOnly = _G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"isReadOnly\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1799local oldMove = _G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"move\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1800local oldDelete = _G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"delete\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1801local oldHttpGet = _G[\\\\\\\\\\\\\\\"http\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"get\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1802local oldError = _G[\\\\\\\\\\\\\\\"error\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1803log.writeBootLog(\\\\\\\\\\\\\\\"Initialized system boot log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1804log.writeSyslog(\\\\\\\\\\\\\\\"Initialized primary system log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1805log.writeMessage(\\\\\\\\\\\\\\\"Initialized secondary system log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1806log.writeSecurity(\\\\\\\\\\\\\\\"Initialized security/access log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1807log.writeShutdown(\\\\\\\\\\\\\\\"Initialized shutdown log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1808log.writeAuth(\\\\\\\\\\\\\\\"Initialized authorization log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1809sleep(0.25)\\\\\\\\\\\\\\\
1810if http then\\\\\\\\\\\\\\\
1811 log.writeBootLog(\\\\\\\\\\\\\\\"HTTP detection succeeded\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1812else\\\\\\\\\\\\\\\
1813 log.writeBootLog(\\\\\\\\\\\\\\\"HTTP detection failed\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1814end\\\\\\\\\\\\\\\
1815sleep(0.5)\\\\\\\\\\\\\\\
1816shell.run(\\\\\\\\\\\\\\\"/etc/autorun\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1817log.writeBootLog(\\\\\\\\\\\\\\\"Enumerating user assemblies...\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1818kernel.loadUserAssemblies(true)\\\\\\\\\\\\\\\
1819sleep(0.25)\\\\\\\\\\\\\\\
1820log.writeBootLog(\\\\\\\\\\\\\\\"Initiating security protocols\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1821_G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"isReadOnly\\\\\\\\\\\\\\\"] = function(path)\\\\\\\\\\\\\\\
1822 local find1 = shell.resolve(path)\\\\\\\\\\\\\\\
1823 if string.find(find1, \\\\\\\\\\\\\\\"boot\\\\\\\\\\\\\\\") or string.find(find1, \\\\\\\\\\\\\\\"etc\\\\\\\\\\\\\\\") or string.find(find1, \\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\") or string.find(find1, \\\\\\\\\\\\\\\"sbin\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
1824 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access system files!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1825 if security.getSU() or _IDENTIFIER then\\\\\\\\\\\\\\\
1826 log.writeSecurity(\\\\\\\\\\\\\\\"Superuser access verified.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1827 return false\\\\\\\\\\\\\\\
1828 else\\\\\\\\\\\\\\\
1829 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1830 return true\\\\\\\\\\\\\\\
1831 end\\\\\\\\\\\\\\\
1832 elseif find1 == \\\\\\\\\\\\\\\"startup\\\\\\\\\\\\\\\" or find1 == \\\\\\\\\\\\\\\"/startup\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
1833 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access bootloader!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1834 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1835 return true\\\\\\\\\\\\\\\
1836 end \\\\\\\\\\\\\\\
1837 return oldReadOnly(path)\\\\\\\\\\\\\\\
1838end\\\\\\\\\\\\\\\
1839_G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"move\\\\\\\\\\\\\\\"] = function(path1, path2)\\\\\\\\\\\\\\\
1840 local find2 = shell.resolve(path1)\\\\\\\\\\\\\\\
1841 if string.find(find2, \\\\\\\\\\\\\\\"boot\\\\\\\\\\\\\\\") or string.find(find2, \\\\\\\\\\\\\\\"etc\\\\\\\\\\\\\\\") or string.find(find2, \\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\") or string.find(find2, \\\\\\\\\\\\\\\"sbin\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
1842 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access system files!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1843 if security.getSU() or _IDENTIFIER then\\\\\\\\\\\\\\\
1844 log.writeSecurity(\\\\\\\\\\\\\\\"Superuser access verified.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1845 else\\\\\\\\\\\\\\\
1846 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1847 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1848 return nil\\\\\\\\\\\\\\\
1849 end\\\\\\\\\\\\\\\
1850 elseif find2 == \\\\\\\\\\\\\\\"startup\\\\\\\\\\\\\\\" or find2 == \\\\\\\\\\\\\\\"/startup\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
1851 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access bootloader!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1852 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1853 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1854 return nil\\\\\\\\\\\\\\\
1855 end \\\\\\\\\\\\\\\
1856 return oldMove(path1, path2)\\\\\\\\\\\\\\\
1857end\\\\\\\\\\\\\\\
1858_G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"delete\\\\\\\\\\\\\\\"] = function(path)\\\\\\\\\\\\\\\
1859 local find3 = shell.resolve(path)\\\\\\\\\\\\\\\
1860 if string.find(find3, \\\\\\\\\\\\\\\"boot\\\\\\\\\\\\\\\") or string.find(find3, \\\\\\\\\\\\\\\"etc\\\\\\\\\\\\\\\") or string.find(find3, \\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\") or string.find(find3, \\\\\\\\\\\\\\\"sbin\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
1861 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access system files!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1862 if security.getSU() or _IDENTIFIER then\\\\\\\\\\\\\\\
1863 log.writeSecurity(\\\\\\\\\\\\\\\"Superuser access verified.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1864 else\\\\\\\\\\\\\\\
1865 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1866 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1867 return nil\\\\\\\\\\\\\\\
1868 end\\\\\\\\\\\\\\\
1869 elseif find3 == \\\\\\\\\\\\\\\"startup\\\\\\\\\\\\\\\" or find3 == \\\\\\\\\\\\\\\"/startup\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
1870 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access bootloader!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1871 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1872 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1873 return nil\\\\\\\\\\\\\\\
1874 end \\\\\\\\\\\\\\\
1875 return oldDelete(path)\\\\\\\\\\\\\\\
1876end\\\\\\\\\\\\\\\
1877_G[\\\\\\\\\\\\\\\"http\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"get\\\\\\\\\\\\\\\"] = function(url, headers)\\\\\\\\\\\\\\\
1878 log.writeSecurity(\\\\\\\\\\\\\\\"Downloaded contents of \\\\\\\\\\\\\\\"..url)\\\\\\\\\\\\\\\
1879 return oldHttpGet(url, headers)\\\\\\\\\\\\\\\
1880end\\\\\\\\\\\\\\\
1881_G[\\\\\\\\\\\\\\\"error\\\\\\\\\\\\\\\"] = function(text, lvl)\\\\\\\\\\\\\\\
1882 local x = lvl or 2\\\\\\\\\\\\\\\
1883 local logger = fs.open(\\\\\\\\\\\\\\\"/etc/errorLog\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1884 logger.writeLine(tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"..text)\\\\\\\\\\\\\\\
1885 logger.close()\\\\\\\\\\\\\\\
1886 oldError(text, x or 1)\\\\\\\\\\\\\\\
1887end\\\\\\\\\\\\\\\
1888rawset(fs, \\\\\\\\\\\\\\\"_native\\\\\\\\\\\\\\\", {})\\\\\\\\\\\\\\\
1889rawset(fs, \\\\\\\\\\\\\\\"_native.check\\\\\\\\\\\\\\\", oldReadOnly)\\\\\\\\\\\\\\\
1890rawset(fs, \\\\\\\\\\\\\\\"_native.move\\\\\\\\\\\\\\\", oldMove)\\\\\\\\\\\\\\\
1891rawset(fs, \\\\\\\\\\\\\\\"_native.delete\\\\\\\\\\\\\\\", oldDelete)\\\\\\\\\\\\\\\
1892rawset(http, \\\\\\\\\\\\\\\"_synchronise\\\\\\\\\\\\\\\", oldHttpGet)\\\\\\\\\\\\\\\
1893rawset(os, \\\\\\\\\\\\\\\"_exception\\\\\\\\\\\\\\\", oldError)\\\\\\\\\\\\\\\
1894log.writeBootLog(\\\\\\\\\\\\\\\"Boot sequence stage 2 complete\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1895local setupLines = {}\\\\\\\\\\\\\\\
1896setupLines.stageOne = {\\\\\\\\\\\\\\\"(Handling autorun files)\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"(Initializing security)\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"(Running authorization)\\\\\\\\\\\\\\\"}\\\\\\\\\\\\\\\
1897gui.clearScreen(colors.cyan)\\\\\\\\\\\\\\\
1898gui.drawImg(\\\\\\\\\\\\\\\"/boot/tesseract.img\\\\\\\\\\\\\\\", 8, 5)\\\\\\\\\\\\\\\
1899gui.printColoredTextLine(18, \\\\\\\\\\\\\\\"Tesseract boot sequence in progress...\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1900sleep(2)\\\\\\\\\\\\\\\
1901annotateLoading(\\\\\\\\\\\\\\\"Booting Tesseract...\\\\\\\\\\\\\\\", setupLines.stageOne, 1.25)\\\\\\\\\\\\\\\
1902sleep(2)\\\\\\\\\\\\\\\
1903kernel.clear()\\\\\\\\\\\\\\\
1904shell.run(\\\\\\\\\\\\\\\"/etc/auth\\\\\\\\\\\\\\\")\\\\\\\"\\\",\\\
1905 \\\"F:tesseract-fastboot\\\",\\\
1906 \\\"\\\\\\\"local function annotateLoading(txt, array, delay)\\\\\\\\\\\\\\\
1907 for _, v in ipairs(array) do\\\\\\\\\\\\\\\
1908 gui.printColoredTextLine(18, txt..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v)\\\\\\\\\\\\\\\
1909 sleep(delay or 1.5)\\\\\\\\\\\\\\\
1910 end\\\\\\\\\\\\\\\
1911end\\\\\\\\\\\\\\\
1912local oldReadOnly = _G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"isReadOnly\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1913local oldMove = _G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"move\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1914local oldDelete = _G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"delete\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1915local oldHttpGet = _G[\\\\\\\\\\\\\\\"http\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"get\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1916local oldError = _G[\\\\\\\\\\\\\\\"error\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\
1917log.writeBootLog(\\\\\\\\\\\\\\\"Initialized system boot log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1918log.writeSyslog(\\\\\\\\\\\\\\\"Initialized primary system log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1919log.writeMessage(\\\\\\\\\\\\\\\"Initialized secondary system log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1920log.writeSecurity(\\\\\\\\\\\\\\\"Initialized security/access log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1921log.writeShutdown(\\\\\\\\\\\\\\\"Initialized shutdown log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1922log.writeAuth(\\\\\\\\\\\\\\\"Initialized authorization log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1923sleep(0.25)\\\\\\\\\\\\\\\
1924if http then\\\\\\\\\\\\\\\
1925 log.writeBootLog(\\\\\\\\\\\\\\\"HTTP detection succeeded\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1926else\\\\\\\\\\\\\\\
1927 log.writeBootLog(\\\\\\\\\\\\\\\"HTTP detection failed\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1928end\\\\\\\\\\\\\\\
1929sleep(0.5)\\\\\\\\\\\\\\\
1930shell.run(\\\\\\\\\\\\\\\"/etc/autorun\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1931log.writeBootLog(\\\\\\\\\\\\\\\"Enumerating user assemblies...\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1932kernel.loadUserAssemblies(true)\\\\\\\\\\\\\\\
1933sleep(0.25)\\\\\\\\\\\\\\\
1934log.writeBootLog(\\\\\\\\\\\\\\\"Initiating security protocols\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1935_G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"isReadOnly\\\\\\\\\\\\\\\"] = function(path)\\\\\\\\\\\\\\\
1936 local find1 = shell.resolve(path)\\\\\\\\\\\\\\\
1937 if string.find(find1, \\\\\\\\\\\\\\\"boot\\\\\\\\\\\\\\\") or string.find(find1, \\\\\\\\\\\\\\\"etc\\\\\\\\\\\\\\\") or string.find(find1, \\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\") or string.find(find1, \\\\\\\\\\\\\\\"sbin\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
1938 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access system files!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1939 if security.getSU() or _IDENTIFIER then\\\\\\\\\\\\\\\
1940 log.writeSecurity(\\\\\\\\\\\\\\\"Superuser access verified.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1941 return false\\\\\\\\\\\\\\\
1942 else\\\\\\\\\\\\\\\
1943 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1944 return true\\\\\\\\\\\\\\\
1945 end\\\\\\\\\\\\\\\
1946 elseif find1 == \\\\\\\\\\\\\\\"startup\\\\\\\\\\\\\\\" or find1 == \\\\\\\\\\\\\\\"/startup\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
1947 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access bootloader!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1948 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1949 return true\\\\\\\\\\\\\\\
1950 end \\\\\\\\\\\\\\\
1951 return oldReadOnly(path)\\\\\\\\\\\\\\\
1952end\\\\\\\\\\\\\\\
1953_G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"move\\\\\\\\\\\\\\\"] = function(path1, path2)\\\\\\\\\\\\\\\
1954 local find2 = shell.resolve(path1)\\\\\\\\\\\\\\\
1955 if string.find(find2, \\\\\\\\\\\\\\\"boot\\\\\\\\\\\\\\\") or string.find(find2, \\\\\\\\\\\\\\\"etc\\\\\\\\\\\\\\\") or string.find(find2, \\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\") or string.find(find2, \\\\\\\\\\\\\\\"sbin\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
1956 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access system files!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1957 if security.getSU() or _IDENTIFIER then\\\\\\\\\\\\\\\
1958 log.writeSecurity(\\\\\\\\\\\\\\\"Superuser access verified.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1959 else\\\\\\\\\\\\\\\
1960 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1961 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1962 return nil\\\\\\\\\\\\\\\
1963 end\\\\\\\\\\\\\\\
1964 elseif find2 == \\\\\\\\\\\\\\\"startup\\\\\\\\\\\\\\\" or find2 == \\\\\\\\\\\\\\\"/startup\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
1965 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access bootloader!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1966 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1967 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1968 return nil\\\\\\\\\\\\\\\
1969 end \\\\\\\\\\\\\\\
1970 return oldMove(path1, path2)\\\\\\\\\\\\\\\
1971end\\\\\\\\\\\\\\\
1972_G[\\\\\\\\\\\\\\\"fs\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"delete\\\\\\\\\\\\\\\"] = function(path)\\\\\\\\\\\\\\\
1973 local find3 = shell.resolve(path)\\\\\\\\\\\\\\\
1974 if string.find(find3, \\\\\\\\\\\\\\\"boot\\\\\\\\\\\\\\\") or string.find(find3, \\\\\\\\\\\\\\\"etc\\\\\\\\\\\\\\\") or string.find(find3, \\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\") or string.find(find3, \\\\\\\\\\\\\\\"sbin\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
1975 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access system files!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1976 if security.getSU() or _IDENTIFIER then\\\\\\\\\\\\\\\
1977 log.writeSecurity(\\\\\\\\\\\\\\\"Superuser access verified.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1978 else\\\\\\\\\\\\\\\
1979 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1980 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1981 return nil\\\\\\\\\\\\\\\
1982 end\\\\\\\\\\\\\\\
1983 elseif find3 == \\\\\\\\\\\\\\\"startup\\\\\\\\\\\\\\\" or find3 == \\\\\\\\\\\\\\\"/startup\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
1984 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to access bootloader!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1985 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1986 exception.throw(\\\\\\\\\\\\\\\"RestrictedOpsException\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1987 return nil\\\\\\\\\\\\\\\
1988 end \\\\\\\\\\\\\\\
1989 return oldDelete(path)\\\\\\\\\\\\\\\
1990end\\\\\\\\\\\\\\\
1991_G[\\\\\\\\\\\\\\\"http\\\\\\\\\\\\\\\"][\\\\\\\\\\\\\\\"get\\\\\\\\\\\\\\\"] = function(url, headers)\\\\\\\\\\\\\\\
1992 log.writeSecurity(\\\\\\\\\\\\\\\"Downloaded contents of \\\\\\\\\\\\\\\"..url)\\\\\\\\\\\\\\\
1993 return oldHttpGet(url, headers)\\\\\\\\\\\\\\\
1994end\\\\\\\\\\\\\\\
1995_G[\\\\\\\\\\\\\\\"error\\\\\\\\\\\\\\\"] = function(text, lvl)\\\\\\\\\\\\\\\
1996 local x = lvl or 2\\\\\\\\\\\\\\\
1997 local logger = fs.open(\\\\\\\\\\\\\\\"/etc/errorLog\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
1998 logger.writeLine(tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"..text)\\\\\\\\\\\\\\\
1999 logger.close()\\\\\\\\\\\\\\\
2000 oldError(text, x or 1)\\\\\\\\\\\\\\\
2001end\\\\\\\\\\\\\\\
2002rawset(fs, \\\\\\\\\\\\\\\"_native\\\\\\\\\\\\\\\", {})\\\\\\\\\\\\\\\
2003rawset(fs, \\\\\\\\\\\\\\\"_native.check\\\\\\\\\\\\\\\", oldReadOnly)\\\\\\\\\\\\\\\
2004rawset(fs, \\\\\\\\\\\\\\\"_native.move\\\\\\\\\\\\\\\", oldMove)\\\\\\\\\\\\\\\
2005rawset(fs, \\\\\\\\\\\\\\\"_native.delete\\\\\\\\\\\\\\\", oldDelete)\\\\\\\\\\\\\\\
2006rawset(http, \\\\\\\\\\\\\\\"_synchronise\\\\\\\\\\\\\\\", oldHttpGet)\\\\\\\\\\\\\\\
2007rawset(os, \\\\\\\\\\\\\\\"_exception\\\\\\\\\\\\\\\", oldError)\\\\\\\\\\\\\\\
2008log.writeBootLog(\\\\\\\\\\\\\\\"Boot sequence stage 2 completee\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2009kernel.clear()\\\\\\\\\\\\\\\
2010shell.run(\\\\\\\\\\\\\\\"/etc/auth\\\\\\\\\\\\\\\")\\\\\\\"\\\",\\\
2011}\",\
2012 \"F:tesseract.img\",\
2013 \"\\\"9999999999999999999999999999999999999\\\\\\\
20149bbb9bbb9bbb9bbb9bbb9bb999b999bb9bbb9\\\\\\\
201599b99b999b999b999b999b9b9b9b9b9999b99\\\\\\\
201699b99bbb9bbb9bbb9bbb9bb99b9b9b9999b99\\\\\\\
201799b99b99999b999b9b999b9b9bbb9b9999b99\\\\\\\
201899b99bbb9bbb9bbb9bbb9b9b9b9b99bb99b99\\\\\\\
20199999999999999999999999999999999999999\\\"\",\
2020}",
2021 "D:etc",
2022 "{\
2023 \"D:.backups\",\
2024 \"{}\",\
2025 \"F:auth\",\
2026 \"\\\"while true do\\\\\\\
2027 write(\\\\\\\"Username: \\\\\\\")\\\\\\\
2028 local input = read()\\\\\\\
2029 if fs.exists(\\\\\\\"/etc/passwd/\\\\\\\"..input..\\\\\\\".dat\\\\\\\") and not fs.isDir(\\\\\\\"/etc/passwd/\\\\\\\"..input..\\\\\\\".dat\\\\\\\") then\\\\\\\
2030 local pass = security.unpassbyte(input)\\\\\\\
2031 while true do\\\\\\\
2032 if kernel.secureInput(\\\\\\\"Password:\\\\\\\", pass) then\\\\\\\
2033 os.pullEvent = function()\\\\\\\
2034 local eventData = { os.pullEventRaw( _sFilter ) }\\\\\\\
2035 if eventData[1] == \\\\\\\"terminate\\\\\\\" then\\\\\\\
2036 error( \\\\\\\"Terminated\\\\\\\", 0 )\\\\\\\
2037 end\\\\\\\
2038 return unpack( eventData )\\\\\\\
2039 end\\\\\\\
2040 kernel.clear()\\\\\\\
2041 rawset(_G, \\\\\\\"_activeUser\\\\\\\", input)\\\\\\\
2042 if fs.exists(\\\\\\\"/home/\\\\\\\".._G[\\\\\\\"_activeUser\\\\\\\"]..\\\\\\\"/autorun\\\\\\\") then\\\\\\\
2043 shell.run(\\\\\\\"/home/\\\\\\\".._G[\\\\\\\"_activeUser\\\\\\\"]..\\\\\\\"/autorun\\\\\\\")\\\\\\\
2044 end\\\\\\\
2045 log.writeAuth(\\\\\\\"User \\\\\\\"..input..\\\\\\\" logged in\\\\\\\")\\\\\\\
2046 if input == \\\\\\\"root\\\\\\\" then\\\\\\\
2047 log.writeSecurity(\\\\\\\"Superuser account is active\\\\\\\")\\\\\\\
2048 end\\\\\\\
2049 shell.run(\\\\\\\"/bin/sh\\\\\\\")\\\\\\\
2050 if security.getSU() then\\\\\\\
2051 gui.printAppWarning(\\\\\\\"kernel\\\\\\\", \\\\\\\"exiting into top-level shell\\\\\\\")\\\\\\\
2052 log.writeMessage(\\\\\\\"exiting into top-level shell\\\\\\\")\\\\\\\
2053 break\\\\\\\
2054 end\\\\\\\
2055 kernel.shutdown(false)\\\\\\\
2056 end\\\\\\\
2057 end\\\\\\\
2058 end\\\\\\\
2059 if input == \\\\\\\"root\\\\\\\" and security.getSU() then\\\\\\\
2060 break\\\\\\\
2061 end\\\\\\\
2062end\\\"\",\
2063 \"F:autorun\",\
2064 \"\\\"local oldPath = shell.path()\\\\\\\
2065shell.setPath(oldPath..\\\\\\\":/bin:/sbin:/etc/script_util:/usr/bin:/usr/local/bin\\\\\\\")\\\\\\\
2066\\\\\\\
2067os.version = function()\\\\\\\
2068 return \\\\\\\"TESSERACT Alpha | Release Preview 1.0.0/#0095\\\\\\\"\\\\\\\
2069end\\\\\\\
2070\\\\\\\
2071local link = config.load(\\\\\\\"/etc/link.dat\\\\\\\")\\\\\\\
2072\\\\\\\
2073for k,v in pairs(link) do\\\\\\\
2074 shell.setAlias(k, v)\\\\\\\
2075end\\\"\",\
2076 \"D:config\",\
2077 \"{}\",\
2078 \"F:errorLog\",\
2079 \"\\\"207d:19:39 | Cannot serialize type function\\\\\\\
2080208d:6:38 | 1\\\"\",\
2081 \"D:kernel\",\
2082 \"{\\\
2083 \\\"D:libraries\\\",\\\
2084 \\\"{}\\\",\\\
2085}\",\
2086 \"D:lib\",\
2087 \"{\\\
2088 \\\"F:config\\\",\\\
2089 \\\"\\\\\\\"function load(path)\\\\\\\\\\\\\\\
2090 if fs.exists(path) and not fs.isDir(path) then\\\\\\\\\\\\\\\
2091 local lf = fs.open(path, \\\\\\\\\\\\\\\"r\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2092 local contents = lf.readAll()\\\\\\\\\\\\\\\
2093 lf.close()\\\\\\\\\\\\\\\
2094 return textutils.unserialize(contents)\\\\\\\\\\\\\\\
2095 else\\\\\\\\\\\\\\\
2096 return nil\\\\\\\\\\\\\\\
2097 end\\\\\\\\\\\\\\\
2098end\\\\\\\\\\\\\\\
2099\\\\\\\\\\\\\\\
2100function save(cTable, path)\\\\\\\\\\\\\\\
2101 if fs.exists(path) then\\\\\\\\\\\\\\\
2102 if fs.isDir(path) then\\\\\\\\\\\\\\\
2103 return false\\\\\\\\\\\\\\\
2104 end\\\\\\\\\\\\\\\
2105 end\\\\\\\\\\\\\\\
2106 local sf = fs.open(path, \\\\\\\\\\\\\\\"w\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2107 sf.write(textutils.serialize(cTable))\\\\\\\\\\\\\\\
2108 sf.close()\\\\\\\\\\\\\\\
2109 return true\\\\\\\\\\\\\\\
2110end\\\\\\\"\\\",\\\
2111 \\\"F:exception\\\",\\\
2112 \\\"\\\\\\\"local instances = {}\\\\\\\\\\\\\\\
2113\\\\\\\\\\\\\\\
2114instances.GenericException = function(text)\\\\\\\\\\\\\\\
2115 gui.printAppWarning(fs.getName(shell.getRunningProgram()), text)\\\\\\\\\\\\\\\
2116 log.writeSecurity(text) \\\\\\\\\\\\\\\
2117end\\\\\\\\\\\\\\\
2118\\\\\\\\\\\\\\\
2119instances.RestrictedOpsException = function(a)\\\\\\\\\\\\\\\
2120 b = a or \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
2121 gui.printAppWarning(\\\\\\\\\\\\\\\"kernel\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"attempt to perform restricted operations\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2122 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt to perform restricted operations!\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2123 log.writeSecurity(\\\\\\\\\\\\\\\"Attempt blocked.\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2124end\\\\\\\\\\\\\\\
2125\\\\\\\\\\\\\\\
2126instances.SecurityException = function(path)\\\\\\\\\\\\\\\
2127 gui.printAppWarning(\\\\\\\\\\\\\\\"kernel\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"attempt to perform restricted operations\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2128 log.writeSecurity(_activeUser..\\\\\\\\\\\\\\\" attempted to open restricted file at \\\\\\\\\\\\\\\"..path)\\\\\\\\\\\\\\\
2129end\\\\\\\\\\\\\\\
2130\\\\\\\\\\\\\\\
2131function throw(exception, arg)\\\\\\\\\\\\\\\
2132 if instances[exception] then\\\\\\\\\\\\\\\
2133 instances[exception](arg)\\\\\\\\\\\\\\\
2134 else\\\\\\\\\\\\\\\
2135 instances.GenericException(\\\\\\\\\\\\\\\"no such exception\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2136 end\\\\\\\\\\\\\\\
2137end\\\\\\\"\\\",\\\
2138 \\\"F:log\\\",\\\
2139 \\\"\\\\\\\"-- this is a compatibility file for supporting kernel-mode logging\\\\\\\\\\\\\\\
2140\\\\\\\\\\\\\\\
2141writeSyslog = kernel.writeSyslog\\\\\\\\\\\\\\\
2142writeMessage = kernel.writeMessage\\\\\\\\\\\\\\\
2143writeSecurity = kernel.writeSecurity\\\\\\\\\\\\\\\
2144writeShutdown = kernel.writeShutdown\\\\\\\\\\\\\\\
2145writeAuth = kernel.writeAuth\\\\\\\\\\\\\\\
2146writeBootLog = kernel.writeBootLog\\\\\\\"\\\",\\\
2147 \\\"F:luaex\\\",\\\
2148 \\\"\\\\\\\"function stringToByteArray(str)\\\\\\\\\\\\\\\
2149 return string.byte(str, 1, str:len())\\\\\\\\\\\\\\\
2150end\\\\\\\\\\\\\\\
2151\\\\\\\\\\\\\\\
2152function argsToTable(...)\\\\\\\\\\\\\\\
2153 return { ... }\\\\\\\\\\\\\\\
2154end\\\\\\\\\\\\\\\
2155\\\\\\\\\\\\\\\
2156function stringFromByteArray(...)\\\\\\\\\\\\\\\
2157 return string.char(...)\\\\\\\\\\\\\\\
2158end\\\\\\\\\\\\\\\
2159\\\\\\\\\\\\\\\
2160function iterateFileLines(path)\\\\\\\\\\\\\\\
2161 local handle = fs.open(path, \\\\\\\\\\\\\\\"r\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2162 local commands = {}\\\\\\\\\\\\\\\
2163 local line = handle.readLine()\\\\\\\\\\\\\\\
2164 while line do\\\\\\\\\\\\\\\
2165 commands[#commands + 1] = line\\\\\\\\\\\\\\\
2166 line = handle.readLine()\\\\\\\\\\\\\\\
2167 end\\\\\\\\\\\\\\\
2168 handle.close()\\\\\\\\\\\\\\\
2169 return commands\\\\\\\\\\\\\\\
2170end\\\\\\\\\\\\\\\
2171\\\\\\\\\\\\\\\
2172local function string_separate(str)\\\\\\\\\\\\\\\
2173 local t = {}\\\\\\\\\\\\\\\
2174 for i in string.gmatch(str, \\\\\\\\\\\\\\\"[A-z]\\\\\\\\\\\\\\\") do\\\\\\\\\\\\\\\
2175 table.insert(t, i)\\\\\\\\\\\\\\\
2176 end\\\\\\\\\\\\\\\
2177 return t\\\\\\\\\\\\\\\
2178end\\\\\\\"\\\",\\\
2179 \\\"F:net\\\",\\\
2180 \\\"\\\\\\\"local isOnline = false\\\\\\\\\\\\\\\
2181\\\\\\\\\\\\\\\
2182function getHTTP(url)\\\\\\\\\\\\\\\
2183 local handlex = http.get(url)\\\\\\\\\\\\\\\
2184 local contents = handlex.readAll()\\\\\\\\\\\\\\\
2185 handlex.close()\\\\\\\\\\\\\\\
2186 return contents\\\\\\\\\\\\\\\
2187end\\\\\\\\\\\\\\\
2188\\\\\\\\\\\\\\\
2189function openModems()\\\\\\\\\\\\\\\
2190 for n,sModem in ipairs( peripheral.getNames() ) do\\\\\\\\\\\\\\\
2191 if peripheral.getType( sModem ) == \\\\\\\\\\\\\\\"modem\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
2192 if not rednet.isOpen( sModem ) then\\\\\\\\\\\\\\\
2193 rednet.open( sModem )\\\\\\\\\\\\\\\
2194 end\\\\\\\\\\\\\\\
2195 end\\\\\\\\\\\\\\\
2196 end\\\\\\\\\\\\\\\
2197end\\\\\\\\\\\\\\\
2198\\\\\\\\\\\\\\\
2199function closeModems()\\\\\\\\\\\\\\\
2200 for n,sModem in ipairs( peripheral.getNames() ) do\\\\\\\\\\\\\\\
2201 if peripheral.getType( sModem ) == \\\\\\\\\\\\\\\"modem\\\\\\\\\\\\\\\" then\\\\\\\\\\\\\\\
2202 if rednet.isOpen( sModem ) then\\\\\\\\\\\\\\\
2203 rednet.close( sModem )\\\\\\\\\\\\\\\
2204 end\\\\\\\\\\\\\\\
2205 end\\\\\\\\\\\\\\\
2206 end\\\\\\\\\\\\\\\
2207end\\\\\\\\\\\\\\\
2208\\\\\\\\\\\\\\\
2209function getModemStatus(side)\\\\\\\\\\\\\\\
2210 gui.printAppInfo(\\\\\\\\\\\\\\\"net\\\\\\\\\\\\\\\", side .. \\\\\\\\\\\\\\\" modem status: \\\\\\\\\\\\\\\" .. tostring(rednet.isOpen(side)))\\\\\\\\\\\\\\\
2211 return rednet.isOpen(side)\\\\\\\\\\\\\\\
2212end\\\\\\\\\\\\\\\
2213\\\\\\\\\\\\\\\
2214-- DNS self-hosting functions\\\\\\\\\\\\\\\
2215\\\\\\\\\\\\\\\
2216function setWorkstationStatus(state)\\\\\\\\\\\\\\\
2217 if state == true and isOnline == false then\\\\\\\\\\\\\\\
2218 local label = os.getComputerLabel() or \\\\\\\\\\\\\\\"Tesseract\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
2219 rednet.host(\\\\\\\\\\\\\\\"tesseract_dns\\\\\\\\\\\\\\\", tostring(os.getComputerID())..\\\\\\\\\\\\\\\"_\\\\\\\\\\\\\\\"..label)\\\\\\\\\\\\\\\
2220 isOnline = true\\\\\\\\\\\\\\\
2221 log.writeSyslog(\\\\\\\\\\\\\\\"Now susceptible for DNS lookup\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2222 log.writeMessage(\\\\\\\\\\\\\\\"Assigned DNS label \\\\\\\\\\\\\\\"..tostring(os.getComputerID())..\\\\\\\\\\\\\\\"_\\\\\\\\\\\\\\\"..label)\\\\\\\\\\\\\\\
2223 elseif state == false and isOnline == true then\\\\\\\\\\\\\\\
2224 local label = os.getComputerLabel or \\\\\\\\\\\\\\\"Tesseract\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
2225 rednet.host(\\\\\\\\\\\\\\\"tesseract_dns\\\\\\\\\\\\\\\", tostring(os.getComputerID())..\\\\\\\\\\\\\\\"_\\\\\\\\\\\\\\\"..label)\\\\\\\\\\\\\\\
2226 isOnline = false\\\\\\\\\\\\\\\
2227 log.writeSyslog(\\\\\\\\\\\\\\\"No longer susceptible for DNS lookup\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2228 log.writeMessage(\\\\\\\\\\\\\\\"De-assigned DNS label \\\\\\\\\\\\\\\"..tostring(os.getComputerID())..\\\\\\\\\\\\\\\"_\\\\\\\\\\\\\\\"..label)\\\\\\\\\\\\\\\
2229 elseif state == true and isOnline == true then\\\\\\\\\\\\\\\
2230 gui.printAppWarning(\\\\\\\\\\\\\\\"net\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"workstation already online\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2231 elseif state == false and isOnline == false then\\\\\\\\\\\\\\\
2232 gui.printAppWarning(\\\\\\\\\\\\\\\"net\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"workstation already offline\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2233 else\\\\\\\\\\\\\\\
2234 log.writeSyslog(\\\\\\\\\\\\\\\"RedNet interface error\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2235 return nil, \\\\\\\\\\\\\\\"error in RNI, please consult developer\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
2236 end\\\\\\\\\\\\\\\
2237end\\\\\\\\\\\\\\\
2238\\\\\\\\\\\\\\\
2239function getWorkstationStatus()\\\\\\\\\\\\\\\
2240 return isOnline\\\\\\\\\\\\\\\
2241end\\\\\\\\\\\\\\\
2242\\\\\\\\\\\\\\\
2243function findWorkstation(query)\\\\\\\\\\\\\\\
2244 if rednet.lookup(\\\\\\\\\\\\\\\"tesseract_dns\\\\\\\\\\\\\\\", query) ~= nil then\\\\\\\\\\\\\\\
2245 return true, rednet.lookup(\\\\\\\\\\\\\\\"tesseract_dns\\\\\\\\\\\\\\\", query)\\\\\\\\\\\\\\\
2246 else\\\\\\\\\\\\\\\
2247 return false, nil\\\\\\\\\\\\\\\
2248 end\\\\\\\\\\\\\\\
2249end\\\\\\\"\\\",\\\
2250 \\\"F:search\\\",\\\
2251 \\\"\\\\\\\"function traverseKey(array, text)\\\\\\\\\\\\\\\
2252 for k,v in pairs(array) do\\\\\\\\\\\\\\\
2253 if v == text then\\\\\\\\\\\\\\\
2254 return true, k\\\\\\\\\\\\\\\
2255 end\\\\\\\\\\\\\\\
2256 end\\\\\\\\\\\\\\\
2257 return false, nil\\\\\\\\\\\\\\\
2258end\\\\\\\\\\\\\\\
2259\\\\\\\\\\\\\\\
2260function traverseValue(array, text)\\\\\\\\\\\\\\\
2261 for k,v in pairs(array) do\\\\\\\\\\\\\\\
2262 if k == text then\\\\\\\\\\\\\\\
2263 return true, v\\\\\\\\\\\\\\\
2264 end\\\\\\\\\\\\\\\
2265 end\\\\\\\\\\\\\\\
2266 return false, nil\\\\\\\\\\\\\\\
2267end\\\\\\\\\\\\\\\
2268\\\\\\\\\\\\\\\
2269function findKey(array, text)\\\\\\\\\\\\\\\
2270 for k,v in pairs(array) do\\\\\\\\\\\\\\\
2271 if k == text then\\\\\\\\\\\\\\\
2272 return true, k\\\\\\\\\\\\\\\
2273 end\\\\\\\\\\\\\\\
2274 end\\\\\\\\\\\\\\\
2275 return false, nil\\\\\\\\\\\\\\\
2276end\\\\\\\\\\\\\\\
2277\\\\\\\\\\\\\\\
2278function findValue(array, text)\\\\\\\\\\\\\\\
2279 for k,v in pairs(array) do\\\\\\\\\\\\\\\
2280 if v == text then\\\\\\\\\\\\\\\
2281 return true, v\\\\\\\\\\\\\\\
2282 end\\\\\\\\\\\\\\\
2283 end\\\\\\\\\\\\\\\
2284 return false, nil\\\\\\\\\\\\\\\
2285end\\\\\\\\\\\\\\\
2286\\\\\\\\\\\\\\\
2287function queryForKey(array, text)\\\\\\\\\\\\\\\
2288 for k,v in pairs(array) do\\\\\\\\\\\\\\\
2289 if string.find(k, text) then\\\\\\\\\\\\\\\
2290 return true, k\\\\\\\\\\\\\\\
2291 end\\\\\\\\\\\\\\\
2292 end\\\\\\\\\\\\\\\
2293 return false, nil\\\\\\\\\\\\\\\
2294end\\\\\\\\\\\\\\\
2295\\\\\\\\\\\\\\\
2296function queryForValue(array, text)\\\\\\\\\\\\\\\
2297 for k,v in pairs(array) do\\\\\\\\\\\\\\\
2298 if string.find(v, text) then\\\\\\\\\\\\\\\
2299 return true, v\\\\\\\\\\\\\\\
2300 end\\\\\\\\\\\\\\\
2301 end\\\\\\\\\\\\\\\
2302 return false, nil\\\\\\\\\\\\\\\
2303end\\\\\\\"\\\",\\\
2304 \\\"F:security\\\",\\\
2305 \\\"\\\\\\\"local _IDENTIFIER = \\\\\\\\\\\\\\\"ac30527de6170b7d545bdc152f76237276537f2cf8eb7fe5bdb2a7627f48cec1\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
2306\\\\\\\\\\\\\\\
2307function getSU()\\\\\\\\\\\\\\\
2308 if fs.exists(\\\\\\\\\\\\\\\"/etc/passwd/.shadow/\\\\\\\\\\\\\\\".._G[\\\\\\\\\\\\\\\"_activeUser\\\\\\\\\\\\\\\"]..\\\\\\\\\\\\\\\".usr\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
2309 local ud = dofile(\\\\\\\\\\\\\\\"/etc/passwd/.shadow/\\\\\\\\\\\\\\\".._G[\\\\\\\\\\\\\\\"_activeUser\\\\\\\\\\\\\\\"]..\\\\\\\\\\\\\\\".usr\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2310 return ud.SU\\\\\\\\\\\\\\\
2311 else\\\\\\\\\\\\\\\
2312 return false\\\\\\\\\\\\\\\
2313 end\\\\\\\\\\\\\\\
2314end\\\\\\\\\\\\\\\
2315\\\\\\\\\\\\\\\
2316function getID()\\\\\\\\\\\\\\\
2317 return _IDENTIFIER\\\\\\\\\\\\\\\
2318end\\\\\\\\\\\\\\\
2319\\\\\\\\\\\\\\\
2320function getActiveUserStatus()\\\\\\\\\\\\\\\
2321 if fs.exists(\\\\\\\\\\\\\\\"/etc/passwd/.shadow/\\\\\\\\\\\\\\\".._G[\\\\\\\\\\\\\\\"_activeUser\\\\\\\\\\\\\\\"]..\\\\\\\\\\\\\\\".usr\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
2322 local ud = dofile(\\\\\\\\\\\\\\\"/etc/passwd/.shadow/\\\\\\\\\\\\\\\".._G[\\\\\\\\\\\\\\\"_activeUser\\\\\\\\\\\\\\\"]..\\\\\\\\\\\\\\\".usr\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2323 if ud.ID == getID() then\\\\\\\\\\\\\\\
2324 return true\\\\\\\\\\\\\\\
2325 end\\\\\\\\\\\\\\\
2326 return false\\\\\\\\\\\\\\\
2327 else\\\\\\\\\\\\\\\
2328 return false\\\\\\\\\\\\\\\
2329 end\\\\\\\\\\\\\\\
2330end\\\\\\\\\\\\\\\
2331\\\\\\\\\\\\\\\
2332function passbyte(username, str)\\\\\\\\\\\\\\\
2333 passTable = luaex.argsToTable(luaex.stringToByteArray(str))\\\\\\\\\\\\\\\
2334 if config.save(passTable, \\\\\\\\\\\\\\\"/etc/passwd/\\\\\\\\\\\\\\\"..username..\\\\\\\\\\\\\\\".dat\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
2335 return true\\\\\\\\\\\\\\\
2336 else\\\\\\\\\\\\\\\
2337 return false\\\\\\\\\\\\\\\
2338 end\\\\\\\\\\\\\\\
2339end\\\\\\\\\\\\\\\
2340\\\\\\\\\\\\\\\
2341function unpassbyte(username)\\\\\\\\\\\\\\\
2342 passTable = config.load(\\\\\\\\\\\\\\\"/etc/passwd/\\\\\\\\\\\\\\\"..username..\\\\\\\\\\\\\\\".dat\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2343 if passTable ~= nil then\\\\\\\\\\\\\\\
2344 return luaex.stringFromByteArray(unpack(passTable))\\\\\\\\\\\\\\\
2345 end\\\\\\\\\\\\\\\
2346end\\\\\\\"\\\",\\\
2347 \\\"F:tpm\\\",\\\
2348 \\\"\\\\\\\"function getPaste(file, id, overwrite)\\\\\\\\\\\\\\\
2349 if overwrite and fs.exists(file) and string.find(file, \\\\\\\\\\\\\\\"system/\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
2350 if fs.exists(\\\\\\\\\\\\\\\"/etc/.backups/\\\\\\\\\\\\\\\"..file) then\\\\\\\\\\\\\\\
2351 fs.delete(\\\\\\\\\\\\\\\"/etc/.backups/\\\\\\\\\\\\\\\"..file)\\\\\\\\\\\\\\\
2352 end\\\\\\\\\\\\\\\
2353 fs.copy(file, \\\\\\\\\\\\\\\"/etc/.backups/\\\\\\\\\\\\\\\"..file)\\\\\\\\\\\\\\\
2354 end\\\\\\\\\\\\\\\
2355 return kernel.getFile(file, \\\\\\\\\\\\\\\"http://pastebin.com/raw/\\\\\\\\\\\\\\\"..id, overwrite)\\\\\\\\\\\\\\\
2356end\\\\\\\\\\\\\\\
2357\\\\\\\\\\\\\\\
2358function downloadAPI(filename, id)\\\\\\\\\\\\\\\
2359 return getPaste(\\\\\\\\\\\\\\\"/usr/local/lib/\\\\\\\\\\\\\\\"..filename, id, true)\\\\\\\\\\\\\\\
2360end\\\\\\\\\\\\\\\
2361\\\\\\\\\\\\\\\
2362function downloadBinary(filename, id)\\\\\\\\\\\\\\\
2363 return getPaste(\\\\\\\\\\\\\\\"/usr/local/bin/\\\\\\\\\\\\\\\"..filename, id, true)\\\\\\\\\\\\\\\
2364end\\\\\\\\\\\\\\\
2365\\\\\\\\\\\\\\\
2366function toPackageAPI(filename)\\\\\\\\\\\\\\\
2367 return \\\\\\\\\\\\\\\"/usr/local/lib/\\\\\\\\\\\\\\\"..filename\\\\\\\\\\\\\\\
2368end\\\\\\\\\\\\\\\
2369\\\\\\\\\\\\\\\
2370function toPackageBinary(filename)\\\\\\\\\\\\\\\
2371 return \\\\\\\\\\\\\\\"/usr/local/bin/\\\\\\\\\\\\\\\"..filename\\\\\\\\\\\\\\\
2372end\\\\\\\"\\\",\\\
2373}\",\
2374 \"F:link.dat\",\
2375 \"\\\"{[\\\\\\\"lua\\\\\\\"]=\\\\\\\"/bin/lsh\\\\\\\",[\\\\\\\"username\\\\\\\"]=\\\\\\\"/bin/uname\\\\\\\",[\\\\\\\"whoami\\\\\\\"]=\\\\\\\"/bin/uname\\\\\\\",[\\\\\\\"help\\\\\\\"]=\\\\\\\"/bin/man\\\\\\\",[\\\\\\\"shell\\\\\\\"]=\\\\\\\"/bin/sh\\\\\\\",[\\\\\\\"sh\\\\\\\"]=\\\\\\\"/bin/sh\\\\\\\",[\\\\\\\"shutdown\\\\\\\"]=\\\\\\\"/sbin/shutdown\\\\\\\",[\\\\\\\"reboot\\\\\\\"]=\\\\\\\"/sbin/reboot\\\\\\\",}\\\"\",\
2376 \"D:manuals\",\
2377 \"{\\\
2378 \\\"F:api-app\\\",\\\
2379 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2380The Application API is deprecated since Warp Sierra\\\\\\\\\\\\\\\
2381and has been merged into the Tesseract kernel.\\\\\\\\\\\\\\\
2382This manual page will be removed soon.\\\\\\\\\\\\\\\
2383\\\\\\\"\\\",\\\
2384 \\\"F:api-config\\\",\\\
2385 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2386The Configuration API deals with configuration\\\\\\\\\\\\\\\
2387files: it loads and saves tables into files.\\\\\\\\\\\\\\\
2388\\\\\\\\\\\\\\\
2389It has two functions:\\\\\\\\\\\\\\\
2390config.load(path)\\\\\\\\\\\\\\\
2391config.save(tableToSave, path)\\\\\\\\\\\\\\\
2392\\\\\\\\\\\\\\\
2393Configuration files are usually marked by the\\\\\\\\\\\\\\\
2394'.conf' extension.\\\\\\\"\\\",\\\
2395 \\\"F:api-custom\\\",\\\
2396 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2397The 'Custom API' is used to add functions and\\\\\\\\\\\\\\\
2398values to the runtime environment without much\\\\\\\\\\\\\\\
2399hard work ('man custom-api').\\\\\\\"\\\",\\\
2400 \\\"F:api-gui\\\",\\\
2401 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2402The Graphical User Interface API is responsible\\\\\\\\\\\\\\\
2403for all the colorful text and interface elements\\\\\\\\\\\\\\\
2404of Tesseract and has the following functions:\\\\\\\\\\\\\\\
2405button(txt, x1, x2, y)\\\\\\\\\\\\\\\
2406counter(txt, y)\\\\\\\\\\\\\\\
2407drawProgress(txt, y) / drawProgressAlt()\\\\\\\\\\\\\\\
2408printBootInfo(i)\\\\\\\\\\\\\\\
2409printBootWarning(w)\\\\\\\\\\\\\\\
2410printBootSuccess(s)\\\\\\\\\\\\\\\
2411printAppInfo(header, msg)\\\\\\\\\\\\\\\
2412printAppWarning(header, msg)\\\\\\\\\\\\\\\
2413printAppSuccess(header, msg)\\\\\\\\\\\\\\\
2414request(text)\\\\\\\\\\\\\\\
2415drawImg(path, x. y)\\\\\\\\\\\\\\\
2416printColoredTextLine(y, txt, bg, fg)\\\\\\\\\\\\\\\
2417clearScreen(bgColor)\\\\\\\"\\\",\\\
2418 \\\"F:api-kernel\\\",\\\
2419 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2420The Kernel API is the one that backs the whole\\\\\\\\\\\\\\\
2421Operating System. It provides wrappers for some\\\\\\\\\\\\\\\
2422in-built functions, and is responsible for\\\\\\\\\\\\\\\
2423error report generation.\\\\\\\\\\\\\\\
2424\\\\\\\\\\\\\\\
2425Functions in the Kernel API:\\\\\\\\\\\\\\\
2426credits()\\\\\\\\\\\\\\\
2427clear()\\\\\\\\\\\\\\\
2428crashReport(path, description)\\\\\\\\\\\\\\\
2429import(file) (A safe os.loadAPI)\\\\\\\\\\\\\\\
2430require(file) (A primitive require function)\\\\\\\\\\\\\\\
2431APIHook(api)\\\\\\\\\\\\\\\
2432printFile(file)\\\\\\\\\\\\\\\
2433secureInput(invite, definition)\\\\\\\\\\\\\\\
2434shutdown(removeVar) / reboot(removeVar)\\\\\\\\\\\\\\\
2435findManual(name) (Find a manual file path)\\\\\\\\\\\\\\\
2436The Logging API ('man api-log') functions\\\\\\\"\\\",\\\
2437 \\\"F:api-log\\\",\\\
2438 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2439The Logging API serves as a log file\\\\\\\\\\\\\\\
2440handler.\\\\\\\\\\\\\\\
2441Logs are viewed through dmesg ('man dmesg')\\\\\\\\\\\\\\\
2442\\\\\\\\\\\\\\\
2443Functions with corresponding files:\\\\\\\\\\\\\\\
2444writeAuth(msg) -> /var/log/auth\\\\\\\\\\\\\\\
2445writeBootLog(msg) -> /var/log/boot\\\\\\\\\\\\\\\
2446writeMessage(msg) -> /var/log/messages\\\\\\\\\\\\\\\
2447writeSyslog(msg) -> /var/log/syslog\\\\\\\\\\\\\\\
2448writeSecurity(msg) -> /var/log/security\\\\\\\\\\\\\\\
2449writeShutdown(msg) -> /var/log/shutdown\\\\\\\"\\\",\\\
2450 \\\"F:api-luaex\\\",\\\
2451 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2452The LuaEx API is used to add new miscellaneous\\\\\\\\\\\\\\\
2453features to the runtime environment.\\\\\\\\\\\\\\\
2454\\\\\\\\\\\\\\\
2455Functions:\\\\\\\\\\\\\\\
2456stringToByteArray(str)\\\\\\\\\\\\\\\
2457argsToTable(...)\\\\\\\\\\\\\\\
2458stringFromByteArray(byteArrayTable)\\\\\\\"\\\",\\\
2459 \\\"F:api-manual\\\",\\\
2460 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2461The Manual API is deprecated since Release 1.0\\\\\\\\\\\\\\\
2462and has been merged into the Tesseract kernel.\\\\\\\\\\\\\\\
2463This manual page will be removed soon.\\\\\\\"\\\",\\\
2464 \\\"F:api-search\\\",\\\
2465 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2466The Search API simplifies searching in key-value\\\\\\\\\\\\\\\
2467arrays.\\\\\\\\\\\\\\\
2468\\\\\\\\\\\\\\\
2469Functions:\\\\\\\\\\\\\\\
2470traverseKey(table, text)\\\\\\\\\\\\\\\
2471traverseValue(table, text)\\\\\\\\\\\\\\\
2472findKey(table, text)\\\\\\\\\\\\\\\
2473findValue(table, text)\\\\\\\"\\\",\\\
2474 \\\"F:api-security\\\",\\\
2475 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2476The Security API serves as a credential handler,\\\\\\\\\\\\\\\
2477and is responsible for user creation and\\\\\\\\\\\\\\\
2478identification.\\\\\\\\\\\\\\\
2479\\\\\\\\\\\\\\\
2480Functions:\\\\\\\\\\\\\\\
2481passbyte(username, password)\\\\\\\\\\\\\\\
2482unpassbyte(username)\\\\\\\\\\\\\\\
2483getSU()\\\\\\\"\\\",\\\
2484 \\\"F:api-tpm\\\",\\\
2485 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2486The Tesseract Package Management API is used to\\\\\\\\\\\\\\\
2487simplify Pastebin handling and file downloads.\\\\\\\\\\\\\\\
2488\\\\\\\\\\\\\\\
2489Functions:\\\\\\\\\\\\\\\
2490getPaste(file, id, overwrite)\\\\\\\\\\\\\\\
2491downloadAPI(file, id) / downloadBinary(file, id)\\\\\\\\\\\\\\\
2492toPackageAPI(filename) / toPackageBinary(filename)\\\\\\\"\\\",\\\
2493 \\\"F:archiver\\\",\\\
2494 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2495archiver <...> [...]\\\\\\\\\\\\\\\
2496\\\\\\\\\\\\\\\
2497Required: mode (zip/unzip)\\\\\\\\\\\\\\\
2498 directory to zip/archive to unzip\\\\\\\\\\\\\\\
2499 archive file name/path to unzip\\\\\\\\\\\\\\\
2500Modes: zip (creates an archive)\\\\\\\\\\\\\\\
2501 unzip (unpacks an archive)\\\\\\\\\\\\\\\
2502\\\\\\\\\\\\\\\
2503If using the zip mode you can specify two\\\\\\\\\\\\\\\
2504directories the archiver will skip after\\\\\\\\\\\\\\\
2505the required parameters.\\\\\\\\\\\\\\\
2506\\\\\\\\\\\\\\\
2507(c) 1Ridav.\\\\\\\\\\\\\\\
2508This is the only third-party program that\\\\\\\\\\\\\\\
2509Tesseract is using. It is, however,\\\\\\\\\\\\\\\
2510not a required part of the system.\\\\\\\\\\\\\\\
2511\\\\\\\"\\\",\\\
2512 \\\"F:asm-reload\\\",\\\
2513 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2514asm-reload <...>\\\\\\\\\\\\\\\
2515\\\\\\\\\\\\\\\
2516Reloads Tesseract assembly caches.\\\\\\\\\\\\\\\
2517\\\\\\\\\\\\\\\
2518Arguments:\\\\\\\\\\\\\\\
2519-s / --silent: Do not print text to the terminal.\\\\\\\\\\\\\\\
2520-c:<cache> / --cache:<cache>: Specifies cache to\\\\\\\\\\\\\\\
2521reload. Can be SYSTEM_CACHE or USER_CACHE.\\\\\\\"\\\",\\\
2522 \\\"F:auth\\\",\\\
2523 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2524The authorization system is one of the Tesseract\\\\\\\\\\\\\\\
2525security measures.\\\\\\\\\\\\\\\
2526\\\\\\\\\\\\\\\
2527Credentials are handled with optimal security.\\\\\\\\\\\\\\\
2528\\\\\\\\\\\\\\\
2529Each user has a home directory (/home/<username>)\\\\\\\\\\\\\\\
2530and a credentials identifier used to determine\\\\\\\\\\\\\\\
2531the user's privileges.\\\\\\\\\\\\\\\
2532\\\\\\\\\\\\\\\
2533See 'man usrutils' for account management programs.\\\\\\\"\\\",\\\
2534 \\\"F:boot-sequence\\\",\\\
2535 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2536The Tesseract Boot Sequence consists of 4 steps:\\\\\\\\\\\\\\\
2537\\\\\\\\\\\\\\\
2538 1 - The boot sequence is initiated.\\\\\\\\\\\\\\\
2539 Tesseract Boot Loader is launched and APIs\\\\\\\\\\\\\\\
2540 are loaded into the global environment.\\\\\\\\\\\\\\\
2541 \\\\\\\\\\\\\\\
2542 2 - The boot loader handles control to the\\\\\\\\\\\\\\\
2543 preferred bootloader record that executes\\\\\\\\\\\\\\\
2544 high-level routines (More: 'man custom-boot').\\\\\\\\\\\\\\\
2545 \\\\\\\\\\\\\\\
2546Assuming that the user prefers the default record:\\\\\\\\\\\\\\\
2547 \\\\\\\\\\\\\\\
2548 3 - Autorun files are handled, and all the code\\\\\\\\\\\\\\\
2549 inside of them is executed.\\\\\\\\\\\\\\\
2550 \\\\\\\\\\\\\\\
2551 4 - The Tesseract shell is launched.\\\\\\\"\\\",\\\
2552 \\\"F:categories\\\",\\\
2553 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2554Some manuals belong to categories.\\\\\\\\\\\\\\\
2555\\\\\\\\\\\\\\\
2556Here they are:\\\\\\\\\\\\\\\
2557\\\\\\\\\\\\\\\
2558 api - Tesseract APIs\\\\\\\\\\\\\\\
2559 custom - customization\\\\\\\"\\\",\\\
2560 \\\"F:changelog\\\",\\\
2561 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2562Build 0100 | Release v1.0 changelog:\\\\\\\\\\\\\\\
2563\\\\\\\\\\\\\\\
2564! URGENT bug fixes!\\\\\\\\\\\\\\\
2565+ Added Lua error interception\\\\\\\\\\\\\\\
2566+ Added scripting\\\\\\\\\\\\\\\
2567* Huge tweaks to kernel and bootloader\\\\\\\\\\\\\\\
2568* Updated the GUI and LuaEx APIs\\\\\\\\\\\\\\\
2569* Integrated the Manual API into the kernel\\\\\\\\\\\\\\\
2570- Removed complex applications\\\\\\\"\\\",\\\
2571 \\\"F:config\\\",\\\
2572 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2573Tesseract Configuration Files are handled by the\\\\\\\\\\\\\\\
2574Configuration API (man api-config). They are used\\\\\\\\\\\\\\\
2575to write easily accessible data to disk and access\\\\\\\\\\\\\\\
2576it when necessary.\\\\\\\\\\\\\\\
2577\\\\\\\\\\\\\\\
2578Actually, they are just serialized Lua tables.\\\\\\\"\\\",\\\
2579 \\\"F:convert\\\",\\\
2580 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2581convert <path>\\\\\\\\\\\\\\\
2582\\\\\\\\\\\\\\\
2583Converts an API-like configuration file to a\\\\\\\\\\\\\\\
2584serializable .conf/.dat file. Does not assign\\\\\\\\\\\\\\\
2585extension automatically.\\\\\\\"\\\",\\\
2586 \\\"F:coreutils\\\",\\\
2587 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2588As the GNU/Linux systems, Tesseract also has its\\\\\\\\\\\\\\\
2589own coreutils package.\\\\\\\\\\\\\\\
2590\\\\\\\\\\\\\\\
2591 asm-reload - reloads APIs\\\\\\\\\\\\\\\
2592 cat <file> - prints out a file\\\\\\\\\\\\\\\
2593 credits - prints out credits\\\\\\\\\\\\\\\
2594 dmesg (...) - displays logs ('man dmesg')\\\\\\\\\\\\\\\
2595 df <size> - displays filesystem stats ('man df')\\\\\\\\\\\\\\\
2596 man <manual page> - displays help ('man man')\\\\\\\\\\\\\\\
2597 scp <path> - copies a file to /home\\\\\\\\\\\\\\\
2598 shell - Tesseract shell\\\\\\\\\\\\\\\
2599 shutdown - performs shutdown\\\\\\\\\\\\\\\
2600 systeminfo (...) - shows stats ('man systeminfo')\\\\\\\\\\\\\\\
2601 tty - displays terminal size\\\\\\\\\\\\\\\
2602 \\\\\\\"\\\",\\\
2603 \\\"F:credits\\\",\\\
2604 \\\"\\\\\\\"Tesseract Operating System (Technical Preview)\\\\\\\\\\\\\\\
2605Made by\\\\\\\\\\\\\\\
2606 - minebuild02 (Head Developer)\\\\\\\\\\\\\\\
2607 - MasatoBaito (Assistant Developer)\\\\\\\\\\\\\\\
2608Special thanks to:\\\\\\\\\\\\\\\
2609 - 1Ridav (Developer of the DCC Archiver)\\\\\\\\\\\\\\\
2610 - Luca_S (Developer of the script parser base)\\\\\\\\\\\\\\\
2611Powered by original code.\\\\\\\\\\\\\\\
2612Licensed under the MIT License, subject to change.\\\\\\\"\\\",\\\
2613 \\\"F:custom\\\",\\\
2614 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2615'custom-boot': Customizing the boot sequence\\\\\\\\\\\\\\\
2616\\\\\\\\\\\\\\\
2617'custom-build': Building your own Tesseract OS\\\\\\\\\\\\\\\
2618\\\\\\\\\\\\\\\
2619'custom-tpm': Creating your own package.dat\\\\\\\\\\\\\\\
2620\\\\\\\\\\\\\\\
2621'custom-script': Automating tasks\\\\\\\"\\\",\\\
2622 \\\"F:custom-autorun\\\",\\\
2623 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2624User autorun files can be used to perform various\\\\\\\\\\\\\\\
2625boot actions while not altering any boot sequence\\\\\\\\\\\\\\\
2626mechanisms.\\\\\\\\\\\\\\\
2627\\\\\\\\\\\\\\\
2628This should not be confused with the system autorun\\\\\\\\\\\\\\\
2629file ('/system/autorun'), that is used to perform\\\\\\\\\\\\\\\
2630post-boot initialization actions.\\\\\\\\\\\\\\\
2631\\\\\\\\\\\\\\\
2632User autorun files are located in\\\\\\\\\\\\\\\
2633/home/<username>/autorun\\\\\\\"\\\",\\\
2634 \\\"F:custom-boot\\\",\\\
2635 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2636You can customize the boot sequence of Tesseract\\\\\\\\\\\\\\\
2637in two different ways:\\\\\\\\\\\\\\\
2638\\\\\\\\\\\\\\\
2639 1. Writing a user autorun file (/home/autorun)\\\\\\\\\\\\\\\
2640 \\\\\\\\\\\\\\\
2641 User autorun files are good if you're not\\\\\\\\\\\\\\\
2642 too much of a professional. You can load\\\\\\\\\\\\\\\
2643 extra APIs or perform other actions.\\\\\\\\\\\\\\\
2644 More about user autorun files can be found\\\\\\\\\\\\\\\
2645 at 'man custom-autorun'.\\\\\\\\\\\\\\\
2646 \\\\\\\\\\\\\\\
2647 2. Writing a custom bootloader\\\\\\\\\\\\\\\
2648 \\\\\\\\\\\\\\\
2649 Information about custom bootloaders can\\\\\\\\\\\\\\\
2650 be found at 'man custom-bootloaders'\\\\\\\"\\\",\\\
2651 \\\"F:custom-bootloaders\\\",\\\
2652 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2653In Tesseract, bootloader records are files that\\\\\\\\\\\\\\\
2654regulate the boot order of the operating system,\\\\\\\\\\\\\\\
2655responsible for the low-level system routines.\\\\\\\\\\\\\\\
2656\\\\\\\\\\\\\\\
2657Writing a bootloader record requires a lot of\\\\\\\\\\\\\\\
2658experience in Lua programming. \\\\\\\\\\\\\\\
2659\\\\\\\\\\\\\\\
2660Tesseract's standard bootloader record is located\\\\\\\\\\\\\\\
2661in '/boot/loaders/tesseract'. It is strongly\\\\\\\\\\\\\\\
2662recommended not to touch it.\\\\\\\\\\\\\\\
2663\\\\\\\"\\\",\\\
2664 \\\"F:custom-build\\\",\\\
2665 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2666You can build your own Tesseract distribution,\\\\\\\\\\\\\\\
2667assuming that you have the system requirements:\\\\\\\\\\\\\\\
2668 - 1Ridav's Archiver must be present on your\\\\\\\\\\\\\\\
2669 system and the receiver's system\\\\\\\\\\\\\\\
2670 \\\\\\\\\\\\\\\
2671Run these commands in the shell:\\\\\\\\\\\\\\\
2672archiver zip / <name> rom <build directory>\\\\\\\\\\\\\\\
2673mv <name>.arch <build directory>\\\\\\\\\\\\\\\
2674\\\\\\\\\\\\\\\
2675To install, run this command:\\\\\\\\\\\\\\\
2676<archiver path> unzip <name>.arch /\\\\\\\\\\\\\\\
2677\\\\\\\\\\\\\\\
2678Alternatively, you can download the\\\\\\\\\\\\\\\
2679'tesseract-buildtools' package and type 'buildtool'\\\\\\\\\\\\\\\
2680in the console - it will automatically build a\\\\\\\\\\\\\\\
2681system image.\\\\\\\"\\\",\\\
2682 \\\"F:custom-script\\\",\\\
2683 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2684A Tesseract script file is actually a bunch of\\\\\\\\\\\\\\\
2685strings representing commands and executables.\\\\\\\\\\\\\\\
2686\\\\\\\\\\\\\\\
2687An example script is provided at the path\\\\\\\\\\\\\\\
2688'/system/demos/script.tsf'. Note that the\\\\\\\\\\\\\\\
2689header is VERY necessary, as without it the\\\\\\\\\\\\\\\
2690script parser will not be able to recognize\\\\\\\\\\\\\\\
2691the code.\\\\\\\\\\\\\\\
2692\\\\\\\\\\\\\\\
2693Useful commands:\\\\\\\\\\\\\\\
2694@/scomment - comment out strings\\\\\\\\\\\\\\\
2695sdelay <seconds> - delay execution for set time\\\\\\\\\\\\\\\
2696secho [text] - output text/newline to console\\\\\\\"\\\",\\\
2697 \\\"F:custom-tpm\\\",\\\
2698 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2699Before Warp 5, building your own package.dat file\\\\\\\\\\\\\\\
2700wasn't that hard, but with the new update bringing\\\\\\\\\\\\\\\
2701in dependency handling, the format has changed.\\\\\\\\\\\\\\\
2702Basically, the package.dat file is a complex table:\\\\\\\\\\\\\\\
2703{\\\\\\\\\\\\\\\
2704 package_name = { -- The root structure ID\\\\\\\\\\\\\\\
2705 apis = { -- Files put in /usr/api\\\\\\\\\\\\\\\
2706 apione = \\\\\\\\\\\\\\\"paste123\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
2707 apitwo = \\\\\\\\\\\\\\\"pastebin\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
2708 },\\\\\\\\\\\\\\\
2709 bins = { -- Files put in /usr/bin\\\\\\\\\\\\\\\
2710 binone = \\\\\\\\\\\\\\\"pasted00\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
2711 },\\\\\\\\\\\\\\\
2712 name = \\\\\\\\\\\\\\\"simplepackage\\\\\\\\\\\\\\\", -- Package ID (equal to\\\\\\\\\\\\\\\
2713 }, package_name)\\\\\\\\\\\\\\\
2714} (or ...)\\\\\\\"\\\",\\\
2715 \\\"F:demos\\\",\\\
2716 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2717Demonstration, or fake programs are used to\\\\\\\\\\\\\\\
2718demonstrate various functions of Lua, CC APIs\\\\\\\\\\\\\\\
2719and Tesseract itself. Most of the Demonstration\\\\\\\\\\\\\\\
2720programs are part of Project Hacknet.\\\\\\\\\\\\\\\
2721\\\\\\\\\\\\\\\
2722hips-latest: Counting down with timers\\\\\\\\\\\\\\\
2723nmap: Fake network filesystem;\\\\\\\\\\\\\\\
2724 App message display\\\\\\\\\\\\\\\
2725winsetup: GUI testing\\\\\\\\\\\\\\\
2726 \\\\\\\\\\\\\\\
2727nmap is a very special program because it was\\\\\\\\\\\\\\\
2728designed to be the core of Project Hacknet,\\\\\\\\\\\\\\\
2729the program that creates a fake network. It has\\\\\\\\\\\\\\\
2730its own manual page - see 'man nmap'\\\\\\\"\\\",\\\
2731 \\\"F:df\\\",\\\
2732 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2733df <size>\\\\\\\\\\\\\\\
2734\\\\\\\\\\\\\\\
2735Displays the current filesystem information.\\\\\\\\\\\\\\\
2736\\\\\\\\\\\\\\\
2737Without the size specified, the program only\\\\\\\\\\\\\\\
2738displays the filesystem type.\\\\\\\\\\\\\\\
2739\\\\\\\\\\\\\\\
2740Size can be specified in bytes (-sB) or kilobytes\\\\\\\\\\\\\\\
2741(-sKB). With the size specified, the program also\\\\\\\\\\\\\\\
2742displays the current directory's size and free\\\\\\\\\\\\\\\
2743space.\\\\\\\\\\\\\\\
2744\\\\\\\"\\\",\\\
2745 \\\"F:dmesg\\\",\\\
2746 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2747dmesg <log file name | -l/--list>\\\\\\\\\\\\\\\
2748\\\\\\\\\\\\\\\
2749Displays log files. -l/--list displays a list of\\\\\\\\\\\\\\\
2750them.\\\\\\\"\\\",\\\
2751 \\\"F:extensions\\\",\\\
2752 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2753Here is the extension list:\\\\\\\\\\\\\\\
2754\\\\\\\\\\\\\\\
2755.arch - DCC Archive ('man archiver')\\\\\\\\\\\\\\\
2756.conf - Tesseract Configuration File ('man config')\\\\\\\\\\\\\\\
2757.dat - Data file, contains unserializable data\\\\\\\\\\\\\\\
2758.tsf - Tesseract Script File ('man script')\\\\\\\\\\\\\\\
2759.usr - Tesseract User Data\\\\\\\\\\\\\\\
2760\\\\\\\"\\\",\\\
2761 \\\"F:firststeps\\\",\\\
2762 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2763Welcome to Tesseract, my first operating system\\\\\\\\\\\\\\\
2764that got publicly released.\\\\\\\\\\\\\\\
2765\\\\\\\\\\\\\\\
2766You might not be familiar with it's mechanics,\\\\\\\\\\\\\\\
2767but I assure you that this operating system is\\\\\\\\\\\\\\\
2768a result of a great collaboration effort of two\\\\\\\\\\\\\\\
2769people, me and my friend MasatoBaito.\\\\\\\\\\\\\\\
2770I hope you enjoy using the system, if you have\\\\\\\\\\\\\\\
2771any questions, use the 'manpages' command to\\\\\\\\\\\\\\\
2772display a list of topics, then type 'man <topic>'\\\\\\\\\\\\\\\
2773to read the appropriate manuals. If you didn't find\\\\\\\\\\\\\\\
2774the answer - feel free to contact me via CC Forums.\\\\\\\\\\\\\\\
2775\\\\\\\\\\\\\\\
2776Sincerely,\\\\\\\\\\\\\\\
2777minebuild02, Head Developer of Tesseract\\\\\\\"\\\",\\\
2778 \\\"F:man\\\",\\\
2779 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2780man <man page> | manpages\\\\\\\\\\\\\\\
2781\\\\\\\\\\\\\\\
2782The Manual Browser (man) is the Tesseract's help\\\\\\\\\\\\\\\
2783program. It is modeled after Debian's man,\\\\\\\\\\\\\\\
2784the documentation browser.\\\\\\\\\\\\\\\
2785\\\\\\\\\\\\\\\
2786Typing manpages in the console displays a list\\\\\\\\\\\\\\\
2787of the available manual pages.\\\\\\\\\\\\\\\
2788\\\\\\\\\\\\\\\
2789Also, you are viewing a man about man inside a man.\\\\\\\\\\\\\\\
2790\\\\\\\"\\\",\\\
2791 \\\"F:manedit\\\",\\\
2792 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2793manedit <file>\\\\\\\\\\\\\\\
2794\\\\\\\\\\\\\\\
2795manedit is an alias for the built-in editor\\\\\\\\\\\\\\\
2796program that is used for editing manual pages.\\\\\\\\\\\\\\\
2797\\\\\\\\\\\\\\\
2798It is actually the SAME program as 'edit'.\\\\\\\\\\\\\\\
2799\\\\\\\"\\\",\\\
2800 \\\"F:nmap\\\",\\\
2801 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2802nmap [digits 1,2,3,4] [DNS record]\\\\\\\\\\\\\\\
2803\\\\\\\\\\\\\\\
2804Scans the network for terminals with open ports.\\\\\\\\\\\\\\\
2805If digits 1-4 are specified, scans for the\\\\\\\\\\\\\\\
2806corresponding IP address.\\\\\\\\\\\\\\\
2807If a DNS record is specified, uses it to register\\\\\\\\\\\\\\\
2808the terminal.\\\\\\\\\\\\\\\
2809\\\\\\\\\\\\\\\
2810Be advised - it is a demonstration program.\\\\\\\\\\\\\\\
2811\\\\\\\"\\\",\\\
2812 \\\"F:script\\\",\\\
2813 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2814script <file path>\\\\\\\\\\\\\\\
2815\\\\\\\\\\\\\\\
2816Launches a Tesseract script file.\\\\\\\\\\\\\\\
2817\\\\\\\\\\\\\\\
2818See 'man custom-script' for the specification.\\\\\\\\\\\\\\\
2819Scripts respect local security, and will launch\\\\\\\\\\\\\\\
2820specified applications that may error when not\\\\\\\\\\\\\\\
2821provided with superuser privileges.\\\\\\\"\\\",\\\
2822 \\\"F:shell\\\",\\\
2823 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2824shell [program]\\\\\\\\\\\\\\\
2825\\\\\\\\\\\\\\\
2826The Tesseract shell doesn't differ from the\\\\\\\\\\\\\\\
2827built-in one much. What it offers is a color\\\\\\\\\\\\\\\
2828scheme and username display. Filesystem type\\\\\\\\\\\\\\\
2829is now displayed by the df utility ('man df').\\\\\\\\\\\\\\\
2830\\\\\\\\\\\\\\\
2831Also, a new function was added to the Shell API -\\\\\\\\\\\\\\\
2832shell.executeScript(path), which executes a script\\\\\\\\\\\\\\\
2833on the provided path ('man script')\\\\\\\"\\\",\\\
2834 \\\"F:shutdown\\\",\\\
2835 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2836shutdown [params]\\\\\\\\\\\\\\\
2837\\\\\\\\\\\\\\\
2838Executes shutdown procedure.\\\\\\\\\\\\\\\
2839\\\\\\\\\\\\\\\
2840Parameters:\\\\\\\\\\\\\\\
2841-r/--reboot: Restart instead of shutting down\\\\\\\\\\\\\\\
2842-i/--immediate: No software callbacks, halt NOW\\\\\\\\\\\\\\\
2843-d/--delete-temp: Remove temporary files\\\\\\\\\\\\\\\
2844\\\\\\\\\\\\\\\
2845By default, keeps temporary files and executes\\\\\\\\\\\\\\\
2846shutdown with software callbacks.\\\\\\\"\\\",\\\
2847 \\\"F:superuser\\\",\\\
2848 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2849 Warp 4 added Linux-like superuser capabilities.\\\\\\\\\\\\\\\
2850 \\\\\\\\\\\\\\\
2851 Superuser privileges are by default granted to\\\\\\\\\\\\\\\
2852 the 'root' user.\\\\\\\\\\\\\\\
2853 \\\\\\\\\\\\\\\
2854 Superuser privileges are REQUIRED to:\\\\\\\\\\\\\\\
2855 \\\\\\\\\\\\\\\
2856 Add/change/remove user records;\\\\\\\\\\\\\\\
2857 Install TPM packages/complex applications;\\\\\\\\\\\\\\\
2858 Edit manual pages;\\\\\\\\\\\\\\\
2859 Edit boot records;\\\\\\\\\\\\\\\
2860 Edit system files\\\\\\\"\\\",\\\
2861 \\\"F:systeminfo\\\",\\\
2862 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2863systeminfo <arguments>\\\\\\\\\\\\\\\
2864\\\\\\\\\\\\\\\
2865Displays system information.\\\\\\\\\\\\\\\
2866\\\\\\\\\\\\\\\
2867Possible arguments:\\\\\\\\\\\\\\\
2868--os-version: Displays OS version\\\\\\\\\\\\\\\
2869--shell-path: Displays shell path\\\\\\\\\\\\\\\
2870--computer-info Displays ID and label\\\\\\\\\\\\\\\
2871\\\\\\\"\\\",\\\
2872 \\\"F:tpm\\\",\\\
2873 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2874The Tesseract Package Manager is similar to\\\\\\\\\\\\\\\
2875Linux-based operating systems' package managers.\\\\\\\\\\\\\\\
2876\\\\\\\\\\\\\\\
2877The repository data is stored in the\\\\\\\\\\\\\\\
2878'/system/data/package.dat' file.\\\\\\\\\\\\\\\
2879\\\\\\\\\\\\\\\
2880Programs that compose the TPM are:\\\\\\\\\\\\\\\
2881\\\\\\\\\\\\\\\
2882tpm-install <package>: Install a package\\\\\\\\\\\\\\\
2883tpm-list <listing>: List available packages\\\\\\\\\\\\\\\
2884tpm-recache: Redownload package.dat\\\\\\\\\\\\\\\
2885tpm-remove <package>: Remove a package\\\\\\\\\\\\\\\
2886\\\\\\\\\\\\\\\
2887The tpm-list utility accepts a listing type as a\\\\\\\\\\\\\\\
2888parameter. You can list available packages\\\\\\\\\\\\\\\
2889('available') or installed ones ('installed').\\\\\\\"\\\",\\\
2890 \\\"F:usrutils\\\",\\\
2891 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2892 mkusr <username> <password>\\\\\\\\\\\\\\\
2893 Creates a new user record.\\\\\\\\\\\\\\\
2894 \\\\\\\\\\\\\\\
2895 passwd <username> <password>\\\\\\\\\\\\\\\
2896 Changes a user's password.\\\\\\\\\\\\\\\
2897 \\\\\\\\\\\\\\\
2898 rmusr <username>\\\\\\\\\\\\\\\
2899 Removes a user record.\\\\\\\\\\\\\\\
2900 \\\\\\\"\\\",\\\
2901 \\\"F:versioning\\\",\\\
2902 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2903Developer Build - regular build snapshot\\\\\\\\\\\\\\\
2904 \\\\\\\\\\\\\\\
2905 v v v\\\\\\\\\\\\\\\
2906 \\\\\\\\\\\\\\\
2907Warp 1-5 - public development preview\\\\\\\\\\\\\\\
2908\\\\\\\\\\\\\\\
2909 v v v\\\\\\\\\\\\\\\
2910 \\\\\\\\\\\\\\\
2911Warp Sierra - technical pre-release\\\\\\\\\\\\\\\
2912\\\\\\\\\\\\\\\
2913 v v v\\\\\\\\\\\\\\\
2914 \\\\\\\\\\\\\\\
2915Pre-release\\\\\\\\\\\\\\\
2916\\\\\\\\\\\\\\\
2917 v v v\\\\\\\\\\\\\\\
2918 \\\\\\\\\\\\\\\
2919Release\\\\\\\"\\\",\\\
2920 \\\"F:versions\\\",\\\
2921 \\\"\\\\\\\"\\\\\\\\\\\\\\\
2922 0019: First developer build known, basic\\\\\\\\\\\\\\\
2923 system outline\\\\\\\\\\\\\\\
2924 0020: Some additions were implemented\\\\\\\\\\\\\\\
2925 0031: Tesseract starts looking modern-day,\\\\\\\\\\\\\\\
2926 manuals implemented along with\\\\\\\\\\\\\\\
2927 complex applications\\\\\\\\\\\\\\\
2928 0034: Manuals refined, demos organized,\\\\\\\\\\\\\\\
2929 utilities added\\\\\\\\\\\\\\\
2930 0038: 2 new APIs added, df bundled along with\\\\\\\\\\\\\\\
2931 SHA1\\\\\\\\\\\\\\\
2932 0040: Multiple changes, kernel and boot\\\\\\\\\\\\\\\
2933 sequence starting to change\\\\\\\\\\\\\\\
2934 0042: Redundancy added to bootloader, custom\\\\\\\\\\\\\\\
2935 records made possible\\\\\\\\\\\\\\\
2936 0046: First technical pre-release (Warp 1)\\\\\\\"\\\",\\\
2937}\",\
2938 \"D:passwd\",\
2939 \"{\\\
2940 \\\"D:.shadow\\\",\\\
2941 \\\"{\\\\\\\
2942 \\\\\\\"F:lsh.usr\\\\\\\",\\\\\\\
2943 \\\\\\\"\\\\\\\\\\\\\\\"local userdata = {}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2944\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2945userdata.SU = true\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2946userdata.ID = security.getID()\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2947userdata.shell = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"/bin/lsh\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2948\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2949return userdata\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2950\\\\\\\\\\\\\\\"\\\\\\\",\\\\\\\
2951 \\\\\\\"F:root.usr\\\\\\\",\\\\\\\
2952 \\\\\\\"\\\\\\\\\\\\\\\"local userdata = {}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2953\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2954userdata.SU = true\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2955userdata.ID = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"0\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2956userdata.shell = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"/bin/sh\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2957\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2958return userdata\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2959\\\\\\\\\\\\\\\"\\\\\\\",\\\\\\\
2960}\\\",\\\
2961 \\\"F:lsh.dat\\\",\\\
2962 \\\"\\\\\\\"{\\\\\\\\\\\\\\\
2963 116,\\\\\\\\\\\\\\\
2964 111,\\\\\\\\\\\\\\\
2965 111,\\\\\\\\\\\\\\\
2966 114,\\\\\\\\\\\\\\\
2967}\\\\\\\"\\\",\\\
2968 \\\"F:root.dat\\\",\\\
2969 \\\"\\\\\\\"{\\\\\\\\\\\\\\\
2970 114,\\\\\\\\\\\\\\\
2971 111,\\\\\\\\\\\\\\\
2972 111,\\\\\\\\\\\\\\\
2973 116,\\\\\\\\\\\\\\\
2974}\\\\\\\"\\\",\\\
2975 \\\"F:user.dat\\\",\\\
2976 \\\"\\\\\\\"{\\\\\\\\\\\\\\\
2977 117,\\\\\\\\\\\\\\\
2978 115,\\\\\\\\\\\\\\\
2979 101,\\\\\\\\\\\\\\\
2980 114,\\\\\\\\\\\\\\\
2981}\\\\\\\"\\\",\\\
2982}\",\
2983 \"D:scripts\",\
2984 \"{\\\
2985 \\\"F:tpm-recache.tsf\\\",\\\
2986 \\\"\\\\\\\"@ @ !! TESSERACT SCRIPT HEADER\\\\\\\\\\\\\\\
2987@ This script performs recaching of TPM repo data\\\\\\\\\\\\\\\
2988error local TPM repository data corrupt\\\\\\\\\\\\\\\
2989slog_syslog reinitializing local TPM data\\\\\\\\\\\\\\\
2990tpm-repair\\\\\\\\\\\\\\\
2991\\\\\\\"\\\",\\\
2992}\",\
2993 \"D:script_util\",\
2994 \"{\\\
2995 \\\"F:@\\\",\\\
2996 \\\"\\\\\\\"-- script comment exec\\\\\\\"\\\",\\\
2997 \\\"F:error\\\",\\\
2998 \\\"\\\\\\\"local logger = fs.open(\\\\\\\\\\\\\\\"/etc/errorLog\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
2999local tArgs = {...}\\\\\\\\\\\\\\\
3000local logstr = tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
3001for k,v in ipairs(tArgs) do\\\\\\\\\\\\\\\
3002 if k==1 then\\\\\\\\\\\\\\\
3003 logstr = logstr..v\\\\\\\\\\\\\\\
3004 else\\\\\\\\\\\\\\\
3005 logstr = logstr..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v\\\\\\\\\\\\\\\
3006 end\\\\\\\\\\\\\\\
3007end\\\\\\\\\\\\\\\
3008logger.writeLine(logstr)\\\\\\\\\\\\\\\
3009logger.close()\\\\\\\"\\\",\\\
3010 \\\"F:scomment\\\",\\\
3011 \\\"\\\\\\\"-- script comment exec\\\\\\\"\\\",\\\
3012 \\\"F:sdelay\\\",\\\
3013 \\\"\\\\\\\"local tArgs = {...}\\\\\\\\\\\\\\\
3014\\\\\\\\\\\\\\\
3015if #tArgs >= 1 then\\\\\\\\\\\\\\\
3016 sleep(tonumber(tArgs[1]))\\\\\\\\\\\\\\\
3017else\\\\\\\\\\\\\\\
3018 sleep(1)\\\\\\\\\\\\\\\
3019end\\\\\\\\\\\\\\\
3020\\\\\\\"\\\",\\\
3021 \\\"F:secho\\\",\\\
3022 \\\"\\\\\\\"local tArgs = {...}\\\\\\\\\\\\\\\
3023for k,v in ipairs(tArgs) do\\\\\\\\\\\\\\\
3024 if k==1 then\\\\\\\\\\\\\\\
3025 write(tostring(v))\\\\\\\\\\\\\\\
3026 else\\\\\\\\\\\\\\\
3027 write(\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..tostring(v))\\\\\\\\\\\\\\\
3028 end\\\\\\\\\\\\\\\
3029end\\\\\\\\\\\\\\\
3030write(\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\")\\\\\\\"\\\",\\\
3031 \\\"F:slog_auth\\\",\\\
3032 \\\"\\\\\\\"if not fs.isDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\") and not fs.exists(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") and not fs.isDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
3033 fs.makeDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3034 fs.makeDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3035end\\\\\\\\\\\\\\\
3036local logger = fs.open(\\\\\\\\\\\\\\\"/var/log/auth\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3037local tArgs = {...}\\\\\\\\\\\\\\\
3038local logstr = tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
3039for k,v in ipairs(tArgs) do\\\\\\\\\\\\\\\
3040 if k==1 then\\\\\\\\\\\\\\\
3041 logstr = logstr..v\\\\\\\\\\\\\\\
3042 else\\\\\\\\\\\\\\\
3043 logstr = logstr..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v\\\\\\\\\\\\\\\
3044 end\\\\\\\\\\\\\\\
3045end\\\\\\\\\\\\\\\
3046logger.writeLine(logstr)\\\\\\\\\\\\\\\
3047logger.close()\\\\\\\"\\\",\\\
3048 \\\"F:slog_boot\\\",\\\
3049 \\\"\\\\\\\"if not fs.isDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\") and not fs.exists(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") and not fs.isDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
3050 fs.makeDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3051 fs.makeDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3052end\\\\\\\\\\\\\\\
3053local logger = fs.open(\\\\\\\\\\\\\\\"/var/log/boot\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3054local tArgs = {...}\\\\\\\\\\\\\\\
3055local logstr = tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
3056for k,v in ipairs(tArgs) do\\\\\\\\\\\\\\\
3057 if k==1 then\\\\\\\\\\\\\\\
3058 logstr = logstr..v\\\\\\\\\\\\\\\
3059 else\\\\\\\\\\\\\\\
3060 logstr = logstr..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v\\\\\\\\\\\\\\\
3061 end\\\\\\\\\\\\\\\
3062end\\\\\\\\\\\\\\\
3063logger.writeLine(logstr)\\\\\\\\\\\\\\\
3064logger.close()\\\\\\\"\\\",\\\
3065 \\\"F:slog_message\\\",\\\
3066 \\\"\\\\\\\"if not fs.isDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\") and not fs.exists(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") and not fs.isDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
3067 fs.makeDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3068 fs.makeDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3069end\\\\\\\\\\\\\\\
3070local logger = fs.open(\\\\\\\\\\\\\\\"/var/log/messages\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3071local tArgs = {...}\\\\\\\\\\\\\\\
3072local logstr = tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
3073for k,v in ipairs(tArgs) do\\\\\\\\\\\\\\\
3074 if k==1 then\\\\\\\\\\\\\\\
3075 logstr = logstr..v\\\\\\\\\\\\\\\
3076 else\\\\\\\\\\\\\\\
3077 logstr = logstr..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v\\\\\\\\\\\\\\\
3078 end\\\\\\\\\\\\\\\
3079end\\\\\\\\\\\\\\\
3080logger.writeLine(logstr)\\\\\\\\\\\\\\\
3081logger.close()\\\\\\\"\\\",\\\
3082 \\\"F:slog_security\\\",\\\
3083 \\\"\\\\\\\"if not fs.isDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\") and not fs.exists(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") and not fs.isDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
3084 fs.makeDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3085 fs.makeDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3086end\\\\\\\\\\\\\\\
3087local logger = fs.open(\\\\\\\\\\\\\\\"/var/log/security\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3088local tArgs = {...}\\\\\\\\\\\\\\\
3089local logstr = tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
3090for k,v in ipairs(tArgs) do\\\\\\\\\\\\\\\
3091 if k==1 then\\\\\\\\\\\\\\\
3092 logstr = logstr..v\\\\\\\\\\\\\\\
3093 else\\\\\\\\\\\\\\\
3094 logstr = logstr..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v\\\\\\\\\\\\\\\
3095 end\\\\\\\\\\\\\\\
3096end\\\\\\\\\\\\\\\
3097logger.writeLine(logstr)\\\\\\\\\\\\\\\
3098logger.close()\\\\\\\"\\\",\\\
3099 \\\"F:slog_shutdown\\\",\\\
3100 \\\"\\\\\\\"if not fs.isDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\") and not fs.exists(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") and not fs.isDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
3101 fs.makeDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3102 fs.makeDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3103end\\\\\\\\\\\\\\\
3104local logger = fs.open(\\\\\\\\\\\\\\\"/var/log/shutdown\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3105local tArgs = {...}\\\\\\\\\\\\\\\
3106local logstr = tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
3107for k,v in ipairs(tArgs) do\\\\\\\\\\\\\\\
3108 if k==1 then\\\\\\\\\\\\\\\
3109 logstr = logstr..v\\\\\\\\\\\\\\\
3110 else\\\\\\\\\\\\\\\
3111 logstr = logstr..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v\\\\\\\\\\\\\\\
3112 end\\\\\\\\\\\\\\\
3113end\\\\\\\\\\\\\\\
3114logger.writeLine(logstr)\\\\\\\\\\\\\\\
3115logger.close()\\\\\\\"\\\",\\\
3116 \\\"F:slog_syslog\\\",\\\
3117 \\\"\\\\\\\"if not fs.isDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\") and not fs.exists(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") and not fs.isDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
3118 fs.makeDir(\\\\\\\\\\\\\\\"/var\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3119 fs.makeDir(\\\\\\\\\\\\\\\"/var/log\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3120end\\\\\\\\\\\\\\\
3121local logger = fs.open(\\\\\\\\\\\\\\\"/var/log/syslog\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"a\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3122local tArgs = {...}\\\\\\\\\\\\\\\
3123local logstr = tostring(os.day())..\\\\\\\\\\\\\\\"d:\\\\\\\\\\\\\\\"..textutils.formatTime(os.time(), true)..\\\\\\\\\\\\\\\" | \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\
3124for k,v in ipairs(tArgs) do\\\\\\\\\\\\\\\
3125 if k==1 then\\\\\\\\\\\\\\\
3126 logstr = logstr..v\\\\\\\\\\\\\\\
3127 else\\\\\\\\\\\\\\\
3128 logstr = logstr..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v\\\\\\\\\\\\\\\
3129 end\\\\\\\\\\\\\\\
3130end\\\\\\\\\\\\\\\
3131logger.writeLine(logstr)\\\\\\\\\\\\\\\
3132logger.close()\\\\\\\"\\\",\\\
3133}\",\
3134 \"F:system\",\
3135 \"\\\"enableComplexApps = true\\\\\\\
3136enablePackageManagement = true\\\\\\\
3137enableHTTPAccess = true\\\"\",\
3138 \"D:tpm\",\
3139 \"{\\\
3140 \\\"F:package.dat\\\",\\\
3141 \\\"\\\\\\\"{\\\\\\\\\\\\\\\
3142 [\\\\\\\\\\\\\\\"tesseract-buildtools\\\\\\\\\\\\\\\"] = {\\\\\\\\\\\\\\\
3143 name = \\\\\\\\\\\\\\\"tesseract-buildtools\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3144 bins = {\\\\\\\\\\\\\\\
3145 buildtool = \\\\\\\\\\\\\\\"7c4UbxNw\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3146 },\\\\\\\\\\\\\\\
3147 apis = {},\\\\\\\\\\\\\\\
3148 },\\\\\\\\\\\\\\\
3149 sketch = {\\\\\\\\\\\\\\\
3150 name = \\\\\\\\\\\\\\\"sketch\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3151 bins = {\\\\\\\\\\\\\\\
3152 sketch = \\\\\\\\\\\\\\\"Mm5hd97E\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3153 },\\\\\\\\\\\\\\\
3154 apis = {},\\\\\\\\\\\\\\\
3155 },\\\\\\\\\\\\\\\
3156 nsh = {\\\\\\\\\\\\\\\
3157 bins = {\\\\\\\\\\\\\\\
3158 nshput = \\\\\\\\\\\\\\\"zeS6uFY7\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3159 nshget = \\\\\\\\\\\\\\\"KJ9Tu2Y9\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3160 nsh = \\\\\\\\\\\\\\\"X5Fysdi4\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3161 vncd = \\\\\\\\\\\\\\\"MC4RFZEK\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3162 },\\\\\\\\\\\\\\\
3163 apis = {\\\\\\\\\\\\\\\
3164 framebuffer = \\\\\\\\\\\\\\\"Aaza6h5v\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3165 },\\\\\\\\\\\\\\\
3166 name = \\\\\\\\\\\\\\\"nsh\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\
3167 },\\\\\\\\\\\\\\\
3168}\\\\\\\"\\\",\\\
3169 \\\"F:packageInstalled.dat\\\",\\\
3170 \\\"\\\\\\\"{}\\\\\\\"\\\",\\\
3171}\",\
3172}",
3173 "D:home",
3174 "{\
3175 \"D:lsh\",\
3176 \"{}\",\
3177 \"D:root\",\
3178 \"{}\",\
3179 \"D:user\",\
3180 \"{}\",\
3181}",
3182 "D:sbin",
3183 "{\
3184 \"F:asm-reload\",\
3185 \"\\\"local tArgs = {...}\\\\\\\
3186local err = true\\\\\\\
3187local sil = false\\\\\\\
3188local function findArg(arg)\\\\\\\
3189 for _,v in ipairs(tArgs) do\\\\\\\
3190 if v == arg then\\\\\\\
3191 return true\\\\\\\
3192 end\\\\\\\
3193 end\\\\\\\
3194 return false\\\\\\\
3195end\\\\\\\
3196\\\\\\\
3197if findArg(\\\\\\\"-s\\\\\\\") or findArg(\\\\\\\"--silent\\\\\\\") then\\\\\\\
3198 sil = true\\\\\\\
3199end\\\\\\\
3200if findArg(\\\\\\\"-c:SYSTEM_CACHE\\\\\\\") or findArg(\\\\\\\"--cache:SYSTEM_CACHE\\\\\\\") then\\\\\\\
3201 err = false\\\\\\\
3202 if not sil then\\\\\\\
3203 gui.printBootInfo(\\\\\\\"Reloading system assembly cache\\\\\\\")\\\\\\\
3204 gui.printBootWarning(\\\\\\\"Enumerating system assemblies...\\\\\\\")\\\\\\\
3205 else\\\\\\\
3206 kernel.writeSyslog(\\\\\\\"Reloading system assembly cache\\\\\\\")\\\\\\\
3207 kernel.writeSyslog(\\\\\\\"Enumerating system assemblies...\\\\\\\")\\\\\\\
3208 end\\\\\\\
3209 kernel.loadSystemAssemblies(sil)\\\\\\\
3210end\\\\\\\
3211if findArg(\\\\\\\"-c:USER_CACHE\\\\\\\") or findArg(\\\\\\\"--cache:USER_CACHE\\\\\\\") then\\\\\\\
3212 err = false\\\\\\\
3213 if not sil then\\\\\\\
3214 gui.printBootInfo(\\\\\\\"Reloading user assembly cache\\\\\\\")\\\\\\\
3215 gui.printBootWarning(\\\\\\\"Enumerating user assemblies...\\\\\\\")\\\\\\\
3216 else\\\\\\\
3217 kernel.writeSyslog(\\\\\\\"Reloading user assembly cache\\\\\\\")\\\\\\\
3218 kernel.writeSyslog(\\\\\\\"Enumerating user assemblies...\\\\\\\")\\\\\\\
3219 end\\\\\\\
3220 kernel.loadUserAssemblies(sil)\\\\\\\
3221end\\\\\\\
3222if #tArgs < 1 then\\\\\\\
3223 gui.printAppInfo(\\\\\\\"kernel\\\\\\\", \\\\\\\"arguments not specified\\\\\\\")\\\\\\\
3224 return\\\\\\\
3225elseif err then\\\\\\\
3226 gui.printAppInfo(\\\\\\\"kernel\\\\\\\", \\\\\\\"specify cache to reload\\\\\\\")\\\\\\\
3227 return\\\\\\\
3228end\\\"\",\
3229 \"F:dmesg\",\
3230 \"\\\"local tArgs = {...}\\\\\\\
3231local logs = {}\\\\\\\
3232local err = true\\\\\\\
3233local function findArg(arg)\\\\\\\
3234 for _,v in ipairs(tArgs) do\\\\\\\
3235 if v == arg then\\\\\\\
3236 return true\\\\\\\
3237 end\\\\\\\
3238 end\\\\\\\
3239 return false\\\\\\\
3240end\\\\\\\
3241\\\\\\\
3242if fs.isDir(\\\\\\\"/var/log\\\\\\\") then\\\\\\\
3243 logs = fs.list(\\\\\\\"/var/log\\\\\\\")\\\\\\\
3244else\\\\\\\
3245 gui.printAppWarning(\\\\\\\"log\\\\\\\", \\\\\\\"log files non-existent\\\\\\\")\\\\\\\
3246 return\\\\\\\
3247end\\\\\\\
3248\\\\\\\
3249if findArg(\\\\\\\"-l\\\\\\\") or findArg(\\\\\\\"--list\\\\\\\") then\\\\\\\
3250 shell.run(\\\\\\\"/rom/programs/list /var/log\\\\\\\")\\\\\\\
3251 err = false\\\\\\\
3252end\\\\\\\
3253\\\\\\\
3254for _,v in ipairs(logs) do\\\\\\\
3255 if findArg(v) then\\\\\\\
3256 local logfile = kernel.printFile(\\\\\\\"/var/log/\\\\\\\"..v)\\\\\\\
3257 textutils.pagedPrint(logfile)\\\\\\\
3258 err = false\\\\\\\
3259 end\\\\\\\
3260end\\\\\\\
3261\\\\\\\
3262if #tArgs < 1 or err then\\\\\\\
3263 gui.printAppInfo(\\\\\\\"log\\\\\\\", \\\\\\\"arguments not specified\\\\\\\")\\\\\\\
3264end\\\\\\\
3265\\\"\",\
3266 \"F:errpt\",\
3267 \"\\\"local err = true\\\\\\\
3268\\\\\\\
3269if fs.isDir(\\\\\\\"/etc\\\\\\\") then\\\\\\\
3270 logs = fs.list(\\\\\\\"/etc\\\\\\\")\\\\\\\
3271else\\\\\\\
3272 gui.printAppWarning(\\\\\\\"kernel\\\\\\\", \\\\\\\"/etc directory is non-existent\\\\\\\")\\\\\\\
3273 return\\\\\\\
3274end\\\\\\\
3275\\\\\\\
3276local logfile = kernel.printFile(\\\\\\\"/etc/errorLog\\\\\\\")\\\\\\\
3277textutils.pagedPrint(logfile)\\\\\\\
3278\\\"\",\
3279 \"F:reboot\",\
3280 \"\\\"shell.run(\\\\\\\"shutdown -r\\\\\\\")\\\"\",\
3281 \"F:shutdown\",\
3282 \"\\\"local tArgs = {...}\\\\\\\
3283local err = true\\\\\\\
3284local reboot = false\\\\\\\
3285local immediate = false\\\\\\\
3286local var = true\\\\\\\
3287local function findArg(arg)\\\\\\\
3288 for _,v in ipairs(tArgs) do\\\\\\\
3289 if v == arg then\\\\\\\
3290 return true\\\\\\\
3291 end\\\\\\\
3292 end\\\\\\\
3293 return false\\\\\\\
3294end\\\\\\\
3295\\\\\\\
3296if findArg(\\\\\\\"-r\\\\\\\") or findArg(\\\\\\\"--reboot\\\\\\\") then\\\\\\\
3297 err = false\\\\\\\
3298 reboot = true\\\\\\\
3299 gui.printAppInfo(\\\\\\\"kernel\\\\\\\", \\\\\\\"expect system reboot\\\\\\\")\\\\\\\
3300end\\\\\\\
3301if findArg(\\\\\\\"-i\\\\\\\") or findArg(\\\\\\\"--immediate\\\\\\\") then\\\\\\\
3302 err = false\\\\\\\
3303 immediate = true\\\\\\\
3304 gui.printAppWarning(\\\\\\\"kernel\\\\\\\", \\\\\\\"immediate halt called\\\\\\\")\\\\\\\
3305end\\\\\\\
3306if findArg(\\\\\\\"-d\\\\\\\") or findArg(\\\\\\\"--delete-temp\\\\\\\") then\\\\\\\
3307 err = false\\\\\\\
3308 if not immediate then\\\\\\\
3309 var = false\\\\\\\
3310 gui.printAppInfo(\\\\\\\"kernel\\\\\\\", \\\\\\\"removing temporary directories\\\\\\\")\\\\\\\
3311 else\\\\\\\
3312 gui.printAppInfo(\\\\\\\"kernel\\\\\\\", \\\\\\\"unable to remove temporary directories\\\\\\\")\\\\\\\
3313 end\\\\\\\
3314end\\\\\\\
3315if #tArgs < 1 or err then\\\\\\\
3316 gui.printAppInfo(\\\\\\\"kernel\\\\\\\", \\\\\\\"arguments not specified\\\\\\\")\\\\\\\
3317 return\\\\\\\
3318end\\\\\\\
3319sleep(1)\\\\\\\
3320if reboot then\\\\\\\
3321 if immediate then\\\\\\\
3322 os.reboot()\\\\\\\
3323 else\\\\\\\
3324 if var then\\\\\\\
3325 kernel.reboot(false)\\\\\\\
3326 else\\\\\\\
3327 kernel.reboot(true)\\\\\\\
3328 end\\\\\\\
3329 end\\\\\\\
3330else\\\\\\\
3331 if immediate then\\\\\\\
3332 os.shutdown()\\\\\\\
3333 else\\\\\\\
3334 if var then\\\\\\\
3335 kernel.shutdown(false)\\\\\\\
3336 else\\\\\\\
3337 kernel.shutdown(true)\\\\\\\
3338 end\\\\\\\
3339 end\\\\\\\
3340end\\\"\",\
3341}",
3342 "F:startup",
3343 "\"--rawset(_G, \\\"nativepullevent\\\", os.pullEvent)\\\
3344os.pullEvent = os.pullEventRaw\\\
3345\\\
3346local temp_kernel = [[\\\
3347-- Local functions\\\
3348local function initLogger(file)\\\
3349 if not fs.isDir(\\\"/var\\\") and not fs.exists(\\\"/var/log\\\") and not fs.isDir(\\\"/var/log\\\") then\\\
3350 fs.makeDir(\\\"/var\\\")\\\
3351 fs.makeDir(\\\"/var/log\\\")\\\
3352 end\\\
3353 return \\\"/var/log/\\\"..file\\\
3354end\\\
3355\\\
3356-- Low-level routines\\\
3357\\\
3358-- Clear the screen\\\
3359function clear()\\\
3360 term.clear()\\\
3361 term.setCursorPos(1,1)\\\
3362end\\\
3363\\\
3364-- Halt the system completely, yield all coroutines\\\
3365function halt()\\\
3366 while true do\\\
3367 coroutine.create(function() while true do coroutine.yield() end end)\\\
3368 coroutine.yield()\\\
3369 end\\\
3370end\\\
3371\\\
3372-- Shut the system down safely.\\\
3373function shutdown(varDelete)\\\
3374 if varDelete then\\\
3375 sleep(0.5)\\\
3376 gui.printBootInfo(\\\"Removing temporary files\\\")\\\
3377 if fs.exists(\\\"/var\\\") and fs.isDir(\\\"/var\\\") then\\\
3378 fs.delete(\\\"/var\\\")\\\
3379 end\\\
3380 end\\\
3381 gui.printBootSuccess(\\\"System is ready for shutdown\\\")\\\
3382 log.writeShutdown(\\\"Shutting down system\\\")\\\
3383 sleep(1.5)\\\
3384 os.shutdown()\\\
3385 halt()\\\
3386end\\\
3387\\\
3388function reboot(varDelete)\\\
3389 if varDelete then\\\
3390 sleep(0.5)\\\
3391 gui.printBootInfo(\\\"Removing temporary files\\\")\\\
3392 if fs.exists(\\\"/var\\\") and fs.isDir(\\\"/var\\\") then\\\
3393 fs.delete(\\\"/var\\\")\\\
3394 end\\\
3395 end\\\
3396 gui.printBootSuccess(\\\"System is rebooting!\\\")\\\
3397 log.writeShutdown(\\\"Rebooting system\\\")\\\
3398 sleep(1.5)\\\
3399 os.reboot()\\\
3400 halt()\\\
3401end\\\
3402\\\
3403-- Crash the system\\\
3404function crashReport(text)\\\
3405 local logger = fs.open(\\\"/etc/errorLog\\\", \\\"a\\\")\\\
3406 logger.writeLine(tostring(os.day())..\\\"d:\\\"..textutils.formatTime(os.time(), true)..\\\" | CRITICAL! \\\"..text)\\\
3407 logger.close()\\\
3408 printError(\\\"[ ! ] HALTING EXECUTION!\\\")\\\
3409 halt()\\\
3410end\\\
3411\\\
3412-- Import a file\\\
3413function import(file)\\\
3414 if fs.exists(file) and not fs.isDir(file) then\\\
3415 return os.loadAPI(file)\\\
3416 else\\\
3417 log.write(\\\"Failed to load \\\"..file..\\\" as an API\\\")\\\
3418 return false\\\
3419 end\\\
3420end\\\
3421\\\
3422-- Require a file as a Lua module\\\
3423function require(file) -- A primitive require\\\
3424 if fs.exists(file) and not fs.isDir(file) then\\\
3425 return dofile(file)\\\
3426 else\\\
3427 log.write(\\\"Failed to load \\\"..file..\\\" as an module\\\")\\\
3428 return nil\\\
3429 end\\\
3430end\\\
3431\\\
3432-- API hook\\\
3433function APIHook(t)\\\
3434 if t then\\\
3435 return true\\\
3436 else\\\
3437 -- Not loaded\\\
3438 if import(\\\"/system/api/\\\"..t) then\\\
3439 return true\\\
3440 end\\\
3441 end\\\
3442 return false\\\
3443end\\\
3444\\\
3445-- High-level routines\\\
3446-- Initiate logging\\\
3447\\\
3448\\\
3449function writeSyslog(text)\\\
3450 local logger = fs.open(initLogger(\\\"syslog\\\"), \\\"a\\\")\\\
3451 logger.writeLine(tostring(os.day())..\\\"d:\\\"..textutils.formatTime(os.time(), true)..\\\" | \\\"..text)\\\
3452 logger.close()\\\
3453end\\\
3454\\\
3455function writeMessage(text)\\\
3456 local logger = fs.open(initLogger(\\\"messages\\\"), \\\"a\\\")\\\
3457 logger.writeLine(tostring(os.day())..\\\"d:\\\"..textutils.formatTime(os.time(), true)..\\\" | \\\"..text)\\\
3458 logger.close()\\\
3459end\\\
3460\\\
3461function writeSecurity(text)\\\
3462 local logger = fs.open(initLogger(\\\"security\\\"), \\\"a\\\")\\\
3463 logger.writeLine(tostring(os.day())..\\\"d:\\\"..textutils.formatTime(os.time(), true)..\\\" | \\\"..text)\\\
3464 logger.close()\\\
3465end\\\
3466\\\
3467function writeShutdown(text)\\\
3468 local logger = fs.open(initLogger(\\\"shutdown\\\"), \\\"a\\\")\\\
3469 logger.writeLine(tostring(os.day())..\\\"d:\\\"..textutils.formatTime(os.time(), true)..\\\" | \\\"..text)\\\
3470 logger.close()\\\
3471end\\\
3472\\\
3473function writeAuth(text)\\\
3474 local logger = fs.open(initLogger(\\\"auth\\\"), \\\"a\\\")\\\
3475 logger.writeLine(tostring(os.day())..\\\"d:\\\"..textutils.formatTime(os.time(), true)..\\\" | \\\"..text)\\\
3476 logger.close()\\\
3477end\\\
3478\\\
3479function writeBootLog(text)\\\
3480 local logger = fs.open(initLogger(\\\"boot\\\"), \\\"a\\\")\\\
3481 logger.writeLine(tostring(os.day())..\\\"d:\\\"..textutils.formatTime(os.time(), true)..\\\" | \\\"..text)\\\
3482 logger.close()\\\
3483end\\\
3484\\\
3485-- Load system libraries\\\
3486function loadSystemAssemblies(sil)\\\
3487 local flist = fs.list(\\\"/etc/lib\\\")\\\
3488 for _, file in ipairs(flist) do\\\
3489 sleep(0.25)\\\
3490 kernel.import(\\\"/etc/lib/\\\"..file) -- attempting to hook the file\\\
3491 if not sil then\\\
3492 gui.printBootSuccess(\\\"Assembly \\\"..file..\\\" hooked into RAM!\\\")\\\
3493 else\\\
3494 writeBootLog(\\\"Assembly \\\"..file..\\\" hooked into RAM!\\\")\\\
3495 end\\\
3496 end\\\
3497end\\\
3498-- Load user libraries\\\
3499function loadUserAssemblies(sil)\\\
3500 local flist = fs.list(\\\"/usr/local/lib\\\")\\\
3501 for _, file in ipairs(flist) do\\\
3502 sleep(0.25)\\\
3503 kernel.import(\\\"/usr/local/lib/\\\"..file) -- attempting to hook the file\\\
3504 if not sil then\\\
3505 gui.printBootSuccess(\\\"Assembly \\\"..file..\\\" hooked into RAM!\\\")\\\
3506 else\\\
3507 writeBootLog(\\\"Assembly \\\"..file..\\\" hooked into RAM!\\\")\\\
3508 end\\\
3509 end\\\
3510end\\\
3511\\\
3512function printFile(file)\\\
3513 if fs.exists(file) and not fs.isDir(file) then\\\
3514 local handle = fs.open(file, \\\"r\\\")\\\
3515 local contents = handle.readAll()\\\
3516 handle.close()\\\
3517 return contents\\\
3518 end\\\
3519end\\\
3520\\\
3521function getURLContents(url)\\\
3522 local handlex = http.get(url)\\\
3523 local contents = handlex.readAll()\\\
3524 handlex.close()\\\
3525 return contents\\\
3526end\\\
3527\\\
3528function getFile(file, url, overwrite)\\\
3529 if not fs.exists(file) then\\\
3530 local handle = fs.open(file, \\\"w\\\")\\\
3531 handle.writeLine(getURLContents(url))\\\
3532 handle.close()\\\
3533 return true\\\
3534 elseif overwrite and not fs.isDir(file) then\\\
3535 local handle = fs.open(file, \\\"w\\\")\\\
3536 handle.writeLine(getURLContents(url))\\\
3537 handle.close()\\\
3538 return true\\\
3539 end\\\
3540 return false\\\
3541end\\\
3542\\\
3543function secureInput(invite, definition)\\\
3544 write(invite..\\\" \\\")\\\
3545 local input = read(\\\"*\\\")\\\
3546 if input == definition then\\\
3547 return true\\\
3548 else\\\
3549 return false\\\
3550 end\\\
3551end\\\
3552\\\
3553function findManual(name)\\\
3554 local flist = fs.list(\\\"/etc/manuals\\\")\\\
3555 for _, file in ipairs(flist) do\\\
3556 if not fs.isDir(\\\"/etc/manuals/\\\"..file) and file == name then\\\
3557 local handle = fs.open(\\\"/etc/manuals/\\\"..file, \\\"r\\\")\\\
3558 local contents = handle.readAll()\\\
3559 handle.close()\\\
3560 return contents\\\
3561 end\\\
3562 end\\\
3563 return \\\"no manual available\\\"\\\
3564end\\\
3565]]\\\
3566\\\
3567local temp_gui = [[\\\
3568function clearScreen(color)\\\
3569 term.setBackgroundColor(color or colors.black)\\\
3570 kernel.clear()\\\
3571end\\\
3572\\\
3573function button(text, x1, x2, y)\\\
3574 term.setCursorPos(x1, y)\\\
3575 print(text)\\\
3576 local a, b, xx, yy = os.pullEvent(\\\"mouse_click\\\")\\\
3577 if (xx >= x1 and xx <= x2 and yy == y) then\\\
3578 return true\\\
3579 else\\\
3580 return false\\\
3581 end\\\
3582end\\\
3583\\\
3584function counter(text, y)\\\
3585 for i=1,100 do\\\
3586 sleep(0.1)\\\
3587 term.setCursorPos(1, y)\\\
3588 print(text..\\\" [\\\"..tostring(i)..\\\"%]\\\")\\\
3589 end\\\
3590end\\\
3591\\\
3592function drawProgress(txt, y)\\\
3593 term.setCursorPos(4, 4)\\\
3594 print(txt)\\\
3595 term.setCursorPos(1, y)\\\
3596 print(\\\"[ ]\\\")\\\
3597 term.setCursorPos(2, y)\\\
3598 textutils.slowPrint(\\\"==============================]\\\", 10)\\\
3599end\\\
3600\\\
3601function drawProgressAlt(color)\\\
3602 term.setCursorPos(4, 10)\\\
3603 print(\\\"#-------------------------------------------#\\\")\\\
3604 term.setCursorPos(4, 11)\\\
3605 print(\\\"| |\\\")\\\
3606 term.setCursorPos(4, 12)\\\
3607 print(\\\"#-------------------------------------------#\\\")\\\
3608 term.setBackgroundColor(color or colors.yellow)\\\
3609 term.setCursorPos(5, 11)\\\
3610 textutils.slowWrite(\\\" \\\", 10)\\\
3611 term.setBackgroundColor(colors.black)\\\
3612end\\\
3613\\\
3614function printColoredTextLine(y, txt, bg, fg)\\\
3615 term.setCursorPos(1, y)\\\
3616 term.setBackgroundColor(bg or colors.lightGray)\\\
3617 term.write(\\\" \\\")\\\
3618 term.setCursorPos(1, y)\\\
3619 term.setTextColor(fg or colors.black)\\\
3620 print(txt)\\\
3621 term.setBackgroundColor(colors.black)\\\
3622 term.setTextColor(colors.white)\\\
3623end\\\
3624\\\
3625function printBootInfo(i)\\\
3626 term.setBackgroundColor(colors.black)\\\
3627 term.setTextColor(colors.lightGray)\\\
3628 write(\\\"[ \\\")\\\
3629 term.setTextColor(colors.cyan)\\\
3630 write(\\\"* \\\")\\\
3631 term.setTextColor(colors.lightGray)\\\
3632 write(\\\"] \\\")\\\
3633 print(\\\" \\\"..i)\\\
3634 term.setTextColor(colors.white)\\\
3635 if log then\\\
3636 log.writeBootLog(i)\\\
3637 end\\\
3638end\\\
3639\\\
3640function printBootWarning(w)\\\
3641 term.setBackgroundColor(colors.black)\\\
3642 term.setTextColor(colors.lightGray)\\\
3643 write(\\\"[ \\\")\\\
3644 term.setTextColor(colors.orange)\\\
3645 write(\\\"! \\\")\\\
3646 term.setTextColor(colors.lightGray)\\\
3647 write(\\\"] \\\")\\\
3648 print(\\\" \\\"..w)\\\
3649 term.setTextColor(colors.white)\\\
3650 if log then\\\
3651 log.writeBootLog(w)\\\
3652 end\\\
3653end\\\
3654\\\
3655function printBootSuccess(wa)\\\
3656 term.setBackgroundColor(colors.black)\\\
3657 term.setTextColor(colors.lightGray)\\\
3658 write(\\\"[ \\\")\\\
3659 term.setTextColor(colors.lime)\\\
3660 write(\\\"v \\\")\\\
3661 term.setTextColor(colors.lightGray)\\\
3662 write(\\\"] \\\")\\\
3663 print(\\\" \\\"..wa)\\\
3664 term.setTextColor(colors.white)\\\
3665 if log then\\\
3666 log.writeBootLog(wa)\\\
3667 end\\\
3668end\\\
3669\\\
3670function printAppInfo(header, msg)\\\
3671 term.setTextColor(colors.cyan)\\\
3672 write(header..\\\": \\\")\\\
3673 term.setTextColor(colors.lightGray)\\\
3674 print(msg)\\\
3675 term.setTextColor(colors.white)\\\
3676end\\\
3677\\\
3678function printAppWarning(header, msg)\\\
3679 term.setTextColor(colors.red)\\\
3680 write(header..\\\": \\\")\\\
3681 term.setTextColor(colors.orange)\\\
3682 print(msg)\\\
3683 term.setTextColor(colors.white)\\\
3684end\\\
3685\\\
3686function printAppSuccess(header, msg)\\\
3687 term.setTextColor(colors.lime)\\\
3688 write(header..\\\": \\\")\\\
3689 term.setTextColor(colors.green)\\\
3690 print(msg)\\\
3691 term.setTextColor(colors.white)\\\
3692end\\\
3693\\\
3694function request(req)\\\
3695 while true do\\\
3696 term.setTextColor(colors.cyan)\\\
3697 write(req .. \\\"? \\\")\\\
3698 term.setTextColor(colors.lightGray)\\\
3699 write(\\\"(\\\")\\\
3700 term.setTextColor(colors.lime)\\\
3701 write(\\\"Y\\\")\\\
3702 term.setTextColor(colors.lightGray)\\\
3703 write(\\\"/\\\")\\\
3704 term.setTextColor(colors.red)\\\
3705 write(\\\"N\\\")\\\
3706 term.setTextColor(colors.lightGray)\\\
3707 write(\\\") \\\")\\\
3708 local presel=read()\\\
3709 if presel==\\\"Y\\\" or presel==\\\"y\\\" then\\\
3710 return true\\\
3711 elseif presel==\\\"N\\\" or presel==\\\"n\\\" then\\\
3712 return false\\\
3713 end\\\
3714 end\\\
3715end\\\
3716\\\
3717function drawImg(path, x, y)\\\
3718 if fs.exists(path) and not fs.isDir(path) then\\\
3719 local img = paintutils.loadImage(path)\\\
3720 paintutils.drawImage(img, x, y)\\\
3721 else\\\
3722 gui.printAppWarning(\\\"gui\\\", \\\"image not found\\\")\\\
3723 end\\\
3724end\\\
3725\\\
3726function printColored(text, color)\\\
3727 local tmp = term.getTextColor()\\\
3728 term.setTextColor(color)\\\
3729 print(text)\\\
3730 term.setTextColor(tmp)\\\
3731end\\\
3732]]\\\
3733\\\
3734if not fs.isDir(\\\"/var\\\") and not fs.exists(\\\"/var/boot\\\") and not fs.isDir(\\\"/var/boot\\\") then\\\
3735 fs.makeDir(\\\"/var\\\")\\\
3736 fs.makeDir(\\\"/var/boot\\\")\\\
3737end\\\
3738\\\
3739local h_kernel = fs.open(\\\"/var/boot/kernel\\\", \\\"a\\\")\\\
3740local h_gui = fs.open(\\\"/var/boot/gui\\\", \\\"a\\\")\\\
3741h_kernel.writeLine(temp_kernel)\\\
3742h_kernel.close()\\\
3743h_gui.writeLine(temp_gui)\\\
3744h_gui.close()\\\
3745\\\
3746os.loadAPI(\\\"/var/boot/kernel\\\")\\\
3747os.loadAPI(\\\"/var/boot/gui\\\")\\\
3748\\\
3749fs.delete(\\\"/var/boot/kernel\\\")\\\
3750fs.delete(\\\"/var/boot/gui\\\")\\\
3751\\\
3752term.clear()\\\
3753term.setCursorPos(1,1)\\\
3754\\\
3755if not term.isColour() then\\\
3756 printError(\\\"Tesseract is designed for advanced computers only.\\\")\\\
3757 printError(\\\"Compatibility builds will be included soon.\\\")\\\
3758 sleep(1)\\\
3759 os.shutdown()\\\
3760end\\\
3761\\\
3762gui.printBootInfo(\\\"Starting up Tesseract Boot Loader v1.34\\\")\\\
3763gui.printBootWarning(\\\"Enumerating system assemblies...\\\")\\\
3764kernel.loadSystemAssemblies(false)\\\
3765gui.printBootInfo(\\\"Boot sequence stage 1 complete\\\")\\\
3766sleep(1.5)\\\
3767\\\
3768local bootConf = config.load(\\\"/boot/boot.conf\\\")\\\
3769if fs.exists(bootConf.preferredBootloader) then\\\
3770 shell.run(bootConf.preferredBootloader)\\\
3771else\\\
3772 printError(\\\"Preferred bootloader record does not exist!\\\")\\\
3773 printError(\\\"Exiting to CraftOS.\\\")\\\
3774 printError(\\\"Please fix the /boot/boot.conf file!\\\")\\\
3775end\"",
3776 "D:usr",
3777 "{\
3778 \"D:bin\",\
3779 \"{}\",\
3780 \"D:demos\",\
3781 \"{\\\
3782 \\\"F:hips-latest\\\",\\\
3783 \\\"\\\\\\\"local tTimer = os.startTimer(0.5)\\\\\\\\\\\\\\\
3784\\\\\\\\\\\\\\\
3785for time=1,30 do\\\\\\\\\\\\\\\
3786 local myEvent = { os.pullEvent(\\\\\\\\\\\\\\\"timer\\\\\\\\\\\\\\\") }\\\\\\\\\\\\\\\
3787 if myEvent[2] == tTimer then\\\\\\\\\\\\\\\
3788 local eta = 30 - time\\\\\\\\\\\\\\\
3789 term.setCursorPos(1,18)\\\\\\\\\\\\\\\
3790 if eta < 10 then\\\\\\\\\\\\\\\
3791 printError(\\\\\\\\\\\\\\\"TRACE: 0\\\\\\\\\\\\\\\"..tostring(eta))\\\\\\\\\\\\\\\
3792 else\\\\\\\\\\\\\\\
3793 printError(\\\\\\\\\\\\\\\"TRACE: \\\\\\\\\\\\\\\"..tostring(eta))\\\\\\\\\\\\\\\
3794 end\\\\\\\\\\\\\\\
3795 sleep(0.1)\\\\\\\\\\\\\\\
3796 tTimer = os.startTimer(0.5) \\\\\\\\\\\\\\\
3797 end\\\\\\\\\\\\\\\
3798end\\\\\\\\\\\\\\\
3799term.clear()\\\\\\\\\\\\\\\
3800term.setCursorPos(4,9)\\\\\\\\\\\\\\\
3801printError(\\\\\\\\\\\\\\\">>> TRACEROUTE COMPLETE\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3802sleep(0.5)\\\\\\\\\\\\\\\
3803term.setCursorPos(4,10)\\\\\\\\\\\\\\\
3804printError(\\\\\\\\\\\\\\\">>> IP FOUND\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3805sleep(0.5)\\\\\\\\\\\\\\\
3806term.setCursorPos(4,11)\\\\\\\\\\\\\\\
3807printError(\\\\\\\\\\\\\\\">>> INITIATING ACTIVE INTRUSION PREVENTION\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3808sleep(0.5)\\\\\\\"\\\",\\\
3809 \\\"F:module\\\",\\\
3810 \\\"\\\\\\\"local test = {}\\\\\\\\\\\\\\\
3811\\\\\\\\\\\\\\\
3812test.address = tostring(_G)\\\\\\\\\\\\\\\
3813\\\\\\\\\\\\\\\
3814return test\\\\\\\"\\\",\\\
3815 \\\"F:nmap\\\",\\\
3816 \\\"\\\\\\\"--Initializing IP address generator\\\\\\\\\\\\\\\
3817\\\\\\\\\\\\\\\
3818local tArgs = {...}\\\\\\\\\\\\\\\
3819if #tArgs < 4 then\\\\\\\\\\\\\\\
3820 gui.printAppInfo(\\\\\\\\\\\\\\\"nmap\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"no IP address specified\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3821else\\\\\\\\\\\\\\\
3822 gui.printAppSuccess(\\\\\\\\\\\\\\\"nmap\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"scanning for specified IP\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3823end\\\\\\\\\\\\\\\
3824\\\\\\\\\\\\\\\
3825if #tArgs == 5 then\\\\\\\\\\\\\\\
3826 gui.printAppSuccess(\\\\\\\\\\\\\\\"nmap\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"specified DNS record\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3827end\\\\\\\\\\\\\\\
3828\\\\\\\\\\\\\\\
3829local ip, node\\\\\\\\\\\\\\\
3830\\\\\\\\\\\\\\\
3831if #tArgs < 4 then\\\\\\\\\\\\\\\
3832 local x = tostring(math.random(0, 255))\\\\\\\\\\\\\\\
3833 local y = tostring(math.random(0, 255))\\\\\\\\\\\\\\\
3834 local z = tostring(math.random(0, 255))\\\\\\\\\\\\\\\
3835 local r = tostring(math.random(0, 255))\\\\\\\\\\\\\\\
3836 ip = x..\\\\\\\\\\\\\\\".\\\\\\\\\\\\\\\"..y..\\\\\\\\\\\\\\\".\\\\\\\\\\\\\\\"..z..\\\\\\\\\\\\\\\".\\\\\\\\\\\\\\\"..r\\\\\\\\\\\\\\\
3837elseif #tArgs >= 4 then\\\\\\\\\\\\\\\
3838 ip = tArgs[1]..\\\\\\\\\\\\\\\".\\\\\\\\\\\\\\\"..tArgs[2]..\\\\\\\\\\\\\\\".\\\\\\\\\\\\\\\"..tArgs[3]..\\\\\\\\\\\\\\\".\\\\\\\\\\\\\\\"..tArgs[4]\\\\\\\\\\\\\\\
3839end\\\\\\\\\\\\\\\
3840\\\\\\\\\\\\\\\
3841if not fs.exists(\\\\\\\\\\\\\\\"/network\\\\\\\\\\\\\\\") or not fs.isDir(\\\\\\\\\\\\\\\"/network\\\\\\\\\\\\\\\") then\\\\\\\\\\\\\\\
3842 fs.makeDir(\\\\\\\\\\\\\\\"/network\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3843end\\\\\\\\\\\\\\\
3844\\\\\\\\\\\\\\\
3845--node = \\\\\\\\\\\\\\\"/network/\\\\\\\\\\\\\\\"..ip\\\\\\\\\\\\\\\
3846\\\\\\\\\\\\\\\
3847gui.printAppInfo(\\\\\\\\\\\\\\\"nmap\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"found \\\\\\\\\\\\\\\"..ip)\\\\\\\\\\\\\\\
3848\\\\\\\\\\\\\\\
3849if #tArgs == 5 then\\\\\\\\\\\\\\\
3850 gui.printAppSuccess(\\\\\\\\\\\\\\\"nmap\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"assigned DNS record \\\\\\\\\\\\\\\"..tArgs[5])\\\\\\\\\\\\\\\
3851 node = \\\\\\\\\\\\\\\"/network/\\\\\\\\\\\\\\\"..tArgs[5]\\\\\\\\\\\\\\\
3852else\\\\\\\\\\\\\\\
3853 gui.printAppWarning(\\\\\\\\\\\\\\\"nmap\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"no DNS record found, defaulting to IP\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3854 node = \\\\\\\\\\\\\\\"/network/\\\\\\\\\\\\\\\"..ip\\\\\\\\\\\\\\\
3855end\\\\\\\\\\\\\\\
3856\\\\\\\\\\\\\\\
3857if fs.exists(node) and fs.isDir(node) then\\\\\\\\\\\\\\\
3858 gui.printAppInfo(\\\\\\\\\\\\\\\"nmap\\\\\\\\\\\\\\\", ip..\\\\\\\\\\\\\\\" already known\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3859else\\\\\\\\\\\\\\\
3860 fs.makeDir(node)\\\\\\\\\\\\\\\
3861 fs.makeDir(node..\\\\\\\\\\\\\\\"/sys\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3862 fs.makeDir(node..\\\\\\\\\\\\\\\"/home\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3863 fs.makeDir(node..\\\\\\\\\\\\\\\"/bin\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3864 gui.printAppSuccess(\\\\\\\\\\\\\\\"nmap\\\\\\\\\\\\\\\", ip..\\\\\\\\\\\\\\\" added to network\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3865end\\\\\\\"\\\",\\\
3866 \\\"F:script.tsf\\\",\\\
3867 \\\"\\\\\\\"@ @ !! TESSERACT SCRIPT HEADER\\\\\\\\\\\\\\\
3868@ type out text\\\\\\\\\\\\\\\
3869secho This is an example string.\\\\\\\\\\\\\\\
3870secho The script will now redownload TPM cache.\\\\\\\\\\\\\\\
3871@ sleep\\\\\\\\\\\\\\\
3872sdelay 1\\\\\\\\\\\\\\\
3873@ recache\\\\\\\\\\\\\\\
3874tpm-recache\\\\\\\"\\\",\\\
3875 \\\"F:winsetup\\\",\\\
3876 \\\"\\\\\\\"local function annotateLoading(txt, array, delay)\\\\\\\\\\\\\\\
3877 for _, v in ipairs(array) do\\\\\\\\\\\\\\\
3878 gui.printColoredTextLine(18, txt..\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"..v)\\\\\\\\\\\\\\\
3879 sleep(delay or 1.5)\\\\\\\\\\\\\\\
3880 end\\\\\\\\\\\\\\\
3881end\\\\\\\\\\\\\\\
3882local setupLines = {}\\\\\\\\\\\\\\\
3883setupLines.stageOne = {\\\\\\\\\\\\\\\"<HDD IDE/SATA drivers>\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"<Floppy disk support>\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"<LAN network drivers>\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"<CPU controller>\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"<Windows Setup files>\\\\\\\\\\\\\\\"}\\\\\\\\\\\\\\\
3884gui.clearScreen(colors.blue)\\\\\\\\\\\\\\\
3885term.setCursorPos(1, 2)\\\\\\\\\\\\\\\
3886print(\\\\\\\\\\\\\\\"Windows Setup\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3887print(\\\\\\\\\\\\\\\"==================\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3888gui.printColoredTextLine(18, \\\\\\\\\\\\\\\"Windows Setup is checking hardware requirements...\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3889sleep(3)\\\\\\\\\\\\\\\
3890annotateLoading(\\\\\\\\\\\\\\\"Loading files\\\\\\\\\\\\\\\", setupLines.stageOne, 1.25)\\\\\\\\\\\\\\\
3891gui.clearScreen(colors.blue)\\\\\\\\\\\\\\\
3892term.setCursorPos(1, 2)\\\\\\\\\\\\\\\
3893print(\\\\\\\\\\\\\\\"Windows Setup\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3894print(\\\\\\\\\\\\\\\"==================\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3895term.setCursorPos(2, 5)\\\\\\\\\\\\\\\
3896print(\\\\\\\\\\\\\\\"Setup is formatting drive C:...\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3897term.setCursorPos(4, 7)\\\\\\\\\\\\\\\
3898print(\\\\\\\\\\\\\\\"File system: NTFS\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3899term.setCursorPos(4, 8)\\\\\\\\\\\\\\\
3900print(\\\\\\\\\\\\\\\"Free space: \\\\\\\\\\\\\\\"..fs.getFreeSpace(\\\\\\\\\\\\\\\"/\\\\\\\\\\\\\\\")..\\\\\\\\\\\\\\\" bytes\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3901gui.drawProgressAlt()\\\\\\\\\\\\\\\
3902sleep(2.5)\\\\\\\\\\\\\\\
3903gui.clearScreen(colors.blue)\\\\\\\\\\\\\\\
3904term.setCursorPos(1, 2)\\\\\\\\\\\\\\\
3905print(\\\\\\\\\\\\\\\"Windows Setup\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3906print(\\\\\\\\\\\\\\\"==================\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3907term.setCursorPos(2, 5)\\\\\\\\\\\\\\\
3908print(\\\\\\\\\\\\\\\"Setup is copying files...\\\\\\\\\\\\\\\")\\\\\\\\\\\\\\\
3909gui.drawProgressAlt()\\\\\\\\\\\\\\\
3910sleep(5)\\\\\\\\\\\\\\\
3911kernel.clear()\\\\\\\"\\\",\\\
3912}\",\
3913 \"D:local\",\
3914 \"{\\\
3915 \\\"D:bin\\\",\\\
3916 \\\"{}\\\",\\\
3917 \\\"D:lib\\\",\\\
3918 \\\"{}\\\",\\\
3919}\",\
3920}",
3921 "D:usr",
3922 [ 17 ] = "D:usr",
3923}