DemolitionDerby 0 Posted May 25, 2017 Share Posted May 25, 2017 Hi, I have looked around for a way to do it but I have not find anything about it. I would like to know if it is possible to password protect a computer so that it asks for either a username and a password or simply a password. Also, is it possible to remove the possibility for the user to terminate the program using CTRL-ALT-C? Thanks! Quote Link to post Share on other sites
0 Log 16 Posted May 29, 2017 Share Posted May 29, 2017 Is a simple example. To nobody could know the password, you need to add hashing. local event = require('event') local term = require('term') local gpu = require('component').gpu local W, H = gpu.getResolution() local color1, color2 = 0x00FF00, 0xFF0000 local password = '123456789' -- needed hash function, for most security event.shouldInterrupt = function() return false end -- blocking Ctrl+Alt+C event.shouldSoftInterrupt = function() return false end -- blocking Ctrl+C gpu.setForeground(color1) while true do term.clear() term.setCursor(W/2-10, H/2) term.write('PASSWORD: ') local input = term.read(_,_,_,'*'):sub(1, -2) if input == password then term.clear() term.setCursor(1, 1) gpu.setForeground(0xFFFFFF) os.exit() else term.clear() gpu.setForeground(color2) term.setCursor(W/2-6, H/2) term.write('ACCESS DENIED') gpu.setForeground(color1) os.sleep(3) end end Quote Link to post Share on other sites
Hi,
I have looked around for a way to do it but I have not find anything about it.
I would like to know if it is possible to password protect a computer so that it asks for either a username and a password or simply a password.
Also, is it possible to remove the possibility for the user to terminate the program using CTRL-ALT-C?
Thanks!
Link to post
Share on other sites