Jump to content




[Lua] Highly Secure Door lock

lua computer utility

33 replies to this topic

#1 Deathknight0897

  • New Members
  • 95 posts

Posted 05 July 2012 - 05:11 AM

This is a 100% secure door lock that servers the simple function of unlocking a door this is my first total notepad++ wrote code so tell me what you think also please feel free to report anyways you find to bypass it in the console.

Warning once u reboot the only way you will be able to edit the code is if u have access to the computers save file on the server

Code
Those who know what there doing

Put it all in your start up
os.pullEvent = os.pullEventRaw
local standby = 10
local side = "top"
local password = "Example"
term.clear()
term.setCursorPos(1,1)
write("Password: ")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Well done")
rs.setOutput(side,true)
sleep(Standby)
rs.setOutput(side,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Your a failure just like trolls in this topic")
sleep(2)
os.reboot()
end

Guide
Just in case your a little unsure

this is one of the most secure pass worded doors you can create have a go and please reply in the comment section if you run into any problems with this guide.

Step 1
If your not sure how to place the console i would suggest you take a look at my other guide http://www.computerc...__fromsearch__1

"edit startup" now enter this heap of code it is commented to enjoy
os.pullEvent = os.pullEventRaw
local opentime = 10 -- Change the 10 how long the door or what ever will stay open
local side = "left" -- Change to where the door is left, right, front, back, bottom, top
local password = "Password" -- Change Password to what you want your password to be.
term.clear()
term.setCursorPos(1,1)
write("Password: ")  -- change this if u wish to have a cutom prompt
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Well done you made a lock") -- Change this if you wish to have a custom congratulations
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Password incorrect!") -- Change this if you wish to have a custom fail message
sleep(2)
os.reboot()
end

that is it your done its that simple if you want to understand more of what you just did i would suggest checking the tutorial page on the forums for information about if statements and local variables

One last little note from my testing i kept forgetting it was case sensitive make sure you remember to capitalize correctly your password or you may be the one locked out.

I am aware this is identical to the one on the wiki it is most likely the tutorials i looked at were using it as reference it is my own work as i typed it and modified to my liking however if you think there is no need having this tutorial let me know and ill remove it got bigger and better programs on the horizon anyways

Edited by Deathknight0897, 05 July 2012 - 05:06 PM.


#2 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 05 July 2012 - 03:07 PM

100% secure... until someone places a disk drive and inserts a floppy with a startup file, reboots your computer and has access to it.
Also, this is the code from the wiki tutorial, so posting it like your program is really stupid.

#3 Deathknight0897

  • New Members
  • 95 posts

Posted 05 July 2012 - 04:37 PM

Its not :c i made it on my lonesome it probably looks similar as there is only so many ways you can skin a cat XD
don't use the wiki other than for the api's only have used the forums

and yeh i know about the disc drive that is a problem

#4 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 05 July 2012 - 04:42 PM

So it's just a coincidence you used all the same variable names? I don't think so. You either copied it from the wiki, or from someone else that posted it here (and there's a lot of posts with that same code).

#5 Deathknight0897

  • New Members
  • 95 posts

Posted 05 July 2012 - 04:53 PM

Fine if it makes you happy ill change the variables would that make you happy and actually no i looked at some proper lua tutorials to learn this then converted it into a working version for computer craft man some people

#6 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 05 July 2012 - 04:57 PM

The problem is not the variable names, it's that it is the exact same code from the wiki tutorial:
local side = "left" -- Change left to whatever side your door / redstone is on, E.G: left, right, front, back, bottom, top. Be sure to leave the "s around it, though
local password = "bacon" -- Change bacon to what you want your password to be. Be sure to leave the "s around it, though
local opentime = 5 -- Change 5 to how long (in seconds) you want the redstone current to be on. Don't put "s around it, though
term.clear() -- Clears the screen
term.setCursorPos(1,1) -- Fixes the cursor position
write("Password: ") -- Prints 'Password: ' to the screen
local input = read("*") -- Makes the variable 'input' have the contents of what the user types in, the "*" part sensors out the password
if input == password then -- Checks if the user inputted the correct password
term.clear() -- Already explained up top
term.setCursorPos(1,1)
print("Password correct!") -- Prints 'Password correct!' to the screen
rs.setOutput(side,true) -- Output a redstone current to the side you specified
sleep(opentime) -- Wait the amount of seconds you specifed, then..
rs.setOutput(side,false) -- Stop outputting a redstone current
os.reboot() -- Reboot the computer, reopening the lock
else -- Checks if the user didn't input the correct password
term.clear()
term.setCursorPos(1,1)
print("Password incorrect!") -- Prints 'Password incorrect!' to the screen
sleep(2) -- Waits 2 seconds
os.reboot() -- Reboot the computer, reopening the lock
end
It's ok if you want to post a tutorial on how to set it up (although it's already explained in the wiki tutorial), but don't say it's your code.

#7 Deathknight0897

  • New Members
  • 95 posts

Posted 05 July 2012 - 05:00 PM

oh dear god i will admit its similar but honestly i didn't use that as my source of information i wont remove the topic as it still serves a function unlike this discussion i coded it myself yes the varibles are named the same yes its in the same order it wouldn't make much sense to ask for a password after ive opened the door now would it

I have made many other programs now why don't you go find a couple of programs like them im sure u will as that is the nature of the beast more than one person will have the same idea.

and may even look at a same tutorial and maybe even use the same variable magic isn't it the world wide web

#8 atticnatalex

  • New Members
  • 7 posts

Posted 14 July 2012 - 11:24 PM

nope. sleep uses os.pullEvent() , which means when it sleeps it can bypassed with CTRL + T

so:
Write this at your script's start:
local oldPullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw

and this at your scripts end:
os.pullEvent = oldPullEvent



now it's 100% unhackable. tell me if I'm wrong.

#9 Exerro

  • Members
  • 801 posts

Posted 15 July 2012 - 10:34 AM

i made a virus that could pwn that doorlock...to make it harder to hack put
oldPullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw
while true do
if fs.exists("disk") then
k = fs.open("disk/startup", "w")
k.writeLine("")
k.close()
disk.eject("back")
disk.eject("bottom")
disk.eject("top")
disk.eject("front")
disk.eject("left")
disk.eject("right")
<code>
end
end
os.pullEvent = oldPullEvent

this should erase the disk startup and eject the disk when it is put in...

#10 Deathknight0897

  • New Members
  • 95 posts

Posted 15 July 2012 - 03:11 PM

Nice Awsumben i will try that out wicked to see some addons to the code

View Postawsumben13, on 15 July 2012 - 10:34 AM, said:

i made a virus that could pwn that doorlock...to make it harder to hack put
oldPullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw
while true do
if fs.exists("disk") then
k = fs.open("disk/startup", "w")
k.writeLine("")
k.close()
disk.eject("back")
disk.eject("bottom")
disk.eject("top")
disk.eject("front")
disk.eject("left")
disk.eject("right")
<code>
end
end
os.pullEvent = oldPullEvent

this should erase the disk startup and eject the disk when it is put in...


#11 luingar

  • New Members
  • 8 posts

Posted 15 July 2012 - 09:42 PM

Works fine, til you try to get it to work when no disk exists. then it times out with "too long without yeilding"... any idea how to fix it?

Edited by luingar, 15 July 2012 - 10:54 PM.


#12 Lasere123456

  • Members
  • 30 posts

Posted 26 July 2012 - 11:06 PM

her is a little upgrade, that lets you access the consol

os.pullEvent = os.pullEventRaw
local standby = 10
local side = "top"
local password = "Example"
local consolPassword = "ExampleAdmin"
term.clear()
term.setCursorPos(1,1)
write("Password: ")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Well done")
rs.setOutput(side,true)
sleep(Standby)
rs.setOutput(side,false)
os.reboot()
elseif input == ConsolPassword
term.clear()
term.setCursorPos(1,1)
print("Consol access granted")
else
term.clear()
term.setCursorPos(1,1)
print("Your a failure just like trolls in this topic")
sleep(2)
os.reboot()
end


#13 Laserman34170

  • New Members
  • 34 posts
  • LocationProgramming Land

Posted 26 July 2012 - 11:29 PM

My system really is secure. It never reboots, so the disk startup file won't work. Also, it uses data from a server, and if you masquerade as the terminal it still won't work as the terminal id and password are hard coded.

#14 Laserman34170

  • New Members
  • 34 posts
  • LocationProgramming Land

Posted 30 July 2012 - 09:44 PM

View Postawsumben13, on 15 July 2012 - 10:34 AM, said:

i made a virus that could pwn that doorlock...to make it harder to hack put
oldPullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw
while true do
if fs.exists("disk") then
k = fs.open("disk/startup", "w")
k.writeLine("")
k.close()
disk.eject("back")
disk.eject("bottom")
disk.eject("top")
disk.eject("front")
disk.eject("left")
disk.eject("right")
<code>
end
end
os.pullEvent = oldPullEvent

this should erase the disk startup and eject the disk when it is put in...

You know, that doesn't work either, because the rom is programmed to always boot from the disk/startup if any, and then, if there is no disk/startup, boot the normal startup file on the computer.

#15 KingMachine

  • Members
  • 122 posts

Posted 01 August 2012 - 03:27 AM

100% secure until I use a quick paste program to exit out of your startup.

#16 RoD

  • Members
  • 313 posts

Posted 07 July 2013 - 01:09 PM

i created a even more secure login program. It has a rednet connection with another computer witch has the password saved. It also has the os.pullEvent = os.pullEventRaw. So even someone can use a floppy disk to enter the computer and even that they edit the code the password dont show up. Of course, like other programs this one has a weak point and its not 100% impossible to bypass.
Here is the code for the computer that has the password(place it in a safe room):
shell.run("clear")
rednet.open("right")
pass = "password"--change here password
while true do
rednet.send(3, pass, true)--3 is the computer id so you need to change it for the actual id
sleep(0.1)
end
Heres is the code for the computer that users will insert the password(Please dont use this code in a computer that you have important codes and projects witout deleting the first line of the code or installing the program above in other computer(this code is not intended to be malicious)):
os.pullEvent = os.pullEventRaw
shell.run("clear")
rednet.open("right")
write("Password:")
passinput = read()
local senderId, pass = rednet.receive()
if passinput == pass then
print("Correct!")
sleep(1)
shell.run("clear")
else
print("Wrong!")
sleep(1)
shell.run("reboot")
end
So the computer that asks for the password will receive the password from the other computer and see if it is the same. If it is it will open terminal(and then it cant make more things...This is just an example).
Simple and more secure.. Yet is not the most safe program! people can make a program that receives the password from the computer that has the password and print it in the computer that asks for the password. :D

#17 Grim Reaper

  • Members
  • 503 posts
  • LocationSeattle, WA

Posted 07 July 2013 - 01:19 PM

Just because you instruct the computer to eject a disk while it's on doesn't prevent the disk startup override hack. Ctrl + S will shutdown a computer so that you can insert a disk into the drive adjacent to the computer so you may restart the machine and have access to it. The only sure way to prevent that hack is to edit the bios or prevent disk drives from being placed next to your computer.

#18 Dave-ee Jones

  • Members
  • 456 posts
  • LocationVan Diemen's Land

Posted 07 July 2013 - 06:55 PM

I hacked that SOOOO easily :P

P.S that was the first LUA code I ever learnt as well so I know it off by heart.

#19 reububble

  • Members
  • 72 posts
  • LocationBehind you

Posted 10 July 2013 - 05:25 AM

A'right this is all mine, written just then and now in this reply box. Tested once. Is not prone to disk, in fact will duplicate across stray disks. Cannot be turned off by any means including turtles and computers next to the computer. I suggest you set path to 'startup' so that Ctrl+R will be useless.


os.pullEvent = os.pullEventRaw
path = "startup" -- insert path name here
side = "top" -- insert redstone output side here
password = "password" -- insert password here
function primary()
while true do
  term.clear() term.setCursorPos(1,1)
  term.write("Enter Password")
  term.setCursorPos(1,2)
  if password == read('*') then
   rs.setOutput(side,true)
   sleep(2) --dw about it folks
   rs.setOutput(side,false)
  end
end
end
function secondary()
while true do
  ev,p1,p2,p3 = os.pullEvent()
  if ev=="key" then
   break
  elseif ev=="disk" then
   if fs.exists("disk/startup") then
	fs.delete("disk/startup")
   end
   h=fs.open("disk/startup",'w') i=fs.open(path,'r')
   repeat
	X=h.writeLine(i.readLine)
   until X==nil
   h.close() i.close()
   peripheral.call(p1,"ejectDisk")
  elseif ev=="peripheral" then
   pType=peripheral.getType(p1)
   if pType == "computer" or pType == "turtle" then
	parallel.waitForAll(secondary,function()
	while true do
	 os.queueEvent("blah") os.pullEvent("blah") --yielding
	 if peripheral.isPresent(p1) then
	  peripheral.call(p1,"shutdown")
	 else
	  break
	 end
	end end)
   end
  end
end
end
while true do
parallel.waitForAny(primary,secondary)
end


#20 Xenthera

  • Members
  • 170 posts

Posted 10 July 2013 - 03:06 PM

View Postreububble, on 10 July 2013 - 05:25 AM, said:

A'right this is all mine, written just then and now in this reply box. Tested once. Is not prone to disk, in fact will duplicate across stray disks. Cannot be turned off by any means including turtles and computers next to the computer. I suggest you set path to 'startup' so that Ctrl+R will be useless.

Not sure what you mean by "Not prone to disk" but this is just as easily 'hackable' as any other security program on here.
Without editing certain files outside of game, NOTHING is secure on computercraft.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users