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

Password Startup

Started by PoLoMoTo, 09 May 2012 - 06:19 PM
PoLoMoTo #1
Posted 09 May 2012 - 08:19 PM
(Made this in about five minutes with the password door example so there's plenty of room for improvement.)

I replaced the actual startup file on my computer (not in minecraft) so all my computers and turtles start with it, not sure how well it would work on a server.


os.pullEvent = os.pullEventRaw
local password = "07974"
term.clear()
term.setCursorPos(1,1)
write("Password: ")
local input = read("*")
if input == (password) then
term.clear()
term.setCursorPos(1,1)
print("Password correct!")
sleep(2)
print("Opening terminal...")
sleep(2)
term.clear()
term.setCursorPos(1,1)
local sPath = ".:/rom/programs"
if turtle then
  sPath = sPath..":/rom/programs/turtle"
else
  sPath = sPath..":/rom/programs/computer"
end
shell.setPath( sPath )
help.setPath( "/rom/help" )
shell.setAlias( "ls", "list" )
shell.setAlias( "dir", "list" )
shell.setAlias( "cp", "copy" )
shell.setAlias( "mv", "move" )
shell.setAlias( "rm", "delete" )
if fs.exists( "/rom/autorun" ) and fs.isDir( "/rom/autorun" ) then
  local tFiles = fs.list( "/rom/autorun" )
  table.sort( tFiles )
  for n, sFile in ipairs( tFiles ) do
   if string.sub( sFile, 1, 1 ) ~= "." then
	local sPath = "/rom/autorun/"..sFile
	if not fs.isDir( sPath ) then
	 shell.run( sPath )
	end
   end
  end
end
else
term.clear()
term.setCursorPos(1,1)
print("Password incorrect!")
sleep(2)
os.reboot()
end

(I know it's messy, thats just how it pasted)


[attachment=222:startup.txt]

If you replace your startup like I did you will want to remove the file extension.
reububble #2
Posted 13 July 2013 - 07:49 AM
Well that's just cheating :P/> How are we meant to hack that?
Zudo #3
Posted 13 July 2013 - 08:18 AM
Use pastebin. That's preferred to attachments.
Dave-ee Jones #4
Posted 17 July 2013 - 03:08 AM
Well that's just cheating :P/> How are we meant to hack that?

I hacked it. :D/>
reububble #5
Posted 17 July 2013 - 05:43 AM
Well that's just cheating :P/> How are we meant to hack that?

I hacked it. :D/>

Oh do tell.
jesusthekiller #6
Posted 20 July 2013 - 09:17 AM
Duh, ugly code D:
HaloWarZone #7
Posted 22 July 2013 - 03:00 PM
Good Work
bwhodle #8
Posted 23 July 2013 - 02:57 PM
You could hold down Ctrl+T to terminate the program and then delete it…. it works on craftos and probably others
jesusthekiller #9
Posted 24 July 2013 - 05:52 AM
You could hold down Ctrl+T to terminate the program and then delete it…. it works on craftos and probably others

No you can't…


os.pullEvent = os.pullEventRaw

In first line.
reububble #10
Posted 27 July 2013 - 06:42 PM
The reason you can't hack it is because if you read what is said, the startup file on the ACTUAL computer in REAL LIFE has been replaced. That's the one which is read-only through ComputerCraft. Even if you Ctrl+S, insert disk with startup, then boot, the startup file is not deletable because it's in the /rom/ directory (by memory).