Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local time = os.time()
- term.clear()
- term.setCursorPos( 1, 1 )
- term.setTextColor( colors.yellow )
- if not fs.exists( "/.enterprise/" ) then
- print ("Initializing first-time setup...")
- fs.makeDir( "/.enterprise/" )
- t = fs.open("/.enterprise/machinelog","w")
- t.writeLine( "" )
- t.close()
- y = fs.open("/.enterprise/blockedapps","a")
- print ("Please enter the names of the programs you would like to block (or type '&' to quit)")
- function getnames()
- write ("Name: ")
- names = read()
- if names == "&" then
- print ("Setup complete!")
- y.close()
- print ("OS will reboot in 3 seconds...")
- sleep( 3 )
- os.reboot()
- else
- y.writeLine( names )
- getnames()
- end
- end
- getnames()
- end
- local formattedTime = textutils.formatTime(time, false)
- print (os.version().." Enterprise Edition")
- y = fs.open( ".enterprise/blockedapps", "r" )
- fileData = {} -- Declare a table to use to hold data.
- line = y.readLine() -- This function reads the next line in the file, until the end.
- repeat
- table.insert(fileData,line) -- Puts the value of the current line into the table we have.
- line = y.readLine() -- read the next line
- until line == nil -- readLine() returns nil when the end of the file is reached.
- y.close()
- function cli()
- term.setTextColor( colors.yellow )
- write ("> ")
- term.setTextColor( colors.white )
- command = read()
- if fileData[command] then
- h = fs.open( ".enterprise/machinelog", "a" )
- h.writeLine("["..formattedTime.."] User attempted to run '"..command.."', attempt blocked!")
- printError ("This program has been blocked by your local administrator!")
- h.close()
- cli()
- else
- shell.run( command )
- cli()
- end
- end
- cli()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement