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

Protection password

Started by sntkilla, 06 July 2013 - 07:40 PM
sntkilla #1
Posted 06 July 2013 - 09:40 PM
Protection password
How to make the Restart/terminate shortcuts only able to be use when a password ha been inputed?

Hey i just started coding and wanted help with it because i made a small program my self but its easy to bypass when the computer is reset and terminated. I have no idea how to block or password protect the shortcuts. Any help?

Regards
Snt
Lyqyd #2
Posted 07 July 2013 - 01:07 AM
Split into new topic.

Ctrl-T can be blocked, usually through replacement of os.pullEvent with os.pullEventRaw; Ctrl-R and Ctrl-S cannot be blocked.
Zudo #3
Posted 07 July 2013 - 03:48 AM
Split into new topic.

Ctrl-T can be blocked, usually through replacement of os.pullEvent with os.pullEventRaw; Ctrl-R and Ctrl-S cannot be blocked unless you modify the BIOS.


A simple ctrl-t blocker:


pass = "vanilla" --Change this
pullevent = os.pullEvent
os.pullEvent = os.pullEventRaw
while true do
print("Please enter the password")
if pass == read("*") then
  break
end
end

os.pullEvent = pullevent
LBPHacker #4
Posted 07 July 2013 - 04:06 AM
Spoiler

pass = "vanilla" --Change this
pullevent = os.pullEvent
while true do
print("Please enter the password")
if pass == read("*") then
  break
end
end

os.pullEvent = pullevent
And where is the most important part? Fixed code:

local pass = "vanilla" --Change this
local pullevent = os.pullEvent
os.pullEvent = os.pullEventRaw -- most important part
while true do
    print("Please enter the password")
    if pass == read("*") then
        break
    end
end

os.pullEvent = pullevent
Zudo #5
Posted 07 July 2013 - 04:11 AM
Spoiler

pass = "vanilla" --Change this
pullevent = os.pullEvent
while true do
print("Please enter the password")
if pass == read("*") then
  break
end
end

os.pullEvent = pullevent
And where is the most important part? Fixed code:

local pass = "vanilla" --Change this
local pullevent = os.pullEvent
os.pullEvent = os.pullEventRaw -- most important part
while true do
	print("Please enter the password")
	if pass == read("*") then
		break
	end
end

os.pullEvent = pullevent

Oops
Lyqyd #6
Posted 07 July 2013 - 12:02 PM
Let's see the code that supposedly blocks Ctrl-R and Ctrl-S, ZudoHackz.
albrat #7
Posted 07 July 2013 - 05:40 PM
I guess it would be to do with this section of code being modified…


local nativeShutdown = os.shutdown
function os.shutdown()
nativeShutdown()
while true do
  coroutine.yield()
end
end

which would mean that all computers on your server would lose the ability to shutdown or restart. so a useless way of doing it. (short of coding it into every computer instead of a common file.)
Lyqyd #8
Posted 07 July 2013 - 09:46 PM
Nope, that wouldn't do it. All that code does is absorb time and events as necessary until an actual shutdown occurs java-side after os.shutdown is called from the Lua.
AgentE382 #9
Posted 07 July 2013 - 09:57 PM
I remember a while ago on IRC somebody was making a pretty good sandbox environment. He placed it in a boot disk that was hidden underground and used a world-protection plugin to ensure nobody could remove it. In that configuration, it doesn't matter if you shut the computer down or restart it, because it'll just reload the sandbox from the boot disk.