From f4c4387e05ebc305fd70c24d280710056ad2ae36 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Wed, 17 Apr 2024 18:27:46 +0200 Subject: [PATCH] Add automatic login script example --- examples/lua/automatic-login.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 examples/lua/automatic-login.lua diff --git a/examples/lua/automatic-login.lua b/examples/lua/automatic-login.lua new file mode 100644 index 0000000..1787da1 --- /dev/null +++ b/examples/lua/automatic-login.lua @@ -0,0 +1,28 @@ +local logins = { + { + serialnumber = "foo", + username = "foouser", + password = "foopass", + }, + { + serialnumber = "bar", + username = "baruser", + password = "barpass", + }, + { + serialnumber = "baz", + username = "bazuser", + password = "bazpass", + }, +} + +for _, login in ipairs(logins) do + send("\n") + local found = expect(login.serialnumber .. ".*login:", 10) + if (1 == found) then + send(login.username .. "\n") + expect("Password:") + send(login.password .. "\n") + break + end +end