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

*Question* Disable editing of programs

Started by Soulgriever, 14 April 2012 - 10:48 AM
Soulgriever #1
Posted 14 April 2012 - 12:48 PM
Hi i was wondering if it is possible to disable the editing of programs in game and have it where programs can only be inserted and edited outside of minecraft
Luanub #2
Posted 14 April 2012 - 12:53 PM
Place your programs in a folder in the /rom directory. For SMP it will be in /serverdir/mods/ComputerCraft/lua/rom. Its read only in game but you can edit and all of that good stuff with something like notepad++ or gedit from outside of the game. I prefer this method myself as the application is available to all turtles and computers as well as safe from being tampered with.
Soulgriever #3
Posted 14 April 2012 - 01:38 PM
this helps me some but im saying is there a way for disabling edit so new programs cant be created. its for smp and basicly i want to make sure someones program wont crash my server before i put it in.
Cloudy #4
Posted 14 April 2012 - 03:18 PM
Delete the "edit" command. That should be sufficient. If you have http enabled, also delete the "pastebin" command.
Wolvan #5
Posted 14 April 2012 - 03:46 PM
You have to delete it in the mods folder ;D Just saying because a friend of mine wanted to delete pastebin on his server and tried to delete it ingame :)/>/>
XxLOLdudexX #6
Posted 10 June 2012 - 03:02 PM
if you move programs to a directory only you know, it should theoretically hide the program in the programs file. Ergo, this should prevent editing via hidden files.
kazagistar #7
Posted 10 June 2012 - 05:09 PM
All of these answers seem to be incomplete. The problem is that you want to disable writing or executing of custom programs. That means you need to delete the programs "lua" and "edit", and disabling custom startup scripts from autorun.

Have you actually had problems with this in the past? Because computercraft is pretty stable, and disabling this is disabling 99% of why people use computercraft.
XxLOLdudexX #8
Posted 10 June 2012 - 07:08 PM
i deleted this post, read the one below:
XxLOLdudexX #9
Posted 10 June 2012 - 07:10 PM
if you move programs to a directory only you know, it should theoretically hide the program in the programs file. Ergo, this should prevent editing via hidden files.

Or there is another idea, but save your files to a floppy disk first;
type in; edit edit, then simply:

print ("This action has been disallowed!")
this returns the the script shown every time someone tries to edit a program. It works for me! Protected my diamond safe with this!
Cloudy #10
Posted 10 June 2012 - 07:39 PM
Until someone just types /rom/programs/edit… then your protection is gone.
Xfel #11
Posted 10 June 2012 - 07:42 PM
Well, no matter what you do, someone could still lua code like:

local startup = io.open("startup","w")
startup:write("I tricked you even though you blocked edit!")
startup:close()
So the only complete solution would be overriding parts of the fs api. Then no program can write to files anymore.
Cloudy #12
Posted 10 June 2012 - 08:01 PM
If you disable the Lua command, edit command, and pastebin command there should be no way to write to a file on the server from the terminal.
XxLOLdudexX #13
Posted 11 June 2012 - 08:00 AM
I made a login program that disables mainline commands (edit etc) unless you have and admin login. This is how it works:
Startup script:

print ("Loading...")
sleep(0.3)
print ("Initializing CraftOS 1.3...")
sleep(1)
print ("Launching Nexus Wireless Communications...")
sleep(1.2)
print ("Scanning for viruses...")
sleep(0.4)
print ("Checking system integrity...")
sleep(0.9)
print ("No viruses or faults found")
sleep(0.1)
print ("Finishing Startup...")
sleep(2)
print ("Done! Please enter Login, or use Cancel to shut down")
shell.run "Login"
"Login" program

input = io.read()
if input == "<Username>" then
shell.run "<Username>"
elseif input == "User" then
shell.run "User"
elseif input == "Cancel" then
print ("Goodbye")
sleep(1)
os.shutdown()
else
print ("This login does not exist!")
shell.run "Login"
end
"User" program

print ("No Users exist yet. Please use external boot to edit files for User")
shell.run "Login"
"<Username>" program

print ("Password Required")
t = read("*")
if t == "<password>" then
print ("Access to mainframe Granted!")
else
print ("Access Denied")
print ("Auto-reboot initiated...")
sleep(2)
os.reboot()
end
This is what i use to protect my computer. It works as well; no-one can access lua or edit until they enter the login and password. And of course, all of these have

os.pullEvent = os.pullEventRaw
at the top of them.
Problemo solved! :-)
XxLOLdudexX #14
Posted 13 June 2012 - 05:28 PM
I stunned this topic with my epicness! LOL JK. But it is pretty good at keeping prying eyes out.