To Install:
Stick the program in /rom/autorun/
Name it whatever you want. I prefer FileProtector.
The next version I will add osID protections. In which the user can make it where only certain computers can edit it without using a password.
[b]To add a password to a file:[/b] 1. Edit the file 2. Set the first line to --password 3. The next line is --YOURPASSWORD 4. The next line is another --ANOTHERPASSWORD or a non commented line.
All commented lines that are consecutive to the --password at the TOP of the file are passwords.
--password --123abc --Made by ENET
would result in two passwords. 123abc and Made by ENET
Instead you should:
--password --123abc --Made by ENET
--Made by ENET/MrJohnB & Lion4Ever
--Date Last Modified: 20130307
local nativeOpen = fs.open;
function fs.open(path,mode,input)
if(fs.exists(path))then
local handle = nativeOpen(path,"r");
if(handle.readLine()=="--password")then
if(input==nil)then --no password was given in the args so we need to get it ourselves.
term.clear();
term.setCursorPos(1,1);
term.write("This file requires a password.");
term.setCursorPos(5,2);
term.write("Password: ");
input = read("*");
end
input = "--"..input;
local text = handle.readLine();
while(text:sub(1,2)=="--")do
if(input == text)then
handle.close();
return nativeOpen(path, mode);
end
text = handle.readLine();
end
handle.close();
error("Invalid Password");
end
end
return nativeOpen(path, mode);
end
Spoiler











