718 posts
Location
Hawaii
Posted 06 March 2012 - 03:50 AM
(startup)
term.clear()
term.setCursorPos(1,1)
password = "1234x"
print("CraftOS 1.3")
function trolol()
write("> ")
aba = read()
if aba == password then
print("Access Granted.")
print("Computer unlocked.")
else
print("No such program")
trolol()
end
end
trolol()
(Change password = "1234x" to your password)
Secretly lock computers with this program. It looks normal but when you try to open a program it says it doesn't exist! Entering the correct password will remove the lock but it will come back when you restart the computer. You can put this on your friends computer and make them think why isn't anything working!
454 posts
Location
London
Posted 06 March 2012 - 04:21 AM
You should do 'return trolol()', so it's a tail call (meaning, it won't stack error if you hold down enter for a long enough time, since it's reused.)
Alternatively, you could do it in a loop:
repeat
write("> ")
local input = read()
if input ~= password then
print("No such program")
end
until input == password
print("Access Granted:")
print("Computer unlocked.")
14 posts
Posted 06 March 2012 - 11:27 PM
A loop is better…. as it doesnt keep creating unnecessary scopes. Also it would be better to use local variables… just saying.
local password, input;
password = string.reverse('tene');
repeat
write("> ")
input = read('*')
if string.reverse(input) ~= password then
print("Incorrect password!");
sleep(2);
shell.run('clear'); --clean screen
end
until input == password
print("Access Granted:")
print("Computer unlocked.")
--Although this can easily be destroyed by ctrl+T
--My gui api features a way to block termination
718 posts
Location
Hawaii
Posted 07 March 2012 - 02:01 AM
–Although this can easily be destroyed by ctrl+T
That why im trying to make it hidden
66 posts
Posted 11 March 2012 - 08:34 AM
This can also be destroyed by holding down enter
718 posts
Location
Hawaii
Posted 11 March 2012 - 10:13 AM
This can also be destroyed by holding down enter
Read the other posts
378 posts
Location
In the TARDIS
Posted 11 March 2012 - 02:34 PM
You can disable terminating with parallel.waitForAny() and if event == "terminate" then os.reboot() end
21 posts
Posted 08 April 2012 - 09:54 PM
this can be easily removed… CTRL+T for a few seconds then delete startup and its gone
474 posts
Posted 08 April 2012 - 09:59 PM
To fix the CTRL+T problem, add this at the top of your program:
local event, p1, p2, p3, p4, p5 = os.pullEventRaw()
if event == "terminate" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Not happening! >:3")
sleep(1)
os.reboot()
end
1604 posts
Posted 09 April 2012 - 02:00 AM
To fix the CTRL+T problem, add this at the top of your program:
local event, p1, p2, p3, p4, p5 = os.pullEvent()
local w, h = term.getSize()
if event == "terminate" then
term.clear()
term.setCursorPos(w-1, h-1)
textutils.slowPrint("Not happening! >:3")
sleep(1)
os.reboot()
end
And how would that fix the Ctrl + T problem?
You have to use os.pullEventRaw() if you want to avoid termination.
474 posts
Posted 09 April 2012 - 02:17 AM
To fix the CTRL+T problem, add this at the top of your program:
local event, p1, p2, p3, p4, p5 = os.pullEventRaw()
if event == "terminate" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Not happening! >:3")
sleep(1)
os.reboot()
end
And how would that fix the Ctrl + T problem?
You have to use os.pullEventRaw() if you want to avoid termination.
Forgot about that. xD Fixed the code.
29 posts
Location
Where am I? My Minecraft GPS tells me I'm in Minecraft.
Posted 30 January 2013 - 12:55 PM
Just saying that this isn't much of a lock since booting from a disk will allow access and will allow the discovery of your code. Then they can remove your code from their OS. Finally your code would fail to lock their computer.
7508 posts
Location
Australia
Posted 30 January 2013 - 12:57 PM
Just saying that this isn't much of a lock since booting from a disk will allow access and will allow the discovery of your code.
There is no way to stop this…. so this can be said for ALL locks… also, how secure is the lock on your house? not very, someone can come along with a skeleton key or a lock pick and open it, OR they can just kick in the door… If someone wants to get in they will, all we can do is slow them down. Locks are designed to keep honest people out.
497 posts
Location
The Big Apple, NY
Posted 30 January 2013 - 02:33 PM
Just saying that this isn't much of a lock since booting from a disk will allow access and will allow the discovery of your code. Then they can remove your code from their OS. Finally your code would fail to lock their computer.
Why must you bump such a old topic with something that isn't helpful and could (and has) be posted on almost every lock thread……
892 posts
Location
Where you'd least expect it.
Posted 30 January 2013 - 03:07 PM
Are you trying to copy my FakeConsole idea! D:
Just kidding, nice program.
Edit: Oops, saw the necromancy. D:
423 posts
Location
AfterLifeLochie's "Dungeon", Australia
Posted 30 January 2013 - 08:18 PM
Locked to prevent further dark-necromancy. Please don't revive old threads.