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

Secure Login

Started by Engineer, 18 January 2013 - 09:31 AM
Engineer #1
Posted 18 January 2013 - 10:31 AM
Hello,

I know you can always bypass the startup with a disk and such. This is based on the keys you press instead of the actual code. If the password is "password" then, if you hit anything else, the computer will reboot. This is going to be more secure very soon since I know now a lot more about lua and I am going to add some nifty things, like spitting out floppies and some other stuff. This is going to happen in Februar 2013!

Here is the code for it:
Spoiler


local allMath = 0
local reader = 0
local kNumb = {2, 3, 4} --[[all character numbers, if you got twice the same character, then put them both in! p: 25 a: 30 s: 31w: 17 o: 24 r: 19 d: 32 EXAMPLE: {25, 30, 31, 31, 17, 24, 19, 32} it is "password"]]--
local length = 3 --[[length of your password]]--

for i = 1, length do
allMath = allMath + kNumb[i]
end
term.clear()
term.setCursorPos(1, 1)
print("Password: ")
for i = 1, length do
local event, key = os.pullEvent("key")
if key == kNumb[i] then
term.setCursorPos(i + 10, 1)
print("*")
reader = reader + tonumber(key)
if reader == allMath then
sleep(0)
print("Acces granted!")
break
end
elseif key == 1 then
else
os.reboot()
end
end

Pastebin fans: http://pastebin.com/SNXhedb2

A downside is, that you have to configure it yourself. First of all, here is a picture from the wiki wich shows you all the numbers of the keys you will be pressing.



First you have to configure the "kNumb" variable. In the code it is showed how to do it. (If its not clear, please tell me so I can post another tutorial thingie xD)

Then you gave to count your length off the password, so if you used 10 letters, length will be 10.

Now name the file "startup" and enjoy my security password.

Please give me feedback on the code and/or try the program out to find any bugs. If founded a bug please post it here

:)/>
D3matt #2
Posted 19 January 2013 - 04:38 PM
If you really want to make this secure, you'd have to restructure your main loop to be an infinite loop, and auto-eject any disks put next to it. Then it really would be secure. Of course, one could always break the computer, put it next to a pre-loaded disk drive and boot it. There's no way you can prevent that unless block breaking is prevented, in which case the whole idea of preventing disk booting is pretty much pointless because you can't place a disk in the first place.

Nonetheless, I like the concept!
Skullblade #3
Posted 19 January 2013 - 04:46 PM
So that way you cant terminate it or ctrl + s
1.) I'm sorry but that is a lie…ctrl+s is hard coded into the java code and cant be prevented….
2.) As far as I can tell there is no advantage to your method because if they don't type correctly the computer shutsdown…which is the goal of ctrl+s so you are essentially making it easier