diff --git a/ARKTEMIYS b/ARKTEMIYS new file mode 100644 index 000000000..b5b4900f6 --- /dev/null +++ b/ARKTEMIYS @@ -0,0 +1,94 @@ +-- Administrative console app on plain Lua + +local sha256 = require('sha256') +local twilio_api = require('twilio') + +-- Hash of the secure password +local HASHED_PASSWORD = '12a9b4a4f473aeb511e49b1b7a108a65856786b3e1e8331583497712b9595106' -- SHA-256 'MyPasswordForSafeLua2025!' + +local USER_PHONE_NUMBER = '+79XXXXXXXXX' + +-- Generate random one-time code (OTP) +function generateOTP() + return math.random(100000, 999999) +end + +-- Send OTP via SMS using Twilio +function sendOTP(otp) + local account_sid = 'YOUR_TWILIO_ACCOUNT_SID' + local auth_token = 'YOUR_TWILIO_AUTH_TOKEN' + local sender_number = 'TWILIO_SENDER_NUMBER' + + local client = twilio_api.new(account_sid, auth_token) + + local response = client.messages.create({ + body = "Your One Time Code is: " .. otp, + from = sender_number, + to = USER_PHONE_NUMBER + }) + + if response.sid then + print("OTP sent successfully.") + return true + else + print("Failed to send OTP.") + return false + end +end + +-- Function to verify password against its hash +function authenticate() + while true do + print("Enter your password: ") + local input = io.read() + local hashedInput = sha256(input) + if hashedInput == HASHED_PASSWORD then + return true + else + print("Incorrect password. Try again.") + end + end +end + +-- Two-factor authentication step (sending and verifying OTP) +function twoFactorAuth() + local otp = generateOTP() + if sendOTP(otp) then + print("Check your phone for an OTP.") + print("Enter the OTP received: ") + local enteredOtp = io.read() + if enteredOtp == otp then + print("Two-factor authentication successful.") + return true + else + print("Incorrect OTP. Access denied.") + return false + end + else + print("Error sending OTP. Please try later.") + return false + end +end + +-- Full authentication process +function fullLogin() + if authenticate() then + if twoFactorAuth() then + print("Login successful!\n") + return true + else + print("Two-factor authentication failed. Access denied.\n") + end + else + print("Authentication failed. Access denied.\n") + end + return false +end + +-- If fully authenticated, proceed to main logic +if fullLogin() then + -- Your application logic goes here... + print("Welcome to the system!") +else + os.exit() +end