This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Patistar's profile picture

Terminate Protection (+ admin login)

Started by Patistar, 25 July 2012 - 09:43 PM
Patistar #1
Posted 25 July 2012 - 11:43 PM
Hey guys,

I wrote a small program that I use on all of my computers. It starts a program by starting the computer and prevents it from being terminated. And if you want to edit a program you can press a key during the startup. The program will aks for an admin password. If you type it in correctly, you can use the command line and do everything you want to.

It's not a very big program, but maybe it will help someone.


os.pullEvent = os.pullEventRaw
local progname = "yourprogramsname" -- Name of the program you want to start after startup
local mypw = "yourpassword" -- Your password to get to command line
os.startTimer(1)
local sEvent, param = os.pullEvent()
if sEvent == "key" and param == 56 then
  print("Please type in your password:")
  pw = read("*")
  if pw == mypw then
	return
  else
	print("Password wrong. Continue...")
	sleep(0.5)
  end
end
shell.run( progname )

In this case you can go to the command line when pressing the "alt" key on your keyboard during startup. (You have got one second after startup to press the key. One second should be enough :)/>/> )
minizbot2012 #2
Posted 28 July 2012 - 12:50 AM
Very nice, I might use it in the near future.