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

Protecting a text file or folder with Password

Started by nalexander50, 09 June 2013 - 03:12 PM
nalexander50 #1
Posted 09 June 2013 - 05:12 PM
I am trying to make a somewhat small scale security system, based on Levels of access. I want to have MY master computer store all the sensitive information like passwords. As such, I'd like to have a way to require a password to view the files, so if someone gets to my terminal they still have to know my password to view the files and folders. This is only the first application: I know I can lock the terminal itself, but that's not really what I want to do. Is there actually a way to require a password to view text files? I've been trying to figure this out for a while and have google searched all say long to no avail. Please tell me if you need more information to help and I'll gladly reply. Thanks. (Forgive possible typos, fast typing on iPad makes for mistakes sometimes.)
Lyqyd #2
Posted 10 June 2013 - 10:30 AM
Split into new topic.
JustPingo #3
Posted 10 June 2013 - 10:36 AM
Create your 1rst computer and your 2nd computer. On the first, lock the terminal by a password. On the second, you crypt your files with a cipher, and when you want to see them, you run the 1rst and it will get files by rednet from your 2nd, will decrypt the files, and send them back to the 1rst with a deleter (for the uncrypted version of the files) if you want to secure it like at first.
Lyqyd #4
Posted 10 June 2013 - 11:05 AM
Bearing in mind that you'll have to code all of the stuff the above poster suggests, it won't "just do it" like he seems to be suggesting.
Engineer #5
Posted 10 June 2013 - 07:18 PM
The thing is, if you want it to be 100% unhackable, a full rewrite of the filesystem is necessary, and a sandbox to prevent users to use the io api. Other then that you should add an check to 'cd' and 'edit' and any other program that acceses other files.
Orwell #6
Posted 10 June 2013 - 09:57 PM
The thing is, if you want it to be 100% unhackable, a full rewrite of the filesystem is necessary, and a sandbox to prevent users to use the io api. Other then that you should add an check to 'cd' and 'edit' and any other program that acceses other files.
What's the problem with pingoleon60's proposition? Private key encryption would make the file impossible to read, if even you hack the heck out of CraftOS. The only problem I can see is keylogging.
Engineer #7
Posted 11 June 2013 - 03:25 AM
There is nothinf wrong with pingeleon's solution, however, I wanted to add that it is hard to to make it possible without having two computers.

Also, you are quoting me lately a lo, may I ask why?
Orwell #8
Posted 11 June 2013 - 07:23 AM
There is nothinf wrong with pingeleon's solution, however, I wanted to add that it is hard to to make it possible without having two computers.

Also, you are quoting me lately a lo, may I ask why?
No idea, probably same time zone, so your posts are a lot at the top for me? I really didn't notice, I've been posting more often lately so maybe other people are thinking the same. :P/> No need to feel targetted, it's not like that. :)/> Anyway, it's equally secure to use encryption between the two computers (probably even more secure). And if securing files is all you want you really don't need to change anything to api methods or anything.

Let's say you want to send a file from client to server. Then you encrypt it on the client using a password as the key, next send it over rednet to the server. The server stores it encrypted. Then the client can ask to fetch it again, it will still be sent encrypted over rednet. Then the client will be prompted for the password so the file can be decrypted again.
Imque #9
Posted 11 June 2013 - 08:36 AM
The best way of doing this is just to hash any passwords stored.
Orwell #10
Posted 11 June 2013 - 10:37 AM
The best way of doing this is just to hash any passwords stored.
Password storage isn't really the topic here though. :/
TyDoesMC #11
Posted 11 June 2013 - 04:55 PM
Password = "Your Password"
print("This File Require's a Password")
write("Password: ")

pass = read()
If pass == (Password) then
print("Access Granted")
sleep(3)
term.clear()
else
print("Access Denied")
sleep(1)
os.shutdown()
end
Engineer #12
Posted 11 June 2013 - 04:57 PM
Password = "Your Password"
print("This File Require's a Password")
write("Password: ")

pass = read()
If pass == (Password) then
print("Access Granted")
sleep(3)
term.clear()
end
Where is the part he can actually edit the file?
Lyqyd #13
Posted 11 June 2013 - 04:57 PM
That doesn't do anything to actually protect the files. OP is asking for a way to protect the files, not password-protect the computer.

OP, what you seek can't be done. Anyone could walk up with a disk drive and a floppy and they'd have access to everything on the machine.
H4X0RZ #14
Posted 11 June 2013 - 05:29 PM
That doesn't do anything to actually protect the files. OP is asking for a way to protect the files, not password-protect the computer.

OP, what you seek can't be done. Anyone could walk up with a disk drive and a floppy and they'd have access to everything on the machine.
Only if you don't encrypt the files ^_^/>/>
(your normal startup decrypts the files after entering the right password.)

thanks man! I've got an idea for an API.
I only say that: password encrypted folder ^_^/>/>
Lyqyd #15
Posted 11 June 2013 - 06:06 PM
Are you serious? They'd also have access to the startup. They simply have to clone the computer, then, at most, install a key logger to grab the password, if it isn't simply in the startup file.