Tutorial/Code Protected Terminate Program

This tutorial will show you how to create a program that can be called to terminate the existing program.

Reason To Use

As you may very well know, terminating using CTRL+T is an easy way to stop startup programs and for hackers to get into the rest of the programs on the computer. One way to stop that is to use the os.pullEvent = os.pullEventRaw in your code, but this could be a problem if you need to run the program for a test, and need to do maintenance on it! Here is a simple solution to your problem.

Code

Here is the code. If you are on a single player world, you can just put this into any existing program by going to /.minecraft/saves/[worldname]/computer/[programname] and editing it with notepad or notepad++. If you are doing this on a server, and you have access to the server's files, make a program, and go to /[serverdirectory]/[worldname]/computer/[computernumber]/[programname] and copy the code over it. Else, this will need to be typed directly into the console. Now onto the code.


 local event, p1, p2, p3, p4, p5 = os.pullEventRaw( _sFilter )
 if event == "terminate" then
   print( "Terminated" )
   error()
 end
 return event, p1, p2, p3, p4, p5


That code should be put into a program named something like terminate, which I will use in my example.

Here is how you could lock the program:


 Code = "password" --Set this to whatever you want the password to be
 write("Console: ") --This is non-essential, just for looks.
 local input = read()

 if input == "terminate" then --terminate can be changed to whatever you want
   write("Password: ")
   local input2 = read("*") --In case someone is looking, disguises password with *
 
   if input2 == Code then
     shell.run("terminate") --Change this to the name of the terminate program
   else
     print("Wrong Password, Please Try Again") --Just aesthetics
     sleep(2)
     shell.run("startup") --Change this to the program this is being applied to
   end
 end


Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Need wiki hosting?

Do you need a wiki for your Minecraft mod/gaming wiki? We'll host it for free! Contact us.

Other wikis

Indie-game wikis
Powered by Indie Wikis