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

[Password] unbreackable, unhackable,

Started by crackroach, 17 November 2012 - 08:33 AM
crackroach #1
Posted 17 November 2012 - 09:33 AM
Here's a program i made for my server room


--PASSWORD VARIABLE function
local user, userCorrect = "", "admin"
local pass, passCorrect = "", "admin"
i1 = 0

--PASSWORD FUNCTION
function os.pullEvent()
    local event, p1, p2, p3, p4, p5 = os.pullEventRaw()
    if event == "terminate" then
  term.clear()
  term.setCursorPos(12, 9)
  print("Sorry Ctrl+t is disabled")
	    sleep(2)
  denied()
 end
    return event, p1, p2, p3, p4, p5
end
 
function granted()
 
 term.clear()
 term.setCursorPos(17, 9)
 textutils.slowPrint("Access Granted")
 sleep(1)
 term.clear()
 term.setCursorPos(17, 9)
 
 for i = 1, 2 do
  
  textutils.slowPrint("Initializing...")
  sleep(0.5)
  
  term.setCursorPos(17, 9)
  term.clearLine()
  
 end
 
 textutils.slowPrint("Program is loaded")
 sleep(1)
 term.setCursorPos(1, 3)
 term.clearLine()
 term.setCursorPos(1, 3)
 term.clear()
 
end
function denied()
 term.clear()
 term.setCursorPos(18, 9)
 textutils.slowPrint("Access Denied")
 term.setCursorPos(5, 10)
 textutils.slowPrint("System in PROTECTION MODE for 600 seconds")
 term.setCursorBlink(false)
 sleep(60)
 os.reboot()
end 
  
function passCall()
 
 term.setCursorPos(12, 5)
 
 
 while pass ~= "admin" or i1 == 3 do 
  
  pass = read("*")
  
  if pass == "admin" then
   granted()
   shell.run("disk/reactor")
  
  elseif i1 == 3 then
   denied()
  
  else
   term.setCursorPos(4, 6)
   print("Wrong Password")
   i1 = i1 + 1
   sleep(1)
   term.setCursorPos(1, 5)
   term.clearLine()
   print("Password :")
   term.setCursorPos(1, 6)
   term.clearLine()
   term.setCursorPos(12, 5)
  end
 end
end
 
function userCall()
 
 while user ~= "admin" do
  user = read()
  
  if user == "admin" then
   passCall()
  
  else
   term.setCursorPos(5, 6)
   print("Username Invalid")
   sleep(1)
   term.setCursorPos(11, 4)
   term.clearLine()
   term.setCursorPos(1, 4)
   print("Username :")
   term.setCursorPos(1, 6)
   term.clearLine()
   term.setCursorPos(12, 4)
  end
 end
end
--LOADING SCREEN 
term.clear()
term.setCursorPos(12, 1)
textutils.slowPrint("Welcome to the server") --Change it for what you like
term.setCursorPos(13, 2)
textutils.slowPrint("maintenance room")

 term.setCursorPos(1, 4)
 print("Username :")
 term.setCursorPos(1, 5)
 print("Password :")
 term.setCursorPos(12, 4)
 userCall()

It's been a while i made it so i don't recall where to change the password and the name. It is set to admin.
Cranium #2
Posted 17 November 2012 - 09:50 AM
This is not very protected. The first thing that will happen if the user uses ctrl t is it will error out. Functions have to be declared before calling them. denied() is only declared after the os.pullEvent() function.
Jarle212 #3
Posted 17 November 2012 - 10:05 AM
Players can place a disk drive next to your computer and have a program on a disk that deletes/renames the startupfile on your drive when the computer restarts
crackroach #4
Posted 17 November 2012 - 10:05 AM
This is not very protected. The first thing that will happen if the user uses ctrl t is it will error out. Functions have to be declared before calling them. denied() is only declared after the os.pullEvent() function.
Well, actually it works fine… but i'm always willing to learn, what do you propose?
Pharap #5
Posted 17 November 2012 - 10:33 AM
This is not very protected. The first thing that will happen if the user uses ctrl t is it will error out. Functions have to be declared before calling them. denied() is only declared after the os.pullEvent() function.

Actually it won't. Look again, everything before –LOADING SCREEN is a function, it's just a bit hard to tell unless you look closely since he's overriding os.pullEvent().
I don't blame you though, I only noticed upon second glance.
Tiin57 #6
Posted 17 November 2012 - 10:36 AM

textutils.slowPrint("System in PROTECTION MODE for 600 seconds")
sleep(60)
Bit of a misalignment.
crackroach #7
Posted 17 November 2012 - 06:08 PM

textutils.slowPrint("System in PROTECTION MODE for 600 seconds")
sleep(60)
Bit of a misalignment.
that was just for the purpose of saying " you tryed now it won't work" and not to punish myself for cheater :)/>/>
rhyleymaster #8
Posted 17 November 2012 - 07:06 PM
You should add to the VERY top of the line, this code:
os.pullEvent = os.pullEventRaw
to stop ctrl - T
Orwell #9
Posted 18 November 2012 - 12:40 AM
You should add to the VERY top of the line, this code:
os.pullEvent = os.pullEventRaw
to stop ctrl - T
He did allready override os.pullEvent(). Ctrl+T shouldn't work with his code.

Cranium, os.pullEvent() will not be called before denied() has been defined, so there shouldn't be a problem.
TheVarmari #10
Posted 18 November 2012 - 12:54 AM
I can override this by pressing CTRL+T for exactly 0.9 seconds and then opening the computer. The table declaration will take a tiny bit of time, but if I time it exactly right I can override it and delete startup.
Also, disk drive.
And pickaxe. Pickaxes are nice.