From f7ba9009305f0e838611211f8717f3d0743c6e86 Mon Sep 17 00:00:00 2001 From: Kan18 <24967425+Kan18@users.noreply.github.com> Date: Wed, 28 Dec 2022 13:22:57 +0400 Subject: [PATCH] genotp.lua changes Make genotp more clearly state that the password can be used once but allows permanent access (sorry for not making this clear earlier.) Use a slightly longer password, and allow uppercase characters except for some that could be ambiguous --- sys/apps/genotp.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/apps/genotp.lua b/sys/apps/genotp.lua index cdaf6eb..e6bd5a1 100644 --- a/sys/apps/genotp.lua +++ b/sys/apps/genotp.lua @@ -1,14 +1,22 @@ local SHA = require("opus.crypto.sha2") -local acceptableCharacters = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"} +local acceptableCharacters = {} +for c = 0, 127 do + local char = string.char(c) + -- exclude potentially ambiguous characters + if char:match("[1-9a-zA-Z]") and char:match("[^OIl]") end + table.insert(acceptableCharacters, char) + end +end local acceptableCharactersLen = #acceptableCharacters - local password = "" -for _i = 1, 8 do +for i = 1, 10 do password = password .. acceptableCharacters[math.random(acceptableCharactersLen)] end os.queueEvent("set_otp", SHA.compute(password)) -print("Your one-time password is: " .. password) \ No newline at end of file +print("This allows one other device to permanently gain access to this device.") +print("Use the trust settings in System to revert this.") +print("Your one-time password is: " .. password)